Interface CategoryAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
CategoryBatchAdminSession
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.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaliasCategory(Id categoryId, Id aliasId) Adds anIdto aCategoryfor the purpose of creating compatibility.booleanTests if this user can createCategories.booleancanCreateCategoryWithRecordTypes(Type[] categoryRecordTypes) Tests if this user can create a singleCategoryusing the desired record types.booleanTests if this user can deleteCategories.booleanTests if this user can manageIdaliases forCategories.booleanTests if this user can updateCategories.createCategory(CategoryForm categoryForm) Creates a newCategory.voiddeleteCategory(Id categoryId) Deletes aCategory.Gets theBusinessassociated with this session.Gets theBusinessIdassociated with this session.getCategoryFormForCreate(Type[] categoryRecordTypes) Gets the category form for creating new categories.getCategoryFormForUpdate(Id categoryId) Gets the category form for updating an existing category.voidupdateCategory(CategoryForm categoryForm) Updates an existing category.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
-
getBusinessId
Id getBusinessId()Gets theBusinessIdassociated with this session.- Returns:
- the
Business Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getBusiness
Gets theBusinessassociated with this session.- Returns:
- the business
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateCategories
boolean canCreateCategories()Tests if this user can createCategories. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating aCategorywill 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:
falseifCategorycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateCategoryWithRecordTypes
Tests if this user can create a singleCategoryusing the desired record types. WhileBillingManager.getCategoryRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificCategory. Providing an empty array tests if aCategorycan be created with no records.- Parameters:
categoryRecordTypes- array of category record types- Returns:
trueifCategorycreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-categoryRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getCategoryFormForCreate
CategoryForm getCategoryFormForCreate(Type[] categoryRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the category form for creating new categories. A new form should be requested for each create transaction.- Parameters:
categoryRecordTypes- array of category record types- Returns:
- the category form
- Throws:
NullArgumentException-categoryRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createCategory
Category createCategory(CategoryForm categoryForm) throws OperationFailedException, PermissionDeniedException Creates a newCategory.- Parameters:
categoryForm- the form for thisCategory- Returns:
- the new
Category - Throws:
IllegalStateException-categoryFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-categoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-entryForm did not originate from getCategoryFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateCategories
boolean canUpdateCategories()Tests if this user can updateCategories. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating aCategorywill 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:
falseifCategorymodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getCategoryFormForUpdate
CategoryForm getCategoryFormForUpdate(Id categoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the category form for updating an existing category. A new category form should be requested for each update transaction.- Parameters:
categoryId- theIdof theCategory- Returns:
- the category form
- Throws:
NotFoundException-categoryIdis not foundNullArgumentException-categoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCategory
void updateCategory(CategoryForm categoryForm) throws OperationFailedException, PermissionDeniedException Updates an existing category.- Parameters:
categoryForm- the form containing the elements to be updated- Throws:
IllegalStateException-categoryFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-categoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-entryForm did not originate from getCategoryFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteCategories
boolean canDeleteCategories()Tests if this user can deleteCategories. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting aCategorywill 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:
falseifCategorydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteCategory
void deleteCategory(Id categoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes aCategory.- Parameters:
categoryId- theIdof theCategoryto remove- Throws:
NotFoundException-categoryIdnot foundNullArgumentException-categoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageCategoryAliases
boolean canManageCategoryAliases()Tests if this user can manageIdaliases forCategories. 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:
falseifCategoryaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasCategory
void aliasCategory(Id categoryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto aCategoryfor the purpose of creating compatibility. The primaryIdof theCustomeris determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another category, it is reassigned to the given categoryId.- Parameters:
categoryId- theIdof aCategoryaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-categoryIdnot foundNullArgumentException-categoryIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-