Interface ProjectBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, ProjectAdminSession
This session creates, updates, and deletes Projects 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
Project , a ProjectForm is requested using
getProjectFormsForCreate() specifying the building and desired record
Types or none if no record Types are needed. Each of the
returned ProjectForms 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 ProjectForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each ProjectForm corresponds to
an attempted transaction.
The ProjectForms returned from
getProjectFormsForCreate() may be linked to the originating request
through the peer Ids of the ProjectForm . In the case
where there may be duplicates, any ProjectForm of the same peer
Ids may be used for a create operation.
Once a batch of ProjectForms are submitted for create, a
CreateResponse is returned for each ProjectForm , although
the ordering is not defined. Only errors that pertain to the entire create
operation are returned from createProjects() , errors specific to
an individual ProjectForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the
originating ProjectForm through the ProjectForm Id
.
For updates, ProjectForms are requested to the Project
Id that is to be updated using getProjectFormsForUpdate()
where the reference Id in the ProjectForm may be used to
link the request. Similarly, the ProjectForm has metadata about
the data that can be updated and it can perform validation before
submitting the update. The ProjectForm can only be used once for a
successful update and cannot be reused.
Once a batch of ProjectForms are submitted for update, an
UpdateResponse is returned for each ProjectForm , although
the ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateProjects() , errors specific to
an individual ProjectForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the
originating ProjectForm through the ProjectForm Id
.
The delete operations delete Projects in bulk. To unmap a
Project from the current Campus , the
ProjectCampusAssignmentSession should be used. These delete operations
attempt to remove the Project itself thus removing it from all
known Campus catalogs. Bulk delete operations return the results
in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasProjects(AliasRequestList aliasRequests) Adds anIdto aProjectfor the purpose of creating compatibility.createProjects(ProjectBatchFormList projectForms) Creates a new set ofProjects.Deletes allProjectsin thisCampus.Deletes projects expired before the given date.deleteProjects(IdList projectIds) Deletes projects for the givenIds.deleteProjectsForBuilding(Id buildingId) Deletes all projects for a building.getProjectFormsForCreate(IdList buildingIds, Type[] projectRecordTypes) Gets the project forms for creating a bunch of new projects.getProjectFormsForUpdate(IdList projectIds) Gets the project forms for updating an existing set of projects.updateProjects(ProjectBatchFormList projectForms) Updates existing projects.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 ProjectAdminSession
aliasProject, canCreateProjects, canCreateProjectWithRecordTypes, canDeleteProjects, canManageProjectAliases, canUpdateProjects, createProject, deleteProject, getCampus, getCampusId, getProjectFormForCreate, getProjectFormForUpdate, updateProjectModifier and TypeMethodDescriptionvoidaliasProject(Id projectId, Id aliasId) Adds anIdto aProjectfor the purpose of creating compatibility.booleanTests if this user can createProjects.booleancanCreateProjectWithRecordTypes(Type[] projectRecordTypes) Tests if this user can create a singleProjectusing the desired record types.booleanTests if this user can deleteProjectsA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forProjects.booleanTests if this user can updateProjects.createProject(ProjectForm projectForm) Creates a newProject.voiddeleteProject(Id projectId) Deletes aProject.Gets theCampusassociated with this session.Gets theCampusIdassociated with this session.getProjectFormForCreate(Id buildingId, Type[] projectRecordTypes) Gets the project form for creating new projects.getProjectFormForUpdate(Id projectId) Gets the project form for updating an existing project.voidupdateProject(ProjectForm projectForm) Updates an existing project.
-
Method Details
-
getProjectFormsForCreate
ProjectBatchFormList getProjectFormsForCreate(IdList buildingIds, Type[] projectRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the project forms for creating a bunch of new projects. A project form is returned for each supplied building.- Parameters:
buildingIds- a list of buildingIdsprojectRecordTypes- array of project record types to be included in each create operation or an empty list if none- Returns:
- the project forms
- Throws:
NotFoundException- abuildingIdis not foundNullArgumentException-buildingidorprojectRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createProjects
CreateResponseList createProjects(ProjectBatchFormList projectForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofProjects. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
projectForms- the project forms- Returns:
- the create responses
- Throws:
NullArgumentException-projectFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getProjectFormsForUpdate
ProjectBatchFormList getProjectFormsForUpdate(IdList projectIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the project forms for updating an existing set of projects. A new project form should be requested for each update transaction.- Parameters:
projectIds- theIdsof theProject- Returns:
- the project form
- Throws:
NotFoundException- aprojectIdis not foundNullArgumentException-projectIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateProjects
UpdateResponseList updateProjects(ProjectBatchFormList projectForms) throws OperationFailedException, PermissionDeniedException Updates existing projects. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
projectForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-projectFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllProjects
Deletes allProjectsin thisCampus.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteProjects
DeleteResponseList deleteProjects(IdList projectIds) throws OperationFailedException, PermissionDeniedException Deletes projects for the givenIds.- Parameters:
projectIds- theIdsof the projects to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-projectIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteProjectsForBuilding
DeleteResponseList deleteProjectsForBuilding(Id buildingId) throws OperationFailedException, PermissionDeniedException Deletes all projects for a building.- Parameters:
buildingId- a buildingId- Returns:
- the delete responses
- Throws:
NullArgumentException-buildingIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveProjectsByDate
DeleteResponseList deleteIneffectiveProjectsByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes projects expired before the given date.- Parameters:
date- a date- Returns:
- the delete responses
- Throws:
NullArgumentException-dateisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasProjects
AliasResponseList aliasProjects(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aProjectfor the purpose of creating compatibility. The primaryIdof theProjectis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another project, it is reassigned to the given entryId.- 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.
-