Interface AgentAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
AgentBatchAdminSession

public interface AgentAdminSession extends OsidSession

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 Details

    • getAgencyId

      Id getAgencyId()
      Gets the Agency Id associated with this session.
      Returns:
      the Agency Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getAgency

      Gets the Agency associated with this session.
      Returns:
      the Agency associated with this session
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateAgents

      boolean canCreateAgents()
      Tests if this user can create Agents . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an Agent will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.
      Returns:
      false if Agent creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateAgentWithRecordTypes

      boolean canCreateAgentWithRecordTypes(Type[] agentRecordTypes)
      Tests if this user can create a single Agent using the desired record types. While AuthenticationManager.getAgentRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Agent . Providing an empty array tests if an Agent can be created with no records.
      Parameters:
      agentRecordTypes - array of agent record types
      Returns:
      true if Agent creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - agentRecordTypes is null
      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 - agentRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createAgent

      Creates a new Agent .
      Parameters:
      agentForm - the form for this Agent
      Returns:
      the new Agent
      Throws:
      IllegalStateException - agentForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - agentForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - agentForm did not originate from getAgentFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateAgents

      boolean canUpdateAgents()
      Tests if this user can update Agents . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an Agent will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.
      Returns:
      false if agent modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateAgent

      boolean canUpdateAgent(Id agentId)
      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 a PERMISSION_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 - the Id of the Agent
      Returns:
      false if agent modification is not authorized, true otherwise
      Throws:
      NullArgumentException - agentId is null
      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

      Gets the agent form for updating an existing agent. A new agent form should be requested for each update transaction.
      Parameters:
      agentId - the Id of the Agent
      Returns:
      the agent form
      Throws:
      NotFoundException - agentId is not found
      NullArgumentException - agentId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateAgent

      void updateAgent(AgentForm agentForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing agent.
      Parameters:
      agentForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - agentForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - agentId or agentForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - agentForm did not originate from getAgentFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteAgents

      boolean canDeleteAgents()
      Tests if this user can delete Agents . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Agent will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.
      Returns:
      false if Agent deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteAgent

      boolean canDeleteAgent(Id agentId)
      Tests if this user can delete a specified Agent . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting the Agent will result in a PERMISSION_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 - the Id of the Agent
      Returns:
      false if Agent deletion is not authorized, true otherwise
      Throws:
      NullArgumentException - agentId is null
      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

      Deletes the Agent identified by the given Id removing it from all other Agencies to which this Agent is associated.
      Parameters:
      agentId - the Id of the Agent to delete
      Throws:
      NotFoundException - an Agent was not found identified by the given Id
      NullArgumentException - agentId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageAgentAliases

      boolean canManageAgentAliases()
      Tests if this user can manage Id aliases for Agents . A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in a PERMISSION_DENIED . This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.
      Returns:
      false if Agent aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasAgent

      Adds an Id to an Agent for the purpose of creating compatibility. The primary Id of the Agent is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another engine, it is reassigned to the given engine Id .
      Parameters:
      agentId - the Id of an Agent
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is already assigned
      NotFoundException - agentId not found
      NullArgumentException - agentId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.