Interface KeyLookupSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session provides methods for retrieving Key objects. The
Key is associated with an Agent and identified by the
Agent Id.
This session defines two sets of views which offer differing behaviors when retrieving multiple objects.
- comparative view: elements may be silently omitted or re-ordered
- plenary view: provides a complete and ordered result set or is an error condition
- isolated agency view: All key methods in this session operate, retrieve and pertain to keys defined explicitly in the current agency. Using an isolated view is useful for managing keys with the KeyAdminSession.
- federated agency view: All key methods in this session operate, retrieve and pertain to all keys defined in this agency and any other agents implicitly available in this agency through agency inheritence.
Generally, the comparative view should be used for most applications as it permits operation even if there is data out of sync. For example, a hierarchy output can be plugged into a lookup method to retrieve all objects known to a hierarchy, but it may not be necessary to break execution if a node from the hierarchy no longer exists. However, some administrative applications may need to know whether it had retrieved an entire set of objects and may sacrifice some interoperability for the sake of precision.
Keys may have an additional records indicated by their respective
record types. The record may not be accessed through a cast of the
Key .
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can lookupKeys.Gets theAgencyassociated with this session.Gets theAgencyIdassociated with this session.Gets the agent key.getKeyForAgent(Id agentId) Gets the agent key.getKeys()Gets allKeys.getKeysByGenusType(Type keyGenusType) Gets aKeyListcorresponding to the given key genusTypewhich does not include keys of genus types derived from the specifiedType.getKeysByIds(IdList keyIds) Gets aKeyListcorresponding to the given agentIdList.getKeysByParentGenusType(Type keyGenusType) Gets aKeyListcorresponding to the given key genusTypeand include any additional keys with genus types derived from the specifiedType.getKeysByRecordType(Type keyRecordType) Gets a list of keys corresponding to the given key recordType.voidThe returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error.voidFederates the view for methods in this session.voidIsolates the view for methods in this session.voidA complete view of theKeyreturns is desired.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
-
getAgencyId
Id getAgencyId()Gets theAgencyIdassociated with this session.- Returns:
- the
Agency Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getAgency
Gets theAgencyassociated with this session.- Returns:
- the
Agencyassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canLookupKeys
boolean canLookupKeys()Tests if this user can lookupKeys. A return of true does not guarantee successful authorization. A return of false indicates that it is known getting aKeywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt to offer key management functions to unauthorized users.- Returns:
falseif key management is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
useComparativeKeyView
void useComparativeKeyView()The returns from the lookup methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision.- Compliance:
mandatory- This method is must be implemented.
-
usePlenaryKeyView
void usePlenaryKeyView()A complete view of theKeyreturns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability.- Compliance:
mandatory- This method is must be implemented.
-
useFederatedAgencyView
void useFederatedAgencyView()Federates the view for methods in this session. A federated view will include keys in agencies which are children of this agency in the agency hierarchy.- Compliance:
mandatory- This method is must be implemented.
-
useIsolatedAgencyView
void useIsolatedAgencyView()Isolates the view for methods in this session. An isolated view restricts lookups to this agency only.- Compliance:
mandatory- This method is must be implemented.
-
getKey
Gets the agent key. In plenary mode, the exact Id is found or a NOT_FOUND results. Otherwise, the returnedAgentvia theKeymay have a different Id than requested, such as the case where a duplicateIdwas assigned to an Agent and retained for compatibility.- Parameters:
keyId- theIdof theKey- Returns:
- the key
- Throws:
NotFoundException-keyIdis not found or no key existsNullArgumentException-keyIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getKeysByIds
KeyList getKeysByIds(IdList keyIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets aKeyListcorresponding to the given agentIdList. In plenary mode, the returned list contains all of the keys for agents specified in theIdlist, in the order of the list, including duplicates, or an error results if anIdin the supplied list is not found or inaccessible. Otherwise, inaccessibleKeysmay be omitted from the list and may present the elements in any order including returning a unique set.- Parameters:
keyIds- the list ofIdsto retrieve- Returns:
- the returned
Keylist - Throws:
NotFoundException- anId wasnot foundNullArgumentException-keyIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getKeysByGenusType
KeyList getKeysByGenusType(Type keyGenusType) throws OperationFailedException, PermissionDeniedException Gets aKeyListcorresponding to the given key genusTypewhich does not include keys of genus types derived from the specifiedType. In plenary mode, the returned list contains all known keys or an error results. Otherwise, the returned list may contain only those keys that are accessible through this session.- Parameters:
keyGenusType- a key genus type- Returns:
- the returned
Keylist - Throws:
NullArgumentException-keyGenusTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
getKeysByParentGenusType
KeyList getKeysByParentGenusType(Type keyGenusType) throws OperationFailedException, PermissionDeniedException Gets aKeyListcorresponding to the given key genusTypeand include any additional keys with genus types derived from the specifiedType. In plenary mode, the returned list contains all known keys or an error results. Otherwise, the returned list may contain only those keys that are accessible through this session.- Parameters:
keyGenusType- a key genus type- Returns:
- the returned
Keylist - Throws:
NullArgumentException-keyGenusTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure occurred- Compliance:
mandatory- This method must be implemented.
-
getKeysByRecordType
KeyList getKeysByRecordType(Type keyRecordType) throws OperationFailedException, PermissionDeniedException Gets a list of keys corresponding to the given key recordType. The set of keys implementing the given record type is returned. In plenary mode, the returned list contains all known keys or an error results. Otherwise, the returned list may contain only those keys that are accessible through this session.- Parameters:
keyRecordType- a key record type- Returns:
- the returned
Keylist - Throws:
NullArgumentException-keyRecordTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getKeyForAgent
Key getKeyForAgent(Id agentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the agent key.- Parameters:
agentId- theIdof theAgent- Returns:
- the key
- Throws:
NotFoundException-agentIdis not found or no key existsNullArgumentException-agentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getKeys
Gets allKeys. In plenary mode, the returned list contains all known keys or an error results. Otherwise, the returned list may contain only those keys that are accessible through this session.- Returns:
- a list of
Keys - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-