Class DefaultCMSWorkflowFacade

    • Constructor Detail

      • DefaultCMSWorkflowFacade

        public DefaultCMSWorkflowFacade()
    • Method Detail

      • 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
      • 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
      • makeDecision

        protected CMSWorkflowData makeDecision​(WorkflowModel workflow,
                                               java.lang.String actionCode,
                                               java.lang.String decisionCode,
                                               java.lang.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,
                                              java.lang.String subject,
                                              java.lang.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
      • validateTypePermission

        protected void validateTypePermission​(java.lang.String permissionName,
                                              java.lang.String typeCode,
                                              java.util.function.Predicate<java.lang.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​(java.lang.String permissionName,
                                                   java.lang.String typeCode,
                                                   java.lang.String qualifier,
                                                   java.util.function.BiPredicate<java.lang.String,​java.lang.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​(java.lang.String permissionName,
                                                    java.lang.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​(java.lang.String permissionName,
                                                         java.lang.String typeCode,
                                                         java.lang.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​(java.util.List<CMSItemModel> items,
                                              java.lang.String versionLabel)
        Creates versions for a list of items.
        Parameters:
        items - - the list of CMSItemModel
        versionLabel - - the version label
      • updatePageApprovalStatus

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

        protected CMSItemModel getCmsItemByUUID​(java.lang.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,
                                     java.lang.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 java.util.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.
      • 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)
      • setFacadeValidationService

        public void setFacadeValidationService​(FacadeValidationService facadeValidationService)
      • setWorkflowTemplateService

        public void setWorkflowTemplateService​(WorkflowTemplateService workflowTemplateService)
      • setUniqueItemIdentifierService

        public void setUniqueItemIdentifierService​(UniqueItemIdentifierService uniqueItemIdentifierService)
      • getUserService

        protected UserService getUserService()
      • setUserService

        public void setUserService​(UserService userService)
      • setWorkflowProcessingService

        public void setWorkflowProcessingService​(WorkflowProcessingService workflowProcessingService)
      • getModelService

        protected ModelService getModelService()
      • setModelService

        public void setModelService​(ModelService modelService)
      • setCmsVersionService

        public void setCmsVersionService​(CMSVersionService cmsVersionService)
      • setPermissionCRUDService

        public void setPermissionCRUDService​(PermissionCRUDService permissionCRUDService)
      • setWorkflowService

        public void setWorkflowService​(CMSWorkflowService workflowService)
      • setSearchResultConverter

        public void setSearchResultConverter​(SearchResultConverter searchResultConverter)
      • getEditWorkflowValidator

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

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

        public void setCommentService​(CommentService commentService)
      • setCmsAdminItemService

        public void setCmsAdminItemService​(CMSAdminItemService cmsAdminItemService)
      • setCommentsCodeGenerator

        public void setCommentsCodeGenerator​(PersistentKeyGenerator commentsCodeGenerator)
      • getPostWorkflowActions

        protected java.util.List<PostWorkflowAction> getPostWorkflowActions()
      • setPostWorkflowActions

        public void setPostWorkflowActions​(java.util.List<PostWorkflowAction> postWorkflowActions)
      • getAutomatedWorkflowActionTypePredicate

        protected java.util.function.Predicate<WorkflowActionModel> getAutomatedWorkflowActionTypePredicate()
      • setAutomatedWorkflowActionTypePredicate

        public void setAutomatedWorkflowActionTypePredicate​(java.util.function.Predicate<WorkflowActionModel> automatedWorkflowActionTypePredicate)