Interface AgentLookupSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session provides methods for retrieving Agent objects. The
Agent represents the authenticated entity. Agents generally map to
resources although this isn't always the case.
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 agent methods in this session operate, retrieve and pertain to agents defined explicitly in the current agency. Using an isolated view is useful for managing agents with the AgentAdminSession.
- federated agency view: All agent methods in this session operate, retrieve and pertain to all agents 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 a particular element is inaccessible. 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.
Agents may have an additional records indicated by their respective
record types. The record may not be accessed through a cast of the
Agent .
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can performAgentlookups.Gets theAgencyassociated with this session.Gets theAgencyIdassociated with this session.Gets theAgentspecified by itsId.Gets allAgents.getAgentsByGenusType(Type agentGenusType) Gets anAgentListcorresponding to the given agent genusTypewhich does not include agents of genus types derived from the specifiedType.getAgentsByIds(IdList agentIds) Gets anAgentListcorresponding to the givenIdList.getAgentsByParentGenusType(Type agentGenusType) Gets anAgentListcorresponding to the given agent genusTypeand include any additional agents with genus types derived from the specifiedType.getAgentsByRecordType(Type agentRecordType) Gets anAgentListcontaining the given agent 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 theAgentreturns 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.
-
canLookupAgents
boolean canLookupAgents()Tests if this user can performAgentlookups. A return of true does not guarantee successful authorization. A return of false indicates that it is known all 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.- Returns:
falseif lookup methods are not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
useComparativeAgentView
void useComparativeAgentView()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.
-
usePlenaryAgentView
void usePlenaryAgentView()A complete view of theAgentreturns 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 agents 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.
-
getAgent
Agent getAgent(Id agentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets theAgentspecified by itsId. In plenary mode, the exactIdis found or aNOT_FOUNDresults. Otherwise, the returnedAgentmay have a differentIdthan requested, such as the case where a duplicateIdwas assigned to anAgentand retained for compatibility.- Parameters:
agentId- theIdof anAgent- Returns:
- the returned
Agent - Throws:
NotFoundException- noAgentfound with the givenIdNullArgumentException-agentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAgentsByIds
AgentList getAgentsByIds(IdList agentIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets anAgentListcorresponding to the givenIdList. In plenary mode, the returned list contains all of the 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, inaccessibleAgentsmay be omitted from the list and may present the elements in any order including returning a unique set.- Parameters:
agentIds- a list of agentIds- Returns:
- the returned
Agent list - Throws:
NotFoundException- anId wasnot foundNullArgumentException-agentIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAgentsByGenusType
AgentList getAgentsByGenusType(Type agentGenusType) throws OperationFailedException, PermissionDeniedException Gets anAgentListcorresponding to the given agent genusTypewhich does not include agents of genus types derived from the specifiedType. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents that are accessible through this session.- Parameters:
agentGenusType- an agent genus type- Returns:
- the returned
Agentlist - Throws:
NullArgumentException-agentGenusTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAgentsByParentGenusType
AgentList getAgentsByParentGenusType(Type agentGenusType) throws OperationFailedException, PermissionDeniedException Gets anAgentListcorresponding to the given agent genusTypeand include any additional agents with genus types derived from the specifiedType. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents that are accessible through this session.- Parameters:
agentGenusType- an agent genus type- Returns:
- the returned
Agentlist - Throws:
NullArgumentException-agentGenusTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAgentsByRecordType
AgentList getAgentsByRecordType(Type agentRecordType) throws OperationFailedException, PermissionDeniedException Gets anAgentListcontaining the given agent recordType. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents that are accessible through this session.- Parameters:
agentRecordType- an agent record type- Returns:
- the returned
Agentlist - Throws:
NullArgumentException-agentRecordTypeisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getAgents
Gets allAgents. In plenary mode, the returned list contains all known agents or an error results. Otherwise, the returned list may contain only those agents that are accessible through this session.- Returns:
- a list of
Agents - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-