@Component public class PartnerManagerImpl extends ManagerHelperImpl<Partner> implements PartnerManager
PartnerManager.UpdateField
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
classType |
Constructor and Description |
---|
PartnerManagerImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
exists(java.lang.String partnerRef)
Returns whether a partner reference exists (as a registered ASSISTments partner).
|
Partner |
getMyPartner()
Returns the current application's or service's Partner object originating from the
PartnerCredentials as defined in the current application's configuration file (xml). |
int |
getMyPartnerId()
Returns the current application's or service's Partner ID originating from persisted version of
PartnerCredentials as defined in the current application's configuration file (xml). |
java.lang.String |
getMyPartnerRef()
Returns the current application's or service's Partner external reference name originating from the
PartnerCredentials as defined in the current application's configuration file (xml). |
Partner |
getPartner(java.lang.String partnerRef)
Returns the Partner object for the named partner
|
int |
getPartnerId(java.lang.String partnerRef)
Returns the database ID for a partner reference
Note: For use only by Service Administrators.
|
java.util.List<java.lang.String> |
getPartnerReferences()
Returns a list of all partner references
|
java.util.List<Partner> |
getPartners() |
Partner |
getRequestingPartner()
Returns the Partner object for the requesting application or service.
|
int |
getRequestingPartnerId()
Returns the persisted Partner ID for the requesting application or service.
|
java.lang.String |
getRequestingPartnerRef()
Returns the Partner reference for the requesting application or service.
|
void |
init() |
java.util.List<Partner> |
registerDependencies(PartnerCredentials pCreds) |
Partner |
registerOrUpdate(PartnerCredentials partnerCreds)
Registers a new application with the ASSISTmetns Service (AS)
|
void |
update(java.util.List<Pair<PartnerManager.UpdateField,java.lang.String>> values) |
void |
update(java.lang.String partnerRef,
java.util.List<Pair<PartnerManager.UpdateField,java.lang.String>> values)
Updates a partner application's select registration fields
|
void |
updateRegistration(Partner partner)
Updates a partner application's registration.
|
createExternalReferenceFor
@PostConstruct public void init()
@Transactional public Partner registerOrUpdate(PartnerCredentials partnerCreds) throws AlreadyExistsException
PartnerManager
Only the AS admin applications is allowed to call this method.
registerOrUpdate
in interface PartnerManager
partnerCreds
- Partner application to registerAlreadyExistsException
- If partnerRef is already in usepublic java.util.List<Partner> registerDependencies(PartnerCredentials pCreds)
registerDependencies
in interface PartnerManager
public void updateRegistration(Partner partner)
PartnerManager
Note: Presently for use only by System Administrators. Going forward, the API should allow partner applications to update a subset of their registration data.
Replaces all partner application fields with the values provided. The correct use of this method
is to call PartnerManager.getPartner(String)
, update the returned PartnerApplication object
and to pass the updated object to this method.
updateRegistration
in interface PartnerManager
partner
- New settingsPartnerManager.getPartner(String)
public boolean exists(java.lang.String partnerRef)
PartnerManager
Note: For use only by Service Administrators.
exists
in interface PartnerManager
partnerRef
- Partner reference of interestpublic Partner getMyPartner() throws NotFoundException
PartnerManager
PartnerCredentials
as defined in the current application's configuration file (xml).
Note: Use with caution. In most cases you are interested in the requesting
partner as your application is acting on behalf of that requestor. See PartnerManager.getRequestingPartner()
.
getMyPartner
in interface PartnerManager
NotFoundException
- If somehow the current application does not have a persisted entry. Unexpected.public java.lang.String getMyPartnerRef()
PartnerManager
PartnerCredentials
as defined in the current application's configuration file (xml).
Note: Use with caution. In most cases you are interested in the requesting
partner as your application is acting on behalf of that requestor. See PartnerManager.getRequestingPartnerRef()
.
getMyPartnerRef
in interface PartnerManager
public int getMyPartnerId() throws NotFoundException
PartnerManager
PartnerCredentials
as defined in the current application's configuration file (xml).
Note: Use with caution. In most cases you are interested in the requesting
partner as your application is acting on behalf of that requestor. See PartnerManager.getRequestingPartnerId()
.
getMyPartnerId
in interface PartnerManager
NotFoundException
- If somehow the current application does not have a persisted entry. Unexpected.public Partner getRequestingPartner()
PartnerManager
getRequestingPartner
in interface PartnerManager
public java.lang.String getRequestingPartnerRef()
PartnerManager
getRequestingPartnerRef
in interface PartnerManager
public int getRequestingPartnerId() throws NotFoundException
PartnerManager
getRequestingPartnerId
in interface PartnerManager
NotFoundException
- If the requestor presented an invalid partner reference.public Partner getPartner(java.lang.String partnerRef) throws NotFoundException
PartnerManager
Note: For use only by Service Administrators.
For their application, partners call #getPartner()
.
getPartner
in interface PartnerManager
partnerRef
- Partner referenceNotFoundException
- If the named application is not a registered partner.public int getPartnerId(java.lang.String partnerRef) throws NotFoundException
PartnerManager
#getPartnerId()
.getPartnerId
in interface PartnerManager
partnerRef
- Partner reference of interestNotFoundException
- If the specified partnerRef is not foundpublic java.util.List<Partner> getPartners()
getPartners
in interface PartnerManager
public java.util.List<java.lang.String> getPartnerReferences()
PartnerManager
getPartnerReferences
in interface PartnerManager
public void update(java.util.List<Pair<PartnerManager.UpdateField,java.lang.String>> values)
update
in interface PartnerManager
public void update(java.lang.String partnerRef, java.util.List<Pair<PartnerManager.UpdateField,java.lang.String>> values)
PartnerManager
update
in interface PartnerManager
partnerRef
- Partner application reference to updatevalues
- List of fields and values to update