Interface PostAdminSession

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

public interface PostAdminSession extends OsidSession

This session creates, updates, and deletes Posts . The data for create and update is provided by the consumer via the form. OsidForms are requested for each create or update and may not be reused.

Create and update operations differ in their usage. To create a Post , a PostForm is requested using getPostFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned PostForm 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 PostForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each PostForm corresponds to an attempted transaction.

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

The delete operations delete Posts . To unmap a Post from the current Business , the PostBusinessAssignmentSession should be used. These delete operations attempt to remove the Post itself thus removing it from all known Business catalogs.

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

  • Method Details

    • getBusinessId

      Id getBusinessId()
      Gets the Business Id associated with this session.
      Returns:
      the Business Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getBusiness

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

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

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

      PostForm getPostFormForCreate(Type[] postRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the payer form for creating new posts. A new form should be requested for each create transaction.
      Parameters:
      postRecordTypes - array of post record types
      Returns:
      the post form
      Throws:
      NullArgumentException - postRecordTypes 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.
    • createPost

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

      Submits a Post effective now or at the posting date.
      Parameters:
      postId - the post Id
      Throws:
      IllegalStateException - postId already posted
      NullArgumentException - payerId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canUpdatePosts

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

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

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

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

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

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

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