Interface StoreAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
StoreBatchAdminSession
This session creates, updates, and deletes Stores . 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
Store , a StoreForm is requested using
getStoreFormForCreate() specifying the desired record Types or
none if no record Types are needed. The returned StoreForm
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
StoreForm is submiited to a create operation, it cannot be reused
with another create operation unless the first operation was unsuccessful.
Each StoreForm corresponds to an attempted transaction.
For updates, StoreForms are requested to the Store
Id that is to be updated using getStoreFormForUpdate() .
Similarly, the StoreForm has metadata about the data that can be
updated and it can perform validation before submitting the update. The
StoreForm can only be used once for a successful update and cannot
be reused.
The delete operations delete Stores .
This session includes an Id aliasing mechanism to assign an
external Id to an internally assigned Id.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasStore(Id storeId, Id aliasId) Adds anIdto aStorefor the purpose of creating compatibility.booleanTests if this user can createStores.booleancanCreateStoreWithRecordTypes(Type[] storeRecordTypes) Tests if this user can create a singleStoreusing the desired record types.booleanTests if this user can deleteStoresA return of true does not guarantee successful authorization.booleanTests if this user can manageIdaliases forStores.booleanTests if this user can updateStores.createStore(StoreForm storeForm) Creates a newStore.voiddeleteStore(Id storeId) Deletes aStore.getStoreFormForCreate(Type[] storeRecordTypes) Gets the store form for creating new stores.getStoreFormForUpdate(Id storeId) Gets the store form for updating an existing store.voidupdateStore(StoreForm storeForm) Updates an existing store.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
-
canCreateStores
boolean canCreateStores()Tests if this user can createStores. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aStorewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifStorecreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateStoreWithRecordTypes
Tests if this user can create a singleStoreusing the desired record types. WhileOrderingManager.getStoreRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificStore. Providing an empty array tests if aStorecan be created with no records.- Parameters:
storeRecordTypes- array of store record types- Returns:
trueifStorecreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-storeRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getStoreFormForCreate
StoreForm getStoreFormForCreate(Type[] storeRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the store form for creating new stores. A new form should be requested for each create transaction.- Parameters:
storeRecordTypes- array of store record types- Returns:
- the store form
- Throws:
NullArgumentException-storeRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createStore
Creates a newStore.- Parameters:
storeForm- the form for thisStore- Returns:
- the new
Store - Throws:
IllegalStateException-storeFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-storeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-storeFormdid not originate fromgetStoreFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateStores
boolean canUpdateStores()Tests if this user can updateStores. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aStorewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifStoremodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getStoreFormForUpdate
StoreForm getStoreFormForUpdate(Id storeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the store form for updating an existing store. A new store form should be requested for each update transaction.- Parameters:
storeId- theIdof theStore- Returns:
- the store form
- Throws:
NotFoundException-storeIdis not foundNullArgumentException-storeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateStore
Updates an existing store.- Parameters:
storeForm- the form containing the elements to be updated- Throws:
IllegalStateException-storeFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-storeFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-storeFormdid not originate fromgetStoreFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteStores
boolean canDeleteStores()Tests if this user can deleteStoresA return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aStorewill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifStoredeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteStore
void deleteStore(Id storeId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aStore.- Parameters:
storeId- theIdof theStoreto remove- Throws:
NotFoundException-storeIdnot foundNullArgumentException-storeIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageStoreAliases
boolean canManageStoreAliases()Tests if this user can manageIdaliases forStores. 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:
falseifStorealiasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasStore
void aliasStore(Id storeId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aStorefor the purpose of creating compatibility. The primaryIdof theStoreis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another store, it is reassigned to the given storeId.- Parameters:
storeId- theIdof aStorealiasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-storeIdnot foundNullArgumentException-storeIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-