Interface RelevancyAdminSession

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

public interface RelevancyAdminSession extends OsidSession

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

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

The delete operations delete Relevancies . To unmap a Relevancy from the current Ontology , the RelevancyOntologyAssignmentSession should be used. These delete operations attempt to remove the Relevancy itself thus removing it from all known Ontology catalogs.

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

  • Method Details

    • getOntologyId

      Id getOntologyId()
      Gets the Ontology Id associated with this session.
      Returns:
      the Ontology Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getOntology

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

      boolean canCreateRelevancies()
      Tests if this user can create relevancies. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Relevancy 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 Relevancy creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateRelevancyWithRecordTypes

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

      RelevancyForm getRelevancyFormForCreate(Id subjectId, Id id, Type[] relevancyRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the relevancy form for creating new relevancies. A new form should be requested for each create transaction.
      Parameters:
      subjectId - the Id of the Subject
      id - a mapped Id
      relevancyRecordTypes - array of relevancy record types
      Returns:
      the relevancy form
      Throws:
      NotFoundException - subjectId is not found
      NullArgumentException - subjectId or id 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.
    • createRelevancy

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

      boolean canUpdateRelevancies()
      Tests if this user can update relevancies. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Relevancy 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 relevancy modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getRelevancyFormForUpdate

      RelevancyForm getRelevancyFormForUpdate(Id relevancyId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the relevancy form for updating an existing relevancy. A new relevancy form should be requested for each update transaction.
      Parameters:
      relevancyId - the Id of the Relevancy
      Returns:
      the relevancy form
      Throws:
      NotFoundException - relevancyId is not found
      NullArgumentException - relevancyId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateRelevancy

      void updateRelevancy(RelevancyForm relevancyForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing relevancy.
      Parameters:
      relevancyForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - relevancyForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - relevancyForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - relevancyForm did not originate from getRelevancyFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteRelevancies

      boolean canDeleteRelevancies()
      Tests if this user can delete relevancies. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Relevancy 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 Relevancy deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteRelevancy

      void deleteRelevancy(Id relevancyId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes the Relevancy identified by the given Id .
      Parameters:
      relevancyId - the Id of the Relevancy to delete
      Throws:
      NotFoundException - a Relevancy was not found identified by the given Id
      NullArgumentException - relevancyId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageRelevancyAliases

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

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