Interface WorkBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, WorkAdminSession
This session creates, updates, and deletes Works in bulk. 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
getWorkFormsForCreate() specifying the desired record Types or
none if no record Types are needed. Each of the returned
WorkForms 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 a
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.
The WorkForms returned from getWorkFormsForCreate()
may be linked to the originating request through the peer Ids of
the WorkForm . In the case where there may be duplicates, any
WorkForm of the same peer Ids may be used for a create
operation.
Once a batch of WorkForms are submitted for create, a
CreateResponse is returned for each WorkForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createWorks() , errors specific to an
individual WorkForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
WorkForm through the WorkForm Id .
For updates, WorkForms are requested to the Work
Id that is to be updated using getWorkFormsForUpdate()
where the reference Id in the WorkForm may be used to link
the request. 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.
Once a batch of WorkForms are submitted for update, an
UpdateResponse is returned for each WorkForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateWorks() , errors specific to an
individual WorkForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
WorkForm through the WorkForm Id .
The delete operations delete Works in bulk. 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. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasWorks(AliasRequestList aliasRequests) Adds anIdto aWorkfor the purpose of creating compatibility.createWorks(WorkBatchFormList workForms) Creates a new set ofWorks.Deletes allWorksin thisFoundry.deleteWorks(IdList workIds) Deletes works for the givenIds.getWorkFormsForCreate(long number, Type[] workRecordTypes) Gets the work forms for creating a bunch of new works.getWorkFormsForUpdate(IdList workIds) Gets the work forms for updating an existing set of works.updateWorks(WorkBatchFormList workForms) Updates existing works.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.Methods inherited from interface WorkAdminSession
aliasWork, canCreateWorks, canCreateWorkWithRecordTypes, canDeleteWorks, canManageWorkAliases, canManageWorkStatus, canMoveWork, canUpdateWorks, completeWork, createWork, deleteWork, getFoundry, getFoundryId, getWorkFormForCreate, getWorkFormForUpdate, moveWork, reopenWork, updateWorkModifier 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.
-
Method Details
-
getWorkFormsForCreate
WorkBatchFormList getWorkFormsForCreate(long number, Type[] workRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the work forms for creating a bunch of new works.- Parameters:
number- the number of forms to retrieveworkRecordTypes- array of work record types to be included in each create operation or an empty list if none- Returns:
- the work forms
- Throws:
NullArgumentException-workRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createWorks
CreateResponseList createWorks(WorkBatchFormList workForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofWorks. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
workForms- the work forms- Returns:
- the create responses
- Throws:
NullArgumentException-workFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getWorkFormsForUpdate
WorkBatchFormList getWorkFormsForUpdate(IdList workIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the work forms for updating an existing set of works. A new work form should be requested for each update transaction.- Parameters:
workIds- theIdsof theWork- Returns:
- the work form
- Throws:
NotFoundException- aworkIdis not foundNullArgumentException-workIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateWorks
UpdateResponseList updateWorks(WorkBatchFormList workForms) throws OperationFailedException, PermissionDeniedException Updates existing works. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
workForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-workFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllWorks
Deletes allWorksin thisFoundry.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteWorks
DeleteResponseList deleteWorks(IdList workIds) throws OperationFailedException, PermissionDeniedException Deletes works for the givenIds.- Parameters:
workIds- theIdsof the works to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-workIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasWorks
AliasResponseList aliasWorks(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aWorkfor the purpose of creating compatibility. The primaryIdof theWorkis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another work, it is reassigned to the given workId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-