Interface CategoryBatchAdminSession
- All Superinterfaces:
AutoCloseable, CategoryAdminSession, Closeable, OsidSession, OsidSession
This session creates, updates, and deletes Categories in bulk.
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
getCategoryFormsForCreate() specifying the desired record Types
or none if no record Types are needed. Each of the returned
CategoryForms 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 a 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.
The CategoryForms returned from
getCategoryFormsForCreate() may be linked to the originating request
through the peer Ids of the CategoryForm . In the case
where there may be duplicates, any CategoryForm of the same peer
Ids may be used for a create operation.
Once a batch of CategoryForms are submitted for create, a
CreateResponse is returned for each CategoryForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createCategories() ,
errors specific to an individual CategoryForm are indicated in the
corresponding CreateResponse . CreateResponses may be
linked to the originating CategoryForm through the
CategoryForm Id .
For updates, CategoryForms are requested to the
Category Id that is to be updated using
getCategoryFormsForUpdate() where the reference Id in the
CategoryForm may be used to link the request. 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.
Once a batch of CategoryForms are submitted for update, an
UpdateResponse is returned for each CategoryForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateCategories() ,
errors specific to an individual CategoryForm are indicated in the
corresponding UpdateResponse . UpdateResponses may be
linked to the originating CategoryForm through the
CategoryForm Id .
The delete operations delete Categories in bulk. 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. Bulk delete operations return the results
in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasCategories(AliasRequestList aliasRequests) Adds anIdto aCategoryfor the purpose of creating compatibility.createCategories(CategoryBatchFormList categoryForms) Creates a new set ofCategories.Deletes allCategoriesin thisBusiness.deleteCategories(IdList categoryIds) Deletes categories for the givenIds.getCategoryFormsForCreate(long number, Type[] categoryRecordTypes) Gets the categoryforms for creating a bunch of new categories.getCategoryFormsForUpdate(IdList categoryIds) Gets the category forms for updating an existing set of categories.updateCategories(CategoryBatchFormList categoryForms) Updates existing categories.Methods inherited from interface CategoryAdminSession
aliasCategory, canCreateCategories, canCreateCategoryWithRecordTypes, canDeleteCategories, canManageCategoryAliases, canUpdateCategories, createCategory, deleteCategory, getBusiness, getBusinessId, getCategoryFormForCreate, getCategoryFormForUpdate, updateCategoryModifier 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
-
getCategoryFormsForCreate
CategoryBatchFormList getCategoryFormsForCreate(long number, Type[] categoryRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the categoryforms for creating a bunch of new categories.- Parameters:
number- the number of forms to retrievecategoryRecordTypes- array of category record types to be included in each create operation or an empty list if none- Returns:
- the category forms
- Throws:
NullArgumentException-categoryRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createCategories
CreateResponseList createCategories(CategoryBatchFormList categoryForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofCategories. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
categoryForms- the category forms- Returns:
- the create responses
- Throws:
NullArgumentException-categoryFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getCategoryFormsForUpdate
CategoryBatchFormList getCategoryFormsForUpdate(IdList categoryIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the category forms for updating an existing set of categories. A new categoryform should be requested for each update transaction.- Parameters:
categoryIds- theIdsof theCategory- Returns:
- the category form
- Throws:
NotFoundException- acategoryIdis not foundNullArgumentException-categoryIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateCategories
UpdateResponseList updateCategories(CategoryBatchFormList categoryForms) throws OperationFailedException, PermissionDeniedException Updates existing categories. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
categoryForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-categoryFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllCategories
Deletes allCategoriesin thisBusiness.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteCategories
DeleteResponseList deleteCategories(IdList categoryIds) throws OperationFailedException, PermissionDeniedException Deletes categories for the givenIds.- Parameters:
categoryIds- theIdsof the categories to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-categoryIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasCategories
AliasResponseList aliasCategories(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aCategoryfor the purpose of creating compatibility. The primaryIdof theCategoryis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another category, it is reassigned to the given categoryId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-