public interface ModelBatchAdminSession extends ModelAdminSession
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.
Modifier and Type | Method and Description |
---|---|
AliasResponseList |
aliasModels(AliasRequestList aliasRequests)
Adds an
Id to a Model for the purpose of
creating compatibility. |
CreateResponseList |
createModels(ModelBatchFormList modelForms)
Creates a new set of
Models. |
DeleteResponseList |
deleteAllModels()
Deletes all
Models in this Inventory . |
DeleteResponseList |
deleteIneffectiveModelsByDate(DateTime date)
Deletes models expired before the given date.
|
DeleteResponseList |
deleteModels(IdList modelIds)
Deletes models for the given
Ids. |
DeleteResponseList |
deleteModelsForResource(Id resourceId)
Deletes models for the given resource.
|
DeleteResponseList |
deleteModelsForStock(Id stockId)
Deletes models for the given stock.
|
ModelBatchFormList |
getModelFormsForCreate(long number,
Type[] modelRecordTypes)
Gets the model forms for creating a bunch of new models.
|
ModelBatchFormList |
getModelFormsForUpdate(IdList modelIds)
Gets the model forms for updating an existing set of models.
|
UpdateResponseList |
updateModels(ModelBatchFormList modelForms)
Updates existing models.
|
aliasModel, canCreateModels, canCreateModelWithRecordTypes, canDeleteModels, canManageModelAliases, canUpdateModels, createModel, deleteModel, getModelFormForCreate, getModelFormForUpdate, getWarehouse, getWarehouseId, updateModel
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
ModelBatchFormList getModelFormsForCreate(long number, Type[] modelRecordTypes) throws OperationFailedException, PermissionDeniedException
number
- the number of forms to retrievemodelRecordTypes
- array of model record types to be included in
each create operation or an empty list if noneNullArgumentException
- modelRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to request forms with
given record typesmandatory
- This method must be implemented. CreateResponseList createModels(ModelBatchFormList modelForms) throws OperationFailedException, PermissionDeniedException
Models.
This method returns an
error if the entire operation fails. Otherwise, the status of an
individual create operation is indicated in the
BatchCreateResponse
.modelForms
- the model formsNullArgumentException
- modelForms
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. ModelBatchFormList getModelFormsForUpdate(IdList modelIds) throws NotFoundException, OperationFailedException, PermissionDeniedException
modelIds
- the Ids
of the Model
NotFoundException
- a modelId
is not
foundNullArgumentException
- modelIds
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. UpdateResponseList updateModels(ModelBatchFormList modelForms) throws OperationFailedException, PermissionDeniedException
BatchCreateResponse
.modelForms
- the form containing the elements to be updatedNullArgumentException
- modelForms
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. DeleteResponseList deleteAllModels() throws OperationFailedException, PermissionDeniedException
Models
in this Inventory
.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. DeleteResponseList deleteModels(IdList modelIds) throws OperationFailedException, PermissionDeniedException
Ids.
modelIds
- the Ids
of the models to deleteNullArgumentException
- modelIds
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. DeleteResponseList deleteModelsForResource(Id resourceId) throws OperationFailedException, PermissionDeniedException
resourceId
- an Id
of a resourceNullArgumentException
- resourceId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. DeleteResponseList deleteModelsForStock(Id stockId) throws OperationFailedException, PermissionDeniedException
stockId
- an Id
of a stockNullArgumentException
- stockId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. DeleteResponseList deleteIneffectiveModelsByDate(DateTime date) throws OperationFailedException, PermissionDeniedException
date
- a dateNullArgumentException
- date
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. AliasResponseList aliasModels(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException
Id
to a Model
for the purpose of
creating compatibility. The primary Id
of the
Model
is determined by the provider. The new Id
is an alias to the primary Id.
If the alias is a
pointer to another model, it is reassigned to the given model
Id.
aliasRequests
- the alias requestsNullArgumentException
- aliasRequests
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.