Interface CompositionAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
CompositionBatchAdminSession
This session creates, updates, and deletes Compositions . 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
Composition , a CompositionForm is requested using
getCompositionFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
CompositionForm 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 CompositionForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each CompositionForm corresponds
to an attempted transaction.
For updates, CompositionForms are requested to the
Composition Id that is to be updated using
getCompositionFormForUpdate() . Similarly, the CompositionForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The CompositionForm can
only be used once for a successful update and cannot be reused.
The delete operations delete Compositions . To unmap a
Composition from the current Repository , the
CompositionRepositoryAssignmentSession should be used. These delete
operations attempt to remove the Bid itself thus removing it from
all known Repository catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCompositionChild(Id compositionId, Id childCompositionId) Adds a composition to a parent composition.voidaliasComposition(Id compositionId, Id aliasId) Adds anIdto aCompositionfor the purpose of creating compatibility.booleanTests if this user can createCompositions.booleancanCreateCompositionWithRecordTypes(Type[] compositionRecordTypes) Tests if this user can create a singleCompositionusing the desired record types.booleanTests if this user can deleteCompositions.booleanTests if this user can manageIdaliases forCompositions.booleanTests if this user can updateCompositions.createComposition(CompositionForm compositionForm) Creates a newComposition.voiddeleteComposition(Id compositionId) Deletes aComposition.voiddeleteCompositionNode(Id compositionId) Deletes aCompositionand all contained children.getCompositionFormForCreate(Type[] compositionRecordTypes) Gets the composition form for creating new compositions.getCompositionFormForUpdate(Id compositionId) Gets the composition form for updating an existing composition.Gets theRepositoryassociated with this session.Gets theRepositoryIdassociated with this session.voidremoveCompositionChild(Id compositionId, Id childCompositionId) Removes a composition from a parent composition.voidupdateComposition(CompositionForm compositionForm) Updates an existing composition.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getRepositoryId
Id getRepositoryId()Gets theRepositoryIdassociated with this session.- Returns:
- the
Repository Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getRepository
Gets theRepositoryassociated with this session.- Returns:
- the
Repositoryassociated with this session - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateCompositions
boolean canCreateCompositions()Tests if this user can createCompositions. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aCompositionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifCompositioncreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateCompositionWithRecordTypes
Tests if this user can create a singleCompositionusing the desired record types. WhileRepositoryManager.getCompositionRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificComposition. Providing an empty array tests if aCompositioncan be created with no records.- Parameters:
compositionRecordTypes- array of composition record types- Returns:
trueifCompositioncreation using the specifiedTypesis supported,falseotherwise- Throws:
NullArgumentException-compositionRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getCompositionFormForCreate
CompositionForm getCompositionFormForCreate(Type[] compositionRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the composition form for creating new compositions. A new form should be requested for each create transaction.- Parameters:
compositionRecordTypes- array of composition record types- Returns:
- the composition form
- Throws:
NullArgumentException-compositionRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createComposition
Composition createComposition(CompositionForm compositionForm) throws OperationFailedException, PermissionDeniedException Creates a newComposition.- Parameters:
compositionForm- the form for thisComposition- Returns:
- the new
Composition - Throws:
IllegalStateException-compositionFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-compositionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-compositionFormdid not originate fromgetCompositionFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateCompositions
boolean canUpdateCompositions()Tests if this user can updateCompositions. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aCompositionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifCompositionmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getCompositionFormForUpdate
CompositionForm getCompositionFormForUpdate(Id compositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the composition form for updating an existing composition. A new composition form should be requested for each update transaction.- Parameters:
compositionId- theIdof theComposition- Returns:
- the composition form
- Throws:
NotFoundException-compositionIdis not foundNullArgumentException-compositionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateComposition
void updateComposition(CompositionForm compositionForm) throws OperationFailedException, PermissionDeniedException Updates an existing composition.- Parameters:
compositionForm- the form containing the elements to be updated- Throws:
IllegalStateException-compositionFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-compositionFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-compositionFormdid not originate fromgetCompositionFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteCompositions
boolean canDeleteCompositions()Tests if this user can deleteCompositions. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aCompositionwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifCompositiondeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteComposition
void deleteComposition(Id compositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aComposition.- Parameters:
compositionId- theIdof theCompositionto remove- Throws:
NotFoundException-compositionIdnot foundNullArgumentException-compositionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCompositionNode
void deleteCompositionNode(Id compositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aCompositionand all contained children.- Parameters:
compositionId- theIdof theCompositionto remove- Throws:
NotFoundException-compositionIdnot foundNullArgumentException-compositionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
addCompositionChild
void addCompositionChild(Id compositionId, Id childCompositionId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds a composition to a parent composition.- Parameters:
compositionId- theIdof a parentCompositionchildCompositionId- theIdof a childComposition- Throws:
AlreadyExistsException-childCompositionIdis already a child ofcompositionIdNotFoundException-compositionIdorchildCompositionIdis not foundNullArgumentException-compositionIdorchildCompositionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
removeCompositionChild
void removeCompositionChild(Id compositionId, Id childCompositionId) throws NotFoundException, OperationFailedException, PermissionDeniedException Removes a composition from a parent composition.- Parameters:
compositionId- theIdof a parentCompositionchildCompositionId- theIdof a childComposition- Throws:
NotFoundException-compositionIdorchildCompositionIdis not found or not relatedNullArgumentException-compositionIdorchildCompositionIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageCompositionAliases
boolean canManageCompositionAliases()Tests if this user can manageIdaliases forCompositions. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifCompositionaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasComposition
void aliasComposition(Id compositionId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aCompositionfor the purpose of creating compatibility. The primaryIdof theCompositionis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another composition, it is reassigned to the given compositionId.- Parameters:
compositionId- theIdof aCompositionaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-compositionIdnot foundNullArgumentException-compositionIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-