Interface AgentAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
AgentBatchAdminSession
This session creates, updates, and deletes Agents . The data
for create and update is provided by the consumer via the form object.
OsidForms are requested for each create or update and may not be
reused.
Create and update operations differ in their usage. To create an
Agent , an AgentForm is requested using
getAgentFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned AgentForm
will indicate that it is to be used with a create operation and can be
used to examine metdata or validate data prior to creation. Once the
AgentForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each AgentForm corresponds to an attempted transaction.
For updates, AgentForms are requested to the Agent
Id that is to be updated using getAgentFormForUpdate() .
Similarly, the AgentForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
AgentForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Agents . To unmap an
Agent from the current Agency , the
AgentAgencyAssignmentSession should be used. These delete operations
attempt to remove the Agent itself thus removing it from all known
Agency catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasAgent(Id agentId, Id aliasId) Adds anIdto anAgentfor the purpose of creating compatibility.booleanTests if this user can createAgents.booleancanCreateAgentWithRecordTypes(Type[] agentRecordTypes) Tests if this user can create a singleAgentusing the desired record types.booleancanDeleteAgent(Id agentId) Tests if this user can delete a specifiedAgent.booleanTests if this user can deleteAgents.booleanTests if this user can manageIdaliases forAgents.booleancanUpdateAgent(Id agentId) Tests if this user can update a specified agent.booleanTests if this user can updateAgents.createAgent(AgentForm agentForm) Creates a newAgent.voiddeleteAgent(Id agentId) Deletes theAgentidentified by the givenIdremoving it from all otherAgenciesto which thisAgentis associated.Gets theAgencyassociated with this session.Gets theAgencyIdassociated with this session.getAgentFormForCreate(Type[] agentRecordTypes) Gets the agent form for creating new agents.getAgentFormForUpdate(Id agentId) Gets the agent form for updating an existing agent.voidupdateAgent(AgentForm agentForm) Updates an existing agent.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.
-
canCreateAgents
boolean canCreateAgents()Tests if this user can createAgents. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anAgentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifAgentcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateAgentWithRecordTypes
Tests if this user can create a singleAgentusing the desired record types. WhileAuthenticationManager.getAgentRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificAgent. Providing an empty array tests if anAgentcan be created with no records.- Parameters:
agentRecordTypes- array of agent record types- Returns:
trueifAgentcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-agentRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getAgentFormForCreate
AgentForm getAgentFormForCreate(Type[] agentRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the agent form for creating new agents. A new form should be requested for each create transaction.- Parameters:
agentRecordTypes- array of agent record types- Returns:
- the agent form
- Throws:
NullArgumentException-agentRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createAgent
Creates a newAgent.- Parameters:
agentForm- the form for thisAgent- Returns:
- the new
Agent - Throws:
IllegalStateException-agentFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-agentFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-agentFormdid not originate fromgetAgentFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateAgents
boolean canUpdateAgents()Tests if this user can updateAgents. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anAgentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseif agent modification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canUpdateAgent
Tests if this user can update a specified agent. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating the agent will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer an update operation to an unauthorized user for this agent.- Parameters:
agentId- theIdof theAgent- Returns:
falseif agent modification is not authorized,trueotherwise- Throws:
NullArgumentException-agentIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code agentId} is not found, then it is acceptable to return false to indicate the lack of an update available.
-
getAgentFormForUpdate
AgentForm getAgentFormForUpdate(Id agentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the agent form for updating an existing agent. A new agent form should be requested for each update transaction.- Parameters:
agentId- theIdof theAgent- Returns:
- the agent form
- Throws:
NotFoundException-agentIdis not foundNullArgumentException-agentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateAgent
Updates an existing agent.- Parameters:
agentForm- the form containing the elements to be updated- Throws:
IllegalStateException-agentFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-agentIdoragentFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-agentFormdid not originate fromgetAgentFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteAgents
boolean canDeleteAgents()Tests if this user can deleteAgents. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anAgentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifAgentdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canDeleteAgent
Tests if this user can delete a specifiedAgent. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting theAgentwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer a delete operation to an unauthorized user for this agent.- Parameters:
agentId- theIdof theAgent- Returns:
falseifAgentdeletion is not authorized,trueotherwise- Throws:
NullArgumentException-agentIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code agentId} is not found, then it is acceptable to return false to indicate the lack of a delete available.
-
deleteAgent
void deleteAgent(Id agentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes theAgentidentified by the givenIdremoving it from all otherAgenciesto which thisAgentis associated.- Parameters:
agentId- theIdof theAgentto delete- Throws:
NotFoundException- anAgentwas not found identified by the givenIdNullArgumentException-agentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageAgentAliases
boolean canManageAgentAliases()Tests if this user can manageIdaliases forAgents. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifAgentaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasAgent
void aliasAgent(Id agentId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anAgentfor the purpose of creating compatibility. The primaryIdof theAgentis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another engine, it is reassigned to the given engineId.- Parameters:
agentId- theIdof anAgentaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-agentIdnot foundNullArgumentException-agentIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-