public interface ProductAdminSession extends OsidSession
This session creates, updates, and deletes Products. 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
Product, a ProductForm is requested using
getProductFormForCreate() specifying the desired record
Types or none if no record Types are needed. The
returned ProductForm 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 ProductForm is submiited
to a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each ProductForm
corresponds to an attempted transaction.
For updates, ProductForms are requested to the
Product Id that is to be updated using
getProductFormForUpdate(). Similarly, the ProductForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The ProductForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Products. To unmap a
Product from the current Store, the
ProductStoreAssignmentSession should be used. These delete
operations attempt to remove the Product itself thus
removing it from all known Store catalogs.
This session includes an Id aliasing mechanism to
assign an external Id to an internally assigned Id.
| Modifier and Type | Method and Description |
|---|---|
void |
aliasProduct(Id productId,
Id aliasId)
Adds an
Id to a Product for the purpose
of creating compatibility. |
boolean |
canCreateProducts()
Tests if this user can create
Products. |
boolean |
canCreateProductWithRecordTypes(Type[] productRecordTypes)
Tests if this user can create a single
Product using
the desired record types. |
boolean |
canDeleteProducts()
Tests if this user can delete
Products A return of true
does not guarantee successful authorization. |
boolean |
canManageProductAliases()
Tests if this user can manage
Id aliases for
Products. |
boolean |
canUpdateProducts()
Tests if this user can update
Products. |
Product |
createProduct(ProductForm productForm)
Creates a new
Product. |
void |
deleteProduct(Id productId)
Deletes a
Product. |
ProductForm |
getProductFormForCreate(Type[] productRecordTypes)
Gets the product form for creating new products.
|
ProductForm |
getProductFormForUpdate(Id productId)
Gets the product form for updating an existing product.
|
Store |
getStore()
Gets the
Store associated with this session. |
Id |
getStoreId()
Gets the
Store Id associated with this
session. |
void |
updateProduct(ProductForm productForm)
Updates an existing product.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getStoreId()
Store Id associated with this
session. Store Id associated with this sessionmandatory - This method must be implemented. Store getStore() throws OperationFailedException, PermissionDeniedException
Store associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreateProducts()
Products. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Product will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may not wish to offer create operations to
unauthorized users. false if Product creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreateProductWithRecordTypes(Type[] productRecordTypes)
Product using
the desired record types. While
OrderingManager.getProductRecordTypes() can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Product. Providing an
empty array tests if a Product can be created with no
records.productRecordTypes - array of product record types true if Product creation using
the specified record Types is supported,
false otherwiseNullArgumentException - productRecordTypes
is null mandatory - This method must be implemented. ProductForm getProductFormForCreate(Type[] productRecordTypes) throws OperationFailedException, PermissionDeniedException
productRecordTypes - array of product record typesNullArgumentException - productRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Product createProduct(ProductForm productForm) throws OperationFailedException, PermissionDeniedException
Product. productForm - the form for this Product Product IllegalStateException - productForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - productForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - productForm did
not originate from getProductFormForCreate() mandatory - This method must be implemented. boolean canUpdateProducts()
Products. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Product will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may not wish to offer update operations to
unauthorized users. false if Product modification is
not authorized, true otherwisemandatory - This method must be implemented. ProductForm getProductFormForUpdate(Id productId)
productId - the Id of the Product NullArgumentException - productId is
null mandatory - This method must be implemented. void updateProduct(ProductForm productForm) throws OperationFailedException, PermissionDeniedException
productForm - the form containing the elements to be updatedIllegalStateException - productForm
already used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - productForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - productForm did
not originate from getProductFormForUpdate() mandatory - This method must be implemented. boolean canDeleteProducts()
Products A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Product will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may not wish to offer delete operations to
unauthorized users. false if Product deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deleteProduct(Id productId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Product. productId - the Id of the Product
to removeNotFoundException - productId not foundNullArgumentException - productId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageProductAliases()
Id aliases for
Products. A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED. This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false if Product aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasProduct(Id productId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to a Product for the purpose
of creating compatibility. The primary Id of the
Product is determined by the provider. The new Id
performs as an alias to the primary Id. If the
alias is a pointer to another product, it is reassigned to the given
product Id. productId - the Id of a Product aliasId - the alias Id AlreadyExistsException - aliasId is
already assignedNotFoundException - productId not foundNullArgumentException - productId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.