Interface WorkAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
WorkBatchAdminSession
This session creates, updates, and deletes Work . 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
Work . a WorkForm is requested using
getWorkFormForCreate() specifying the desired relationship peers and
record Types or none if no record Types are needed. The
returned WorkForm 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 WorkForm is submiited to a create operation,
it cannot be reused with another create operation unless the first
operation was unsuccessful. Each WorkForm corresponds to an
attempted transaction.
For updates, WorkForms are requested to the Work
Id that is to be updated using getWorkFormForUpdate() .
Similarly, the WorkForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
WorkForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Work . To unmap a Work
from the current Foundry , the
WorkFoundryAssignmentSession should be used. These delete operations
attempt to remove the Work itself thus removing it from all known
Foundry catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds anIdto aWorkfor the purpose of creating compatibility.booleanTests if this user can createWorks.booleancanCreateWorkWithRecordTypes(Type[] workRecordTypes) Tests if this user can create a singleWorkusing the desired record types.booleanTests if this user can deleteWorks.booleanTests if this user can manageIdaliases forWorks.booleanTests if this user can changeWorkstatus.booleanTests if this user can moveWorkamong jobs.booleanTests if this user can updateWorks.voidcompleteWork(Id workId) Marks work as complete.createWork(WorkForm workForm) Creates a newWork.voiddeleteWork(Id workId) Deletes aWork.Gets theFoundryassociated with this session.Gets theFoundryIdassociated with this session.getWorkFormForCreate(Id jobId, Type[] workRecordTypes) Gets the work form for creating new work.getWorkFormForUpdate(Id workId) Gets the work form for updating an existing work.voidMoves work to another job.voidreopenWork(Id workId) Marks work as incomplete.voidupdateWork(WorkForm workForm) Updates an existing work.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
-
getFoundryId
Id getFoundryId()Gets theFoundryIdassociated with this session.- Returns:
- the
Foundry Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getFoundry
Gets theFoundryassociated with this session.- Returns:
- the foundry
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateWorks
boolean canCreateWorks()Tests if this user can createWorks. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aWorkwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifWorkcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateWorkWithRecordTypes
Tests if this user can create a singleWorkusing the desired record types. WhileResourcingManager.getWorkRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificWork. Providing an empty array tests if aWorkcan be created with no records.- Parameters:
workRecordTypes- array of work record types- Returns:
trueifWorkcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-workRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getWorkFormForCreate
WorkForm getWorkFormForCreate(Id jobId, Type[] workRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the work form for creating new work. A new form should be requested for each create transaction.- Parameters:
jobId- a jobIdworkRecordTypes- array of work record types- Returns:
- the work form
- Throws:
NotFoundException-jobIdis not foundNullArgumentException-jobIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createWork
Creates a newWork.- Parameters:
workForm- the form for thisWork- Returns:
- the new
Work - Throws:
IllegalStateException-workFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-workFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-workFormdid not orginiate fromgetWorkFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateWorks
boolean canUpdateWorks()Tests if this user can updateWorks. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aWorkwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifWorkmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getWorkFormForUpdate
WorkForm getWorkFormForUpdate(Id workId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the work form for updating an existing work. A new work form should be requested for each update transaction.- Parameters:
workId- theIdof theWork- Returns:
- the work form
- Throws:
NotFoundException-workIdis not foundNullArgumentException-workIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateWork
Updates an existing work.- Parameters:
workForm- the form containing the elements to be updated- Throws:
IllegalStateException-workFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-workFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-workFormdid not orginiate fromgetWorkFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteWorks
boolean canDeleteWorks()Tests if this user can deleteWorks. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aWorkwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifWorkdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteWork
void deleteWork(Id workId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aWork.- Parameters:
workId- theIdof theWorkto remove- Throws:
NotFoundException-workIdnot foundNullArgumentException-workIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageWorkAliases
boolean canManageWorkAliases()Tests if this user can manageIdaliases forWorks. 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:
falseifWorkaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasWork
void aliasWork(Id workId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aWorkfor the purpose of creating compatibility. The primaryIdof theWorkis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another work, it is reassigned to the given workId.- Parameters:
workId- theIdof aWorkaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-workIdnot foundNullArgumentException-workIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canMoveWork
boolean canMoveWork()Tests if this user can moveWorkamong jobs. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aWorkwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer move operations to an unauthorized user.- Returns:
falseifWorkmoving is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
moveWork
void moveWork(Id workId, Id jobId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Moves work to another job.- Parameters:
workId- the workIdjobId- the new jobId- Throws:
AlreadyExistsException- work already part of jobNotFoundException-jobIdorworkIdis not foundNullArgumentException-jobIdorworkIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageWorkStatus
boolean canManageWorkStatus()Tests if this user can changeWorkstatus. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aWorkwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer status operations to an unauthorized user.- Returns:
falseifWorkstatus is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
completeWork
void completeWork(Id workId) throws NotFoundException, OperationFailedException, PermissionDeniedException Marks work as complete.- Parameters:
workId- the workId- Throws:
NotFoundException-workIdis not foundNullArgumentException-workIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
reopenWork
void reopenWork(Id workId) throws NotFoundException, OperationFailedException, PermissionDeniedException Marks work as incomplete.- Parameters:
workId- the workId- Throws:
NotFoundException-workIdis not foundNullArgumentException-workIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-