Interface TextAdminSession

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

public interface TextAdminSession extends OsidSession

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

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

The delete operations delete Texts . To unmap a Text from the current Press , the TextPressAssignmentSession should be used. These delete operations attempt to remove the Text itself thus removing it from all known Press catalogs.

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

  • Method Details

    • getPressId

      Id getPressId()
      Gets the Press Id associated with this session.
      Returns:
      the Press Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getPress

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

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

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

      TextForm getTextFormForCreate(Type[] textRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the text form for creating new texts. A new form should be requested for each create transidiom.
      Parameters:
      textRecordTypes - array of text record types
      Returns:
      the text form
      Throws:
      NullArgumentException - textRecordTypes 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.
    • createText

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

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

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

      void updateText(TextForm textForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing text.
      Parameters:
      textForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - textForm already used in an update transatcion
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - textForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - textForm did not originate from getTextFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteTexts

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

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

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

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