Class DefaultCMSWorkflowFacade
java.lang.Object
de.hybris.platform.cmsfacades.workflow.impl.DefaultCMSWorkflowFacade
- All Implemented Interfaces:
CMSWorkflowFacade
Default implementation of the
CMSWorkflowFacade.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCommentToAction(WorkflowActionModel action, CMSWorkflowCommentModel comment) Adds a comment to an action.protected CMSWorkflowDatacancelWorkflow(WorkflowModel workflow) Cancels the workflow for the providedWorkflowModel.createAndStartWorkflow(CMSWorkflowData requestData) Creates and starts a workflow in the given catalog version with the workflow data provided.protected WorkflowItemAttachmentModelcreateAttachment(WorkflowModel workflow, CMSItemModel cmsItem) Creates a new attachment from a given cmsItem and adds it to the given workflow.protected CMSWorkflowCommentModelcreateComment(WorkflowDecisionModel decision, CommentTypeModel commentType, ComponentModel component, String subject, String text) Creates a comment and assigns a decision to it.protected voidcreateDecisionComments(WorkflowDecisionModel decision, String subject, String text) Creates a comment and adds it to incoming and non-automated outgoing actions.protected voidcreateVersion(CMSItemModel cmsItem, String versionLabel) This method creates a new version of the given cmsItem.protected voidcreateVersionsForItems(List<CMSItemModel> items, String versionLabel) Creates versions for a list of items.protected WorkflowModelcreateWorkflow(CMSWorkflowData requestData) This method creates and saves a new workflow.protected WorkflowModeleditWorkflow(CMSWorkflowData requestData, WorkflowModel workflow) Updates theWorkflowModelwith the data fromCMSWorkflowData.editWorkflow(String workflowCode, CMSWorkflowData workflowData) Updates the workflow with the provided data.findAllWorkflows(CMSWorkflowData workflowData, PageableData pageableData) Finds all workflows containing the given attachment for the specified workflow statuses.protected WorkflowActionModelfindNextAction(WorkflowActionModel action) Finds the next non-automated outgoing workflow action where a comment should be added to.protected Predicate<WorkflowActionModel>protected CMSAdminItemServiceprotected CMSItemModelgetCMSItemByUid(String uid) Returns anCMSItemModelfor a given uid.protected CMSItemModelgetCmsItemByUUID(String cmsItemUuid) This method retrieves the cmsItem identified by the given uuid.protected CMSVersionServiceprotected Converter<WorkflowModel,CMSWorkflowData> protected PersistentKeyGeneratorprotected CommentServiceprotected org.springframework.validation.Validatorprotected org.springframework.validation.Validatorprotected FacadeValidationServiceprotected org.springframework.validation.Validatorprotected ModelServiceprotected PermissionCRUDServiceprotected List<PostWorkflowAction>protected SearchResultConverterprotected CMSWorkflowEditableItemDatagetSessionUserEditableItemData(CMSItemModel itemModel, boolean editableByCurrentUser) GeneratesCMSWorkflowEditableItemDatafromCMSItemModeland editableByCurrentUser attribute.getSessionUserEditableItems(List<String> itemUids) Returns a list ofCMSWorkflowEditableItemDatathat informs whether each item is editable or not by the session user.protected org.springframework.transaction.PlatformTransactionManagerprotected UniqueItemIdentifierServiceprotected UserServiceprotected CMSWorkflowActionServiceprotected List<CMSItemModel>getWorkflowAttachments(WorkflowModel workflow) Returns a list of workflow attachments.getWorkflowForCode(String workflowCode) Returns the workflow by its code.protected WorkflowProcessingServiceprotected CMSWorkflowServiceprotected WorkflowTemplateServiceprotected CMSWorkflowDatamakeDecision(WorkflowModel workflow, String actionCode, String decisionCode, String comment) Makes decision for providedWorkflowModelperformOperation(String workflowCode, CMSWorkflowOperationData data) Performs different operations defined byCMSWorkflowOperationon the workflow.protected voidprocessPostWorkflowActions(WorkflowModel workflow, CMSWorkflowOperationData data) Performs additional logic after the operation is successfully executed.voidsetAutomatedWorkflowActionTypePredicate(Predicate<WorkflowActionModel> automatedWorkflowActionTypePredicate) voidsetCmsAdminItemService(CMSAdminItemService cmsAdminItemService) voidsetCmsVersionService(CMSVersionService cmsVersionService) voidsetCmsWorkflowDataConverter(Converter<WorkflowModel, CMSWorkflowData> cmsWorkflowDataConverter) voidsetCommentsCodeGenerator(PersistentKeyGenerator commentsCodeGenerator) voidsetCommentService(CommentService commentService) voidsetCreateWorkflowValidator(org.springframework.validation.Validator createWorkflowValidator) voidsetEditWorkflowValidator(org.springframework.validation.Validator editWorkflowValidator) voidsetFacadeValidationService(FacadeValidationService facadeValidationService) voidsetFindWorkflowValidator(org.springframework.validation.Validator findWorkflowValidator) voidsetModelService(ModelService modelService) voidsetPageTypePredicate(Predicate<ItemModel> pageTypePredicate) voidsetPermissionCRUDService(PermissionCRUDService permissionCRUDService) voidsetPostWorkflowActions(List<PostWorkflowAction> postWorkflowActions) voidsetSearchResultConverter(SearchResultConverter searchResultConverter) voidsetTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) voidsetUniqueIdentifierAttributeToDataContentConverter(UniqueIdentifierAttributeToDataContentConverter<ItemModel> uniqueIdentifierAttributeToDataContentConverter) voidsetUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService) voidsetUserService(UserService userService) voidsetWorkflowActionService(CMSWorkflowActionService workflowActionService) voidsetWorkflowProcessingService(WorkflowProcessingService workflowProcessingService) voidsetWorkflowService(CMSWorkflowService workflowService) voidsetWorkflowTemplateService(WorkflowTemplateService workflowTemplateService) protected voidthrowAttributePermissionException(String permissionName, String typeCode, String qualifier) This method creates and throws a newAttributePermissionException.protected voidthrowTypePermissionException(String permissionName, String typeCode) This method creates and throws a newTypePermissionException.protected voidupdatePageApprovalStatus(List<CMSItemModel> items) Updates the approval status of the page attachments to CHECK.protected voidvalidateAttributePermission(String permissionName, String typeCode, String qualifier, BiPredicate<String, String> permissionCheck) Validates that the current principal has the permission to execute an operation on the given attribute.protected voidvalidateTypePermission(String permissionName, String typeCode, Predicate<String> permissionCheck) Validates that the current principal has the permission to execute an operation on the given type.
-
Constructor Details
-
DefaultCMSWorkflowFacade
public DefaultCMSWorkflowFacade()
-
-
Method Details
-
createAndStartWorkflow
Description copied from interface:CMSWorkflowFacadeCreates and starts a workflow in the given catalog version with the workflow data provided.- Specified by:
createAndStartWorkflowin interfaceCMSWorkflowFacade- Parameters:
requestData- - the data used to create the workflow.- Returns:
- The data of the newly created and started workflow
-
editWorkflow
Description copied from interface:CMSWorkflowFacadeUpdates the workflow with the provided data.- Specified by:
editWorkflowin interfaceCMSWorkflowFacade- Parameters:
workflowCode- - the code corresponding to theWorkflowModelworkflowData- - the workflow dto to be updated.- Returns:
- the updated workflow data.
-
getWorkflowForCode
Description copied from interface:CMSWorkflowFacadeReturns the workflow by its code.- Specified by:
getWorkflowForCodein interfaceCMSWorkflowFacade- Parameters:
workflowCode- - the workflow code- Returns:
- the workflow data
-
editWorkflow
Updates theWorkflowModelwith the data fromCMSWorkflowData.- Parameters:
requestData- - the object that contains the data about the new workflow to create.workflow- - the workflow which needs to be updated.- Returns:
- the updated
WorkflowModel.
-
performOperation
Description copied from interface:CMSWorkflowFacadePerforms different operations defined byCMSWorkflowOperationon the workflow.- Specified by:
performOperationin interfaceCMSWorkflowFacade- Parameters:
workflowCode- - the code corresponding to theWorkflowModeldata- - the DTO object containing all the information about operation to be performed- Returns:
- The data of the modified workflow.
-
processPostWorkflowActions
Performs additional logic after the operation is successfully executed.- Parameters:
workflow- the workflow for which extra operation will be executeddata- the DTO containing the information about the operation that was just performed successfully
-
cancelWorkflow
Cancels the workflow for the providedWorkflowModel.- Parameters:
workflow- - theWorkflowModel- Returns:
- The data of the cancelled workflow
-
makeDecision
protected CMSWorkflowData makeDecision(WorkflowModel workflow, String actionCode, String decisionCode, String comment) Makes decision for providedWorkflowModel- Parameters:
workflow- - theWorkflowModelactionCode- - the action codedecisionCode- - the decision code- Returns:
- The data of the changed workflow
-
createDecisionComments
Creates a comment and adds it to incoming and non-automated outgoing actions. The comment itself has a reference to the outgoing action.- Parameters:
decision- - theWorkflowDecisionModelsubject- - the subject of the commenttext- - the text of the comment
-
findNextAction
Finds the next non-automated outgoing workflow action where a comment should be added to.- Parameters:
action- the action just being completed- Returns:
- the next action to be activated
-
addCommentToAction
Adds a comment to an action.- Parameters:
action- - theWorkflowActionModelcomment- - theCMSWorkflowCommentModel
-
createComment
protected CMSWorkflowCommentModel createComment(WorkflowDecisionModel decision, CommentTypeModel commentType, ComponentModel component, String subject, String text) Creates a comment and assigns a decision to it.- Parameters:
decision- - theWorkflowDecisionModelto assigncommentType- - theCommentTypeModelcomponent- - theComponentModelsubject- - the subject of the commenttext- - the text of the comment- Returns:
- the
CMSWorkflowCommentModel
-
validateTypePermission
protected void validateTypePermission(String permissionName, String typeCode, Predicate<String> permissionCheck) Validates that the current principal has the permission to execute an operation on the given type.- Parameters:
permissionName- - The name of the permission to check.typeCode- - The code of the type for which to check the principal permission.permissionCheck- - Predicate to execute the permission check.- Throws:
TypePermissionException- if the user does not have the expected permission on the given type.
-
validateAttributePermission
protected void validateAttributePermission(String permissionName, String typeCode, String qualifier, BiPredicate<String, String> permissionCheck) Validates that the current principal has the permission to execute an operation on the given attribute.- Parameters:
permissionName- - The name of the permission to check.typeCode- - The code of the type for which to check the principal permission.qualifier- - The qualifier of the attribute.permissionCheck- - Predicate to execute the permission check.- Throws:
TypePermissionException- if the user does not have the expected permission on the given attribute.
-
throwTypePermissionException
This method creates and throws a newTypePermissionException.- Parameters:
permissionName- - the name of the permission that triggered the exception.typeCode- - the type for which the principal does not have permission and that triggered the exception.
-
throwAttributePermissionException
protected void throwAttributePermissionException(String permissionName, String typeCode, String qualifier) This method creates and throws a newAttributePermissionException.- Parameters:
permissionName- - the name of the permission that triggered the exception.typeCode- - the type for which the principal does not have permission and that triggered the exception.
-
createWorkflow
This method creates and saves a new workflow. If the given request data has the createVersion flag enabled, this method will also create a new version for each of the attached items.- Parameters:
requestData- - the object that contains the data about the new workflow to create.- Returns:
- the newly created
WorkflowModel.
-
createVersionsForItems
Creates versions for a list of items.- Parameters:
items- - the list ofCMSItemModelversionLabel- - the version label
-
updatePageApprovalStatus
Updates the approval status of the page attachments to CHECK.- Parameters:
items- - the list ofCMSItemModel
-
getCmsItemByUUID
This method retrieves the cmsItem identified by the given uuid.- Parameters:
cmsItemUuid- - The uuid uniquely identifying the cmsItem to retrieve.- Returns:
- the
CMSItemModelfound.
-
createVersion
This method creates a new version of the given cmsItem.- Parameters:
cmsItem- - The cmsItem for which to create a new version.versionLabel- - The label used to identify the new version to create.
-
createAttachment
protected WorkflowItemAttachmentModel createAttachment(WorkflowModel workflow, CMSItemModel cmsItem) Creates a new attachment from a given cmsItem and adds it to the given workflow.- Parameters:
workflow- - the workflow to which the new attachment will be added.cmsItem- - the CmsItem for which to create the new attachment.- Returns:
- the newly created
WorkflowItemAttachmentModel.
-
findAllWorkflows
public SearchResult<CMSWorkflowData> findAllWorkflows(CMSWorkflowData workflowData, PageableData pageableData) Description copied from interface:CMSWorkflowFacadeFinds all workflows containing the given attachment for the specified workflow statuses.- Specified by:
findAllWorkflowsin interfaceCMSWorkflowFacade- Parameters:
workflowData- - the workflow dto containing the attachment uuid and the workflow statuses that will be used to filter the result set.pageableData- - the pageable dto determining the page size and index.- Returns:
- the paginated result of workflow data
-
getWorkflowAttachments
Returns a list of workflow attachments. Filters out non CMSItemModel items.- Parameters:
workflow- theWorkflowModel- Returns:
- the list of
CMSItemModelattachments.
-
getSessionUserEditableItems
Description copied from interface:CMSWorkflowFacadeReturns a list ofCMSWorkflowEditableItemDatathat informs whether each item is editable or not by the session user.- Specified by:
getSessionUserEditableItemsin interfaceCMSWorkflowFacade- Parameters:
itemUids- the list of item uids to verify.- Returns:
- the list of
CMSWorkflowEditableItemData
-
getSessionUserEditableItemData
protected CMSWorkflowEditableItemData getSessionUserEditableItemData(CMSItemModel itemModel, boolean editableByCurrentUser) GeneratesCMSWorkflowEditableItemDatafromCMSItemModeland editableByCurrentUser attribute.- Parameters:
itemModel- theCMSItemModeleditableByCurrentUser- the attribute tells whether the item is editable or not- Returns:
- the
CMSWorkflowEditableItemData
-
getCMSItemByUid
Returns anCMSItemModelfor a given uid.- Parameters:
uid- the uid of anCMSItemModel- Returns:
- the
CMSItemModel - Throws:
UnknownIdentifierException- if an item model cannot be found for the provided uid.
-
getCreateWorkflowValidator
protected org.springframework.validation.Validator getCreateWorkflowValidator() -
setCreateWorkflowValidator
public void setCreateWorkflowValidator(org.springframework.validation.Validator createWorkflowValidator) -
getFindWorkflowValidator
protected org.springframework.validation.Validator getFindWorkflowValidator() -
setFindWorkflowValidator
public void setFindWorkflowValidator(org.springframework.validation.Validator findWorkflowValidator) -
getTransactionManager
protected org.springframework.transaction.PlatformTransactionManager getTransactionManager() -
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) -
getFacadeValidationService
-
setFacadeValidationService
-
getWorkflowTemplateService
-
setWorkflowTemplateService
-
getUniqueItemIdentifierService
-
setUniqueItemIdentifierService
-
getUserService
-
setUserService
-
getWorkflowProcessingService
-
setWorkflowProcessingService
-
getModelService
-
setModelService
-
getCmsVersionService
-
setCmsVersionService
-
getCmsWorkflowDataConverter
-
setCmsWorkflowDataConverter
public void setCmsWorkflowDataConverter(Converter<WorkflowModel, CMSWorkflowData> cmsWorkflowDataConverter) -
getPermissionCRUDService
-
setPermissionCRUDService
-
getWorkflowService
-
setWorkflowService
-
getSearchResultConverter
-
setSearchResultConverter
-
getEditWorkflowValidator
protected org.springframework.validation.Validator getEditWorkflowValidator() -
setEditWorkflowValidator
public void setEditWorkflowValidator(org.springframework.validation.Validator editWorkflowValidator) -
getCommentService
-
setCommentService
-
getUniqueIdentifierAttributeToDataContentConverter
protected UniqueIdentifierAttributeToDataContentConverter<ItemModel> getUniqueIdentifierAttributeToDataContentConverter() -
setUniqueIdentifierAttributeToDataContentConverter
public void setUniqueIdentifierAttributeToDataContentConverter(UniqueIdentifierAttributeToDataContentConverter<ItemModel> uniqueIdentifierAttributeToDataContentConverter) -
getCmsAdminItemService
-
setCmsAdminItemService
-
getCommentsCodeGenerator
-
setCommentsCodeGenerator
-
getPostWorkflowActions
-
setPostWorkflowActions
-
getWorkflowActionService
-
setWorkflowActionService
-
getAutomatedWorkflowActionTypePredicate
-
setAutomatedWorkflowActionTypePredicate
public void setAutomatedWorkflowActionTypePredicate(Predicate<WorkflowActionModel> automatedWorkflowActionTypePredicate) -
getPageTypePredicate
-
setPageTypePredicate
-