Interface AgencyAdminSession

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

public interface AgencyAdminSession extends OsidSession

This session creates, updates, and deletes Agencies . 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 Agency , an AgencyForm is requested using getAgencyFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned AgencyForm 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 AgencyForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each AgencyForm corresponds to an attempted transaction.

For updates, AgencyForms are requested to the Agency Id that is to be updated using getAgencyFormForUpdate() . Similarly, the AgencyForm has metadata about the data that can be updated and it can perform validation before submitting the update. The AgencyForm can only be used once for a successful update and cannot be reused.

The delete operations delete Agencies .

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • canCreateAgencies

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

      boolean canCreateAgencyWithRecordTypes(Type[] agencyRecordTypes)
      Tests if this user can create a single Agency using the desired record types. While AuthenticationManager.getAgencyRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Agency . Providing an empty array tests if an Agency can be created with no records.
      Parameters:
      agencyRecordTypes - array of agency record types
      Returns:
      true if Agency creation using the specified Types is supported, false otherwise
      Throws:
      NullArgumentException - agencyRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getAgencyFormForCreate

      AgencyForm getAgencyFormForCreate(Type[] agencyRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the agency form for creating new agencies. A new form should be requested for each create transaction.
      Parameters:
      agencyRecordTypes - array of agency record types
      Returns:
      the agency form
      Throws:
      NullArgumentException - agencyRecordTypes 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.
    • createAgency

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

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

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

      void updateAgency(AgencyForm agencyForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing agency.
      Parameters:
      agencyForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - agencyForm already used for an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - agencyForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - agencyForm did not originate from getAgencyFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteAgencies

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

      Deletes an Agency .
      Parameters:
      agencyId - the Id of the Agency to remove
      Throws:
      NotFoundException - agencyId not found
      NullArgumentException - agencyId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageAgencyAliases

      boolean canManageAgencyAliases()
      Tests if this user can manage Id aliases for Agencies . 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 Agency aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasAgency

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