Interface CreditAdminSession

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

public interface CreditAdminSession extends OsidSession

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

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

The delete operations delete Credits . To unmap a Credit from the current Billing , the CreditBillingAssignmentSession should be used. These delete operations attempt to remove the Credit itself thus removing it from all known Billing catalogs.

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

  • Method Details

    • getBillingId

      Id getBillingId()
      Gets the Billing Id associated with this session.
      Returns:
      the Billing Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getBilling

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

      boolean canCreateCredits()
      Tests if this user can create credits. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Credit will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
      Returns:
      false if Credit creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateCreditWithRecordTypes

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

      CreditForm getCreditFormForCreate(Id referenceId, Id resourceId, Type[] creditRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Gets the credit form for creating new credits. A new form should be requested for each create transaction.
      Parameters:
      referenceId - the reference Id
      resourceId - the resource Id
      creditRecordTypes - array of credit record types to be included in the create operation or an empty list if none
      Returns:
      the credit form
      Throws:
      NotFoundException - referenceId or resourceId is not found
      NullArgumentException - referenceId, resourceId or creditRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - cannot get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createCredit

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

      boolean canUpdateCredits()
      Tests if this user can update credits. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Credit will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
      Returns:
      false if Credit modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getCreditFormForUpdate

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

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

      boolean canDeleteCredits()
      Tests if this user can delete credits. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Credit will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
      Returns:
      false if Credit deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteCredit

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

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

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