public interface CategoryAdminSession extends OsidSession
This session creates, updates, and deletes Categories.
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
Category, a CategoryForm is requested using
getCategoryFormForCreate() specifying the desired record
Types or none if no record Types are needed. The
returned CategoryForm 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 CategoryForm is submiited
to a create operation, it cannot be reused with another create operation
unless the first operation was unsuccessful. Each CategoryForm
corresponds to an attempted transaction.
For updates, CategoryForms are requested to the
Category Id that is to be updated using
getCategoryFormForUpdate(). Similarly, the CategoryForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The CategoryForm
can only be used once for a successful update and cannot be reused.
The delete operations delete Categories. To unmap a
Category from the current Business, the
CategoryBusinessAssignmentSession should be used. These
delete operations attempt to remove the Category itself
thus removing it from all known Business 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 |
aliasCategory(Id categoryId,
Id aliasId)
Adds an
Id to a Category for the purpose
of creating compatibility. |
boolean |
canCreateCategories()
Tests if this user can create
Categories. |
boolean |
canCreateCategoryWithRecordTypes(Type[] categoryRecordTypes)
Tests if this user can create a single
Category using
the desired record types. |
boolean |
canDeleteCategories()
Tests if this user can delete
Categories. |
boolean |
canManageCategoryAliases()
Tests if this user can manage
Id aliases for
Categories. |
boolean |
canUpdateCategories()
Tests if this user can update
Categories. |
Category |
createCategory(CategoryForm categoryForm)
Creates a new
Category. |
void |
deleteCategory(Id categoryId)
Deletes a
Category. |
Business |
getBusiness()
Gets the
Business associated with this session. |
Id |
getBusinessId()
Gets the
Business Id associated with
this session. |
CategoryForm |
getCategoryFormForCreate(Type[] categoryRecordTypes)
Gets the category form for creating new categories.
|
CategoryForm |
getCategoryFormForUpdate(Id categoryId)
Gets the category form for updating an existing category.
|
void |
updateCategory(CategoryForm categoryForm)
Updates an existing category.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getBusinessId()
Business Id associated with
this session. Business Id associated with this sessionmandatory - This method must be implemented. Business getBusiness() throws OperationFailedException, PermissionDeniedException
Business associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreateCategories()
Categories. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known creating a Category will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may opt not to offer create operations to
an unauthorized user. false if Category creation is
not authorized, true otherwisemandatory - This method must be implemented. boolean canCreateCategoryWithRecordTypes(Type[] categoryRecordTypes)
Category using
the desired record types. While
BillingManager.getCategoryRecordTypes() can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Category. Providing an
empty array tests if a Category can be created with no
records.categoryRecordTypes - array of category record types true if Category creation using
the specified record Types is supported,
false otherwiseNullArgumentException - categoryRecordTypes
is null mandatory - This method must be implemented. CategoryForm getCategoryFormForCreate(Type[] categoryRecordTypes) throws OperationFailedException, PermissionDeniedException
categoryRecordTypes - array of category record typesNullArgumentException - categoryRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Category createCategory(CategoryForm categoryForm) throws OperationFailedException, PermissionDeniedException
Category. categoryForm - the form for this Category Category IllegalStateException - categoryForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - categoryForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - entryForm did not
originate from getCategoryFormForCreate() mandatory - This method must be implemented. boolean canUpdateCategories()
Categories. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known updating a Category will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may opt not to offer update operations to
an unauthorized user. false if Category modification
is not authorized, true otherwisemandatory - This method must be implemented. CategoryForm getCategoryFormForUpdate(Id categoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
categoryId - the Id of the Category
NotFoundException - categoryId is not
foundNullArgumentException - categoryId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updateCategory(CategoryForm categoryForm) throws OperationFailedException, PermissionDeniedException
categoryForm - the form containing the elements to be updatedIllegalStateException - categoryForm
already used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - categoryForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - entryForm did not
originate from getCategoryFormForUpdate() mandatory - This method must be implemented. boolean canDeleteCategories()
Categories. A return of
true does not guarantee successful authorization. A return of false
indicates that it is known deleting a Category will
result in a PERMISSION_DENIED. This is intended as a
hint to an application that may opt not to offer delete operations to
an unauthorized user. false if Category deletion is
not authorized, true otherwisemandatory - This method must be implemented. void deleteCategory(Id categoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Category. categoryId - the Id of the Category
to removeNotFoundException - categoryId not foundNullArgumentException - categoryId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageCategoryAliases()
Id aliases for
Categories. 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 Category aliasing is
not authorized, true otherwisemandatory - This method must be implemented. void aliasCategory(Id categoryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to a Category for the purpose
of creating compatibility. The primary Id of the
Customer is determined by the provider. The new Id
performs as an alias to the primary Id. If the
alias is a pointer to another category, it is reassigned to the given
category Id. categoryId - the Id of a Category aliasId - the alias Id AlreadyExistsException - aliasId is in
use as a primary Id NotFoundException - categoryId not foundNullArgumentException - categoryId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.