Class DefaultCMSWorkflowFacade

java.lang.Object
de.hybris.platform.cmsfacades.workflow.impl.DefaultCMSWorkflowFacade
All Implemented Interfaces:
CMSWorkflowFacade

public class DefaultCMSWorkflowFacade extends Object implements CMSWorkflowFacade
Default implementation of the CMSWorkflowFacade.
  • Constructor Details

    • DefaultCMSWorkflowFacade

      public DefaultCMSWorkflowFacade()
  • Method Details

    • createAndStartWorkflow

      public CMSWorkflowData createAndStartWorkflow(CMSWorkflowData requestData)
      Description copied from interface: CMSWorkflowFacade
      Creates and starts a workflow in the given catalog version with the workflow data provided.
      Specified by:
      createAndStartWorkflow in interface CMSWorkflowFacade
      Parameters:
      requestData - - the data used to create the workflow.
      Returns:
      The data of the newly created and started workflow
    • editWorkflow

      public CMSWorkflowData editWorkflow(String workflowCode, CMSWorkflowData workflowData)
      Description copied from interface: CMSWorkflowFacade
      Updates the workflow with the provided data.
      Specified by:
      editWorkflow in interface CMSWorkflowFacade
      Parameters:
      workflowCode - - the code corresponding to the WorkflowModel
      workflowData - - the workflow dto to be updated.
      Returns:
      the updated workflow data.
    • getWorkflowForCode

      public CMSWorkflowData getWorkflowForCode(String workflowCode)
      Description copied from interface: CMSWorkflowFacade
      Returns the workflow by its code.
      Specified by:
      getWorkflowForCode in interface CMSWorkflowFacade
      Parameters:
      workflowCode - - the workflow code
      Returns:
      the workflow data
    • editWorkflow

      protected WorkflowModel editWorkflow(CMSWorkflowData requestData, WorkflowModel workflow)
      Updates the WorkflowModel with the data from CMSWorkflowData.
      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

      public CMSWorkflowData performOperation(String workflowCode, CMSWorkflowOperationData data)
      Description copied from interface: CMSWorkflowFacade
      Performs different operations defined by CMSWorkflowOperation on the workflow.
      Specified by:
      performOperation in interface CMSWorkflowFacade
      Parameters:
      workflowCode - - the code corresponding to the WorkflowModel
      data - - the DTO object containing all the information about operation to be performed
      Returns:
      The data of the modified workflow.
    • processPostWorkflowActions

      protected void processPostWorkflowActions(WorkflowModel workflow, CMSWorkflowOperationData data)
      Performs additional logic after the operation is successfully executed.
      Parameters:
      workflow - the workflow for which extra operation will be executed
      data - the DTO containing the information about the operation that was just performed successfully
    • cancelWorkflow

      protected CMSWorkflowData cancelWorkflow(WorkflowModel workflow)
      Cancels the workflow for the provided WorkflowModel.
      Parameters:
      workflow - - the WorkflowModel
      Returns:
      The data of the cancelled workflow
    • makeDecision

      protected CMSWorkflowData makeDecision(WorkflowModel workflow, String actionCode, String decisionCode, String comment)
      Makes decision for provided WorkflowModel
      Parameters:
      workflow - - the WorkflowModel
      actionCode - - the action code
      decisionCode - - the decision code
      Returns:
      The data of the changed workflow
    • createDecisionComments

      protected void createDecisionComments(WorkflowDecisionModel decision, String subject, String text)
      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 - - the WorkflowDecisionModel
      subject - - the subject of the comment
      text - - the text of the comment
    • findNextAction

      protected WorkflowActionModel findNextAction(WorkflowActionModel action)
      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

      protected void addCommentToAction(WorkflowActionModel action, CMSWorkflowCommentModel comment)
      Adds a comment to an action.
      Parameters:
      action - - the WorkflowActionModel
      comment - - the CMSWorkflowCommentModel
    • 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 - - the WorkflowDecisionModel to assign
      commentType - - the CommentTypeModel
      component - - the ComponentModel
      subject - - the subject of the comment
      text - - 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

      protected void throwTypePermissionException(String permissionName, String typeCode)
      This method creates and throws a new TypePermissionException.
      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 new AttributePermissionException.
      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

      protected WorkflowModel createWorkflow(CMSWorkflowData requestData)
      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

      protected void createVersionsForItems(List<CMSItemModel> items, String versionLabel)
      Creates versions for a list of items.
      Parameters:
      items - - the list of CMSItemModel
      versionLabel - - the version label
    • updatePageApprovalStatus

      protected void updatePageApprovalStatus(List<CMSItemModel> items)
      Updates the approval status of the page attachments to CHECK.
      Parameters:
      items - - the list of CMSItemModel
    • getCmsItemByUUID

      protected CMSItemModel getCmsItemByUUID(String cmsItemUuid)
      This method retrieves the cmsItem identified by the given uuid.
      Parameters:
      cmsItemUuid - - The uuid uniquely identifying the cmsItem to retrieve.
      Returns:
      the CMSItemModel found.
    • createVersion

      protected void createVersion(CMSItemModel cmsItem, String versionLabel)
      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: CMSWorkflowFacade
      Finds all workflows containing the given attachment for the specified workflow statuses.
      Specified by:
      findAllWorkflows in interface CMSWorkflowFacade
      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

      protected List<CMSItemModel> getWorkflowAttachments(WorkflowModel workflow)
      Returns a list of workflow attachments. Filters out non CMSItemModel items.
      Parameters:
      workflow - the WorkflowModel
      Returns:
      the list of CMSItemModel attachments.
    • getSessionUserEditableItems

      public List<CMSWorkflowEditableItemData> getSessionUserEditableItems(List<String> itemUids)
      Description copied from interface: CMSWorkflowFacade
      Returns a list of CMSWorkflowEditableItemData that informs whether each item is editable or not by the session user.
      Specified by:
      getSessionUserEditableItems in interface CMSWorkflowFacade
      Parameters:
      itemUids - the list of item uids to verify.
      Returns:
      the list of CMSWorkflowEditableItemData
    • getSessionUserEditableItemData

      protected CMSWorkflowEditableItemData getSessionUserEditableItemData(CMSItemModel itemModel, boolean editableByCurrentUser)
      Generates CMSWorkflowEditableItemData from CMSItemModel and editableByCurrentUser attribute.
      Parameters:
      itemModel - the CMSItemModel
      editableByCurrentUser - the attribute tells whether the item is editable or not
      Returns:
      the CMSWorkflowEditableItemData
    • getCMSItemByUid

      protected CMSItemModel getCMSItemByUid(String uid)
      Returns an CMSItemModel for a given uid.
      Parameters:
      uid - the uid of an CMSItemModel
      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

      protected FacadeValidationService getFacadeValidationService()
    • setFacadeValidationService

      public void setFacadeValidationService(FacadeValidationService facadeValidationService)
    • getWorkflowTemplateService

      protected WorkflowTemplateService getWorkflowTemplateService()
    • setWorkflowTemplateService

      public void setWorkflowTemplateService(WorkflowTemplateService workflowTemplateService)
    • getUniqueItemIdentifierService

      protected UniqueItemIdentifierService getUniqueItemIdentifierService()
    • setUniqueItemIdentifierService

      public void setUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService)
    • getUserService

      protected UserService getUserService()
    • setUserService

      public void setUserService(UserService userService)
    • getWorkflowProcessingService

      protected WorkflowProcessingService getWorkflowProcessingService()
    • setWorkflowProcessingService

      public void setWorkflowProcessingService(WorkflowProcessingService workflowProcessingService)
    • getModelService

      protected ModelService getModelService()
    • setModelService

      public void setModelService(ModelService modelService)
    • getCmsVersionService

      protected CMSVersionService getCmsVersionService()
    • setCmsVersionService

      public void setCmsVersionService(CMSVersionService cmsVersionService)
    • getCmsWorkflowDataConverter

      protected Converter<WorkflowModel,CMSWorkflowData> getCmsWorkflowDataConverter()
    • setCmsWorkflowDataConverter

      public void setCmsWorkflowDataConverter(Converter<WorkflowModel,CMSWorkflowData> cmsWorkflowDataConverter)
    • getPermissionCRUDService

      protected PermissionCRUDService getPermissionCRUDService()
    • setPermissionCRUDService

      public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
    • getWorkflowService

      protected CMSWorkflowService getWorkflowService()
    • setWorkflowService

      public void setWorkflowService(CMSWorkflowService workflowService)
    • getSearchResultConverter

      protected SearchResultConverter getSearchResultConverter()
    • setSearchResultConverter

      public void setSearchResultConverter(SearchResultConverter searchResultConverter)
    • getEditWorkflowValidator

      protected org.springframework.validation.Validator getEditWorkflowValidator()
    • setEditWorkflowValidator

      public void setEditWorkflowValidator(org.springframework.validation.Validator editWorkflowValidator)
    • getCommentService

      protected CommentService getCommentService()
    • setCommentService

      public void setCommentService(CommentService commentService)
    • getUniqueIdentifierAttributeToDataContentConverter

      protected UniqueIdentifierAttributeToDataContentConverter<ItemModel> getUniqueIdentifierAttributeToDataContentConverter()
    • setUniqueIdentifierAttributeToDataContentConverter

      public void setUniqueIdentifierAttributeToDataContentConverter(UniqueIdentifierAttributeToDataContentConverter<ItemModel> uniqueIdentifierAttributeToDataContentConverter)
    • getCmsAdminItemService

      protected CMSAdminItemService getCmsAdminItemService()
    • setCmsAdminItemService

      public void setCmsAdminItemService(CMSAdminItemService cmsAdminItemService)
    • getCommentsCodeGenerator

      protected PersistentKeyGenerator getCommentsCodeGenerator()
    • setCommentsCodeGenerator

      public void setCommentsCodeGenerator(PersistentKeyGenerator commentsCodeGenerator)
    • getPostWorkflowActions

      protected List<PostWorkflowAction> getPostWorkflowActions()
    • setPostWorkflowActions

      public void setPostWorkflowActions(List<PostWorkflowAction> postWorkflowActions)
    • getWorkflowActionService

      protected CMSWorkflowActionService getWorkflowActionService()
    • setWorkflowActionService

      public void setWorkflowActionService(CMSWorkflowActionService workflowActionService)
    • getAutomatedWorkflowActionTypePredicate

      protected Predicate<WorkflowActionModel> getAutomatedWorkflowActionTypePredicate()
    • setAutomatedWorkflowActionTypePredicate

      public void setAutomatedWorkflowActionTypePredicate(Predicate<WorkflowActionModel> automatedWorkflowActionTypePredicate)
    • getPageTypePredicate

      protected Predicate<ItemModel> getPageTypePredicate()
    • setPageTypePredicate

      public void setPageTypePredicate(Predicate<ItemModel> pageTypePredicate)