Interface SubjectAdminSession

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

public interface SubjectAdminSession extends OsidSession

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

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

The delete operations delete Subjects . To unmap a Subject from the current Ontology , the SubjectOntologyAssignmentSession should be used. These delete operations attempt to remove the Subject 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.
    • canCreateSubjects

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

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

      SubjectForm getSubjectFormForCreate(Type[] subjectRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the subject form for creating new subjects. A new form should be requested for each create transaction.
      Parameters:
      subjectRecordTypes - array of subject record types
      Returns:
      the subject form
      Throws:
      NullArgumentException - subjectRecordTypes 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.
    • createSubject

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

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

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

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

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

      Deletes the Subject identified by the given Id .
      Parameters:
      subjectId - the Id of the Subject to delete
      Throws:
      NotFoundException - a Subject was not found identified by the given Id
      NullArgumentException - subjectId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageSubjectAliases

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

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