Interface ModelBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, ModelAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Models 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
Model , a ModelForm is requested using
getModelFormsForCreate() specifying the desired stock, resource, record
Types or none if no record Types are needed. Each of the
returned ModelForms 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 ModelForm is submiited to a create operation,
it cannot be reused with another create operation unless the first
operation was unsuccessful. Each ModelForm corresponds to an
attempted transaction.
The ModelForms returned from getModelFormsForCreate()
may be linked to the originating request through the peer Ids of
the ModelForm . In the case where there may be duplicates, any
ModelForm of the same peer Ids may be used for a create
operation.
Once a batch of ModelForms are submitted for create, a
CreateResponse is returned for each ModelForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createModels() , errors specific to an
individual ModelForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
ModelForm through the ModelForm Id .
For updates, ModelForms are requested to the Model
Id that is to be updated using getModelFormsForUpdate()
where the reference Id in the ModelForm may be used to
link the request. Similarly, the ModelForm has metadata about the
data that can be updated and it can perform validation before submitting
the update. The ModelForm can only be used once for a successful
update and cannot be reused.
Once a batch of ModelForms are submitted for update, an
UpdateResponse is returned for each ModelForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateModels() , errors specific to an
individual ModelForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
ModelForm through the ModelForm Id .
The delete operations delete Models in bulk. To unmap a
Model from the current Inventory , the
ModelInventoryAssignmentSession should be used. These delete operations
attempt to remove the Model itself thus removing it from all known
Inventory catalogs. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasModels(AliasRequestList aliasRequests) Adds anIdto aModelfor the purpose of creating compatibility.createModels(ModelBatchFormList modelForms) Creates a new set ofModels.Deletes allModelsin thisInventory.Deletes models expired before the given date.deleteModels(IdList modelIds) Deletes models for the givenIds.deleteModelsForResource(Id resourceId) Deletes models for the given resource.deleteModelsForStock(Id stockId) Deletes models for the given stock.getModelFormsForCreate(long number, Type[] modelRecordTypes) Gets the model forms for creating a bunch of new models.getModelFormsForUpdate(IdList modelIds) Gets the model forms for updating an existing set of models.updateModels(ModelBatchFormList modelForms) Updates existing models.Methods inherited from interface ModelAdminSession
aliasModel, canCreateModels, canCreateModelWithRecordTypes, canDeleteModels, canManageModelAliases, canUpdateModels, createModel, deleteModel, getModelFormForCreate, getModelFormForUpdate, getWarehouse, getWarehouseId, updateModelModifier and TypeMethodDescriptionvoidaliasModel(Id modelId, Id aliasId) Adds anIdto aModelfor the purpose of creating compatibility.booleanTests if this user can createModels.booleancanCreateModelWithRecordTypes(Type[] modelRecordTypes) Tests if this user can create a singleModelusing the desired record types.booleanTests if this user can deleteModels.booleanTests if this user can manageIdaliases forModels.booleanTests if this user can updateModels.createModel(ModelForm modelForm) Creates a newModel.voiddeleteModel(Id modelId) Deletes aModel.getModelFormForCreate(Type[] modelRecordTypes) Gets the model form for creating new models.getModelFormForUpdate(Id modelId) Gets the model form for updating an existing model.Gets theWarehouseassociated with this session.Gets theWarehouseIdassociated with this session.voidupdateModel(ModelForm modelForm) Updates an existing model.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
-
getModelFormsForCreate
ModelBatchFormList getModelFormsForCreate(long number, Type[] modelRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the model forms for creating a bunch of new models.- Parameters:
number- the number of forms to retrievemodelRecordTypes- array of model record types to be included in each create operation or an empty list if none- Returns:
- the model forms
- Throws:
NullArgumentException-modelRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createModels
CreateResponseList createModels(ModelBatchFormList modelForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofModels. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
modelForms- the model forms- Returns:
- the create responses
- Throws:
NullArgumentException-modelFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getModelFormsForUpdate
ModelBatchFormList getModelFormsForUpdate(IdList modelIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the model forms for updating an existing set of models. A new model form should be requested for each update transaction.- Parameters:
modelIds- theIdsof theModel- Returns:
- the model form
- Throws:
NotFoundException- amodelIdis not foundNullArgumentException-modelIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateModels
UpdateResponseList updateModels(ModelBatchFormList modelForms) throws OperationFailedException, PermissionDeniedException Updates existing models. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
modelForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-modelFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllModels
Deletes allModelsin thisInventory.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteModels
DeleteResponseList deleteModels(IdList modelIds) throws OperationFailedException, PermissionDeniedException Deletes models for the givenIds.- Parameters:
modelIds- theIdsof the models to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-modelIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteModelsForResource
DeleteResponseList deleteModelsForResource(Id resourceId) throws OperationFailedException, PermissionDeniedException Deletes models for the given resource.- Parameters:
resourceId- anIdof a resource- Returns:
- the delete responses
- Throws:
NullArgumentException-resourceIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteModelsForStock
DeleteResponseList deleteModelsForStock(Id stockId) throws OperationFailedException, PermissionDeniedException Deletes models for the given stock.- Parameters:
stockId- anIdof a stock- Returns:
- the delete responses
- Throws:
NullArgumentException-stockIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteIneffectiveModelsByDate
DeleteResponseList deleteIneffectiveModelsByDate(DateTime date) throws OperationFailedException, PermissionDeniedException Deletes models 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.
-
aliasModels
AliasResponseList aliasModels(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aModelfor the purpose of creating compatibility. The primaryIdof theModelis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another model, it is reassigned to the given modelId.- 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.
-