public interface JobAdminSession extends OsidSession
This session creates, updates, and deletes Jobs.
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
Job,
a JobForm
is requested using
getJobFormForCreate()
specifying the desired relationship peers
and record Types
or none if no record Types
are needed. The returned JobForm
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 JobForm
is
submiited to a create operation, it cannot be reused with another create
operation unless the first operation was unsuccessful. Each JobForm
corresponds to an attempted transaction.
For updates, JobForms
are requested to the Job
Id
that is to be updated using
getWJobFormForUpdate().
Similarly, the JobForm
has
metadata about the data that can be updated and it can perform validation
before submitting the update. The JobForm
can only be used
once for a successful update and cannot be reused.
The delete operations delete Jobs.
To unmap a
Job
from the current Foundry,
the
JobFormAssignmentSession
should be used. These delete operations
attempt to remove the Job
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.
Modifier and Type | Method and Description |
---|---|
void |
aliasJob(Id jobId,
Id aliasId)
Adds an
Id to a Job for the purpose of
creating compatibility. |
boolean |
canCreateJobs()
Tests if this user can create
Jobs. |
boolean |
canCreateJobWithRecordTypes(Type[] jobRecordTypes)
Tests if this user can create a single
Job using the
desired record types. |
boolean |
canDeleteJobs()
Tests if this user can delete
Jobs. |
boolean |
canManageJobAliases()
Tests if this user can manage
Id aliases for
Jobs. |
boolean |
canUpdateJobs()
Tests if this user can update
Jobs. |
Job |
createJob(JobForm jobForm)
Creates a new
Job. |
void |
deleteJob(Id jobId)
Deletes a
Job. |
Foundry |
getFoundry()
Gets the
Foundry associated with this session. |
Id |
getFoundryId()
Gets the
Foundry Id associated with this
session. |
JobForm |
getJobFormForCreate(Type[] jobRecordTypes)
Gets the job form for creating new jobs.
|
JobForm |
getJobFormForUpdate(Id jobId)
Gets the job form for updating an existing job.
|
void |
updateJob(JobForm jobForm)
Updates an existing job.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getFoundryId()
Foundry
Id
associated with this
session. Foundry Id
associated with this sessionmandatory
- This method must be implemented. Foundry getFoundry() throws OperationFailedException, PermissionDeniedException
Foundry
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateJobs()
Jobs.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Job
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. false
if Job
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateJobWithRecordTypes(Type[] jobRecordTypes)
Job
using the
desired record types. While
ResourcingManager.getJobRecordTypes()
can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Job.
Providing an
empty array tests if a Job
can be created with no
records.jobRecordTypes
- array of job record types true
if Job
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- jobRecordTypes
is null
mandatory
- This method must be implemented. JobForm getJobFormForCreate(Type[] jobRecordTypes) throws OperationFailedException, PermissionDeniedException
jobRecordTypes
- array of job record typesNullArgumentException
- jobRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form with
requested record typesmandatory
- This method must be implemented. Job createJob(JobForm jobForm) throws OperationFailedException, PermissionDeniedException
Job.
jobForm
- the form for this Job
Job
IllegalStateException
- jobForm
already
used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- jobForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- jobForm
did not
orginiate from getJobFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateJobs()
Jobs.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Job
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. false
if Job
modification is not
authorized, true
otherwisemandatory
- This method must be implemented. JobForm getJobFormForUpdate(Id jobId) throws NotFoundException, OperationFailedException, PermissionDeniedException
jobId
- the Id
of the Job
NotFoundException
- jobId
is not foundNullArgumentException
- jobId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateJob(JobForm jobForm) throws OperationFailedException, PermissionDeniedException
jobForm
- the form containing the elements to be updatedIllegalStateException
- jobForm
already
used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- jobId
or
jobForm
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- jobForm
did not
orginiate from getJobFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteJobs()
Jobs.
A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Job
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. false
if Job
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteJob(Id jobId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Job.
jobId
- the Id
of the Job
to
removeNotFoundException
- jobId
not foundNullArgumentException
- jobId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageJobAliases()
Id
aliases for
Jobs.
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. false
if Job
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasJob(Id jobId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to a Job
for the purpose of
creating compatibility. The primary Id
of the
Job
is determined by the provider. The new Id
performs as an alias to the primary Id.
If the alias is
a pointer to another job, it is reassigned to the given job Id.
jobId
- the Id
of a Job
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- jobId
not foundNullArgumentException
- jobId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.