Interface EntryAdminSession

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

public interface EntryAdminSession extends OsidSession

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

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

The delete operations delete EntryForms . To unmap an Entry from the current Business , the EntryBusinessAssignmentSession should be used. These delete operations attempt to remove the EntryForm 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.
    • canCreateEntries

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

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

      EntryForm getEntryFormForCreate(Id customerId, Id itemId, Id periodId, Type[] entryRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the entry form for creating new entries. A new form should be requested for each create transaction.
      Parameters:
      customerId - a customer Id
      itemId - an item Id
      periodId - a period Id
      entryRecordTypes - array of entry record types
      Returns:
      the entry form
      Throws:
      NotFoundException - itemId or periodId is not found
      NullArgumentException - itemId, periodId , or entryRecordTypes 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.
    • createEntry

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

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

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

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

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

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

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

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