Interface KeyAgencyAssignmentSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session provides methods to re-assign Keys to
Agencies An Key may map to multiple Agency objects and
removing the last reference to an Key is the equivalent of
deleting it. Each Agency may have its own authorizations governing
who is allowed to operate on it.
Moving or adding a reference of an Ageny to another
Agency is not a copy operation (eg: does not change its Id ).
-
Method Summary
Modifier and TypeMethodDescriptionvoidassignKeyToAgency(Id keyId, Id agencyId) Adds an existingKeyto anAgency.booleanTests if this user can alter key/agency mappings.booleancanAssignKeysToAgency(Id agencyId) Tests if this user can alter key/agency mappings.getAssignableAgencyIds(Id agencyId) Gets a list of agencies including and under the given agency node in which any key can be assigned.getAssignableAgencyIdsForKey(Id agencyId, Id keyId) Gets a list of agencies including and under the given agency node in which a specific key can be assigned.voidreassignKeyToAgency(Id keyId, Id fromAgencyId, Id toAgencyId) Moves aKeyfrom oneAgencyto another.voidunassignKeyFromAgency(Id keyId, Id agencyId) Removes anKeyfrom anAgency.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
canAssignKeys
boolean canAssignKeys()Tests if this user can alter key/agency mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users.- Returns:
falseif mapping is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canAssignKeysToAgency
Tests if this user can alter key/agency mappings. A return of true does not guarantee successful authorization. A return of false indicates that it is known mapping methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations to unauthorized users.- Parameters:
agencyId- theIdof theAgency- Returns:
falseif mapping is not authorized,trueotherwise- Throws:
NullArgumentException-agencyIdisnull- Compliance:
mandatory- This method must be implemented.
-
getAssignableAgencyIds
Gets a list of agencies including and under the given agency node in which any key can be assigned.- Parameters:
agencyId- theIdof theAgency- Returns:
- list of assignable agency
Ids - Throws:
NullArgumentException-agencyIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
getAssignableAgencyIdsForKey
Gets a list of agencies including and under the given agency node in which a specific key can be assigned.- Parameters:
agencyId- theIdof theAgencykeyId- theIdof theKey- Returns:
- list of assignable bin
Ids - Throws:
NullArgumentException-agencyIdorkeyIdisnullOperationFailedException- unable to complete request- Compliance:
mandatory- This method must be implemented.
-
assignKeyToAgency
void assignKeyToAgency(Id keyId, Id agencyId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds an existingKeyto anAgency.- Parameters:
keyId- theIdof theKeyagencyId- theIdof theAgency- Throws:
AlreadyExistsException-keyIdis already assigned toagencyIdNotFoundException-keyIdoragencyIdnot foundNullArgumentException-keyIdoragencyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
unassignKeyFromAgency
void unassignKeyFromAgency(Id keyId, Id agencyId) throws NotFoundException, OperationFailedException, PermissionDeniedException Removes anKeyfrom anAgency.- Parameters:
keyId- theIdof theKeyagencyId- theIdof theAgency- Throws:
NotFoundException-keyIdoragencyIdnot found orkeyIdnot assigned toagencyIdNullArgumentException-keyIdoragencyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
reassignKeyToAgency
void reassignKeyToAgency(Id keyId, Id fromAgencyId, Id toAgencyId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Moves aKeyfrom oneAgencyto another. Mappings to otherAgenciesare unaffected.- Parameters:
keyId- theIdof theKeyfromAgencyId- theIdof the currentAgencytoAgencyId- theIdof the destinationAgency- Throws:
AlreadyExistsException-keyIdalready assigned totoAgencyIdNotFoundException-keyId, fromAgencyId, ortoAgencyIdnot found orkeyIdnot mapped tofromAgencyIdNullArgumentException-keyId, fromAgencyId, ortoAgencyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-