Interface FunctionAdminSession

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

public interface FunctionAdminSession extends OsidSession

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

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

The delete operations delete Functions . To unmap a Function from the current Vault , the FunctionVaultAssignmentSession should be used. These delete operations attempt to remove the Function itself thus removing it from all known Vault catalogs.

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

  • Method Details

    • getVaultId

      Id getVaultId()
      Gets the Vault Id associated with this session.
      Returns:
      the Vault Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getVault

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

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

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

      FunctionForm getFunctionFormForCreate(Type[] functionRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the function form for creating new functions. A new form should be requested for each create transaction.
      Parameters:
      functionRecordTypes - array of function record types
      Returns:
      the function form
      Throws:
      NullArgumentException - functionRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form qith requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createFunction

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

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

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

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

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

      void deleteFunction(Id functionId) throws NotFoundException, OperationFailedException, PermissionDeniedException
      Deletes the Function identified by the given Id .
      Parameters:
      functionId - the Id of the Function to delete
      Throws:
      NotFoundException - a Function was not found identified by the given Id
      NullArgumentException - functionId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageFunctionAliases

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

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