Interface ModelAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
ModelBatchAdminSession
This session creates, updates, and deletes Models . 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
getModelFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned ModelForm
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
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.
For updates, ModelForms are requested to the Model
Id that is to be updated using getModelFormForUpdate() .
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.
The delete operations delete Models . To unmap a Model
from the current Warehouse , the
ModelWarehouseAssignmentSession should be used. These delete operations
attempt to remove the Model itself thus removing it from all known
Warehouse catalogs.
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier 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
-
getWarehouseId
Id getWarehouseId()Gets theWarehouseIdassociated with this session.- Returns:
- the
Warehouse Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getWarehouse
Gets theWarehouseassociated with this session.- Returns:
- the warehouse
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateModels
boolean canCreateModels()Tests if this user can createModels. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aModelwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifModelcreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateModelWithRecordTypes
Tests if this user can create a singleModelusing the desired record types. WhileInventoryManager.getModelRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificModel. Providing an empty array tests if aModelcan be created with no records.- Parameters:
modelRecordTypes- array of model record types- Returns:
trueifModelcreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-modelRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getModelFormForCreate
ModelForm getModelFormForCreate(Type[] modelRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the model form for creating new models. A new form should be requested for each create transaction.- Parameters:
modelRecordTypes- array of model record types- Returns:
- the model form
- Throws:
NullArgumentException-modelRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createModel
Model createModel(ModelForm modelForm) throws NotFoundException, OperationFailedException, PermissionDeniedException Creates a newModel.- Parameters:
modelForm- the form for thisModel- Returns:
- the new
Model - Throws:
IllegalStateException-modelFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-courseId, termId, ormodelFormisnullNotFoundException-modelFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-modelFormdid not originate fromgetModelFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateModels
boolean canUpdateModels()Tests if this user can updateModels. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aModelwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifModelmodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getModelFormForUpdate
ModelForm getModelFormForUpdate(Id modelId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the model form for updating an existing model. A new model form should be requested for each update transaction.- Parameters:
modelId- theIdof theModel- Returns:
- the model form
- Throws:
NotFoundException-modelIdis not foundNullArgumentException-modelIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateModel
Updates an existing model.- Parameters:
modelForm- the form containing the elements to be updated- Throws:
IllegalStateException-modelFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-modelFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-modelFormdid not originate fromgetModelFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteModels
boolean canDeleteModels()Tests if this user can deleteModels. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aModelwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifModeldeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteModel
void deleteModel(Id modelId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aModel.- Parameters:
modelId- theIdof theModelto remove- Throws:
NotFoundException-modelIdnot foundNullArgumentException-modelIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageModelAliases
boolean canManageModelAliases()Tests if this user can manageIdaliases forModels. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifModelaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasModel
void aliasModel(Id modelId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aModelfor the purpose of creating compatibility. The primaryIdof theModelis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another model, it is reassigned to the given modelId.- Parameters:
modelId- theIdof aModelaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-modelIdnot foundNullArgumentException-modelIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-