Interface CanonicalUnitAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
CanonicalUnitBatchAdminSession
This session creates, updates, and deletes CanonicalUnits . 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
CanonicalUnit , a CanonicalUnitForm is requested using
getCanonicalUnitFormForCreate() specifying the desired record
Types or none if no record Types are needed. The returned
CanonicalUnitForm 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 CanonicalUnitForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each CanonicalUnitForm
corresponds to an attempted transaction.
For updates, CanonicalUnitForms are requested to the
CanonicalUnit Id that is to be updated using
getCanonicalUnitFormForUpdate() . Similarly, the
CanonicalUnitForm has metadata about the data that can be updated and it
can perform validation before submitting the update. The
CanonicalUnitForm can only be used once for a successful update and
cannot be reused.
The delete operations delete CanonicalUnits . To unmap a
CanonicalUnit from the current Catalogue , the
CanonicalUnitCatalogueAssignmentSession should be used. These delete
operations attempt to remove the CanonicalUnit itself thus
removing it from all known Catalogue catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasCanonicalUnit(Id canonicalUnitId, Id aliasId) Adds anIdto aCanonicalUnitfor the purpose of creating compatibility.booleanTests if this user can create canonical units.booleancanCreateCanonicalUnitWithRecordTypes(Type[] canonicalUnitRecordTypes) Tests if this user can create a singleCanonicalUnitusing the desired record types.booleanTests if this user can delete canonical units.booleanTests if this user can manageIdaliases forCanonicalUnits.booleanTests if this user can update canonical units.createCanonicalUnit(CanonicalUnitForm canonicalUnitForm) Creates a newCanonicalUnit.voiddeleteCanonicalUnit(Id canonicalUnitId) Deletes aCanonicalUnit.getCanonicalUnitFormForCreate(Type[] canonicalUnitRecordTypes) Gets the canonical unit form for creating new canonical units.getCanonicalUnitFormForUpdate(Id canonicalUnitId) Gets the canonical unit form for updating an existing canonical unit.Gets theCatalogueassociated with this session.Gets theCatalogueIdassociated with this session.voidupdateCanonicalUnit(CanonicalUnitForm canonicalUnitForm) Updates an existing canonical unit.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
-
getCatalogueId
Id getCatalogueId()Gets theCatalogueIdassociated with this session.- Returns:
- the
Catalogue Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getCatalogue
Gets theCatalogueassociated with this session.- Returns:
- the catalogue
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateCanonicalUnits
boolean canCreateCanonicalUnits()Tests if this user can create canonical units. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aCanonicalUnitwill 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:
falseifCanonicalUnitcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateCanonicalUnitWithRecordTypes
Tests if this user can create a singleCanonicalUnitusing the desired record types. WhileOfferingManager.getCanonicalUnitRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificCanonicalUnit. Providing an empty array tests if aCanonicalUnitcan be created with no records.- Parameters:
canonicalUnitRecordTypes- array of canonical unit record types- Returns:
trueifCanonicalUnitcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-canonicalUnitRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getCanonicalUnitFormForCreate
CanonicalUnitForm getCanonicalUnitFormForCreate(Type[] canonicalUnitRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the canonical unit form for creating new canonical units. A new form should be requested for each create transaction.- Parameters:
canonicalUnitRecordTypes- array of canonical unit record types to be included in the create operation or an empty list if none- Returns:
- the canonical unit form
- Throws:
NullArgumentException-canonicalUnitRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- cannot get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createCanonicalUnit
CanonicalUnit createCanonicalUnit(CanonicalUnitForm canonicalUnitForm) throws OperationFailedException, PermissionDeniedException Creates a newCanonicalUnit.- Parameters:
canonicalUnitForm- the form for thisCanonicalUnit- Returns:
- the new
CanonicalUnit - Throws:
IllegalStateException-canonicalUnitFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-canonicalUnitFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-canonicalUnitFormdid not originate fromgetCanonicalUnitFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateCanonicalUnits
boolean canUpdateCanonicalUnits()Tests if this user can update canonical units. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aCanonicalUnitwill 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:
falseifCanonicalUnitmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getCanonicalUnitFormForUpdate
CanonicalUnitForm getCanonicalUnitFormForUpdate(Id canonicalUnitId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the canonical unit form for updating an existing canonical unit. A new canonical unit form should be requested for each update transaction.- Parameters:
canonicalUnitId- theIdof theCanonicalUnit- Returns:
- the canonical unit form
- Throws:
NotFoundException-canonicalUnitIdis not foundNullArgumentException-canonicalUnitIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCanonicalUnit
void updateCanonicalUnit(CanonicalUnitForm canonicalUnitForm) throws OperationFailedException, PermissionDeniedException Updates an existing canonical unit.- Parameters:
canonicalUnitForm- the form containing the elements to be updated- Throws:
IllegalStateException-canonicalUnitFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-canonicalUnitFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-canonicalUnitFormdid not originate fromgetCanonicalUnitFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteCanonicalUnits
boolean canDeleteCanonicalUnits()Tests if this user can delete canonical units. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anCanonicalUnitwill 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:
falseifCanonicalUnitdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteCanonicalUnit
void deleteCanonicalUnit(Id canonicalUnitId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aCanonicalUnit.- Parameters:
canonicalUnitId- theIdof theCanonicalUnitto remove- Throws:
NotFoundException-canonicalUnitIdnot foundNullArgumentException-canonicalUnitIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageCanonicalUnitAliases
boolean canManageCanonicalUnitAliases()Tests if this user can manageIdaliases forCanonicalUnits. 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:
falseifCanonicalUnitaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasCanonicalUnit
void aliasCanonicalUnit(Id canonicalUnitId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aCanonicalUnitfor the purpose of creating compatibility. The primaryIdof theCanonicalUnitis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another canonical unit, it is reassigned to the given canonical unitId.- Parameters:
canonicalUnitId- theIdof aCanonicalUnitaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-canonicalUnitIdnot foundNullArgumentException-canonicalUnitIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-