close

Filter

loading table of contents...

Studio Developer Manual / Version 2304

Table Of Contents

9.26.8 Publication Workflow Specifics

This section covers publication-specific workflow customizations. These only refer to server-side customizations. For the client side, there are no publication-specific customizations beyond those covered in the previous sections.

For the server side, you need to define custom validators for your new workflow. Please refer to Section 9.26.5, “Workflow Validation” for general information on how to do this. This section introduces the default publication workflow validators that cover most needs for publication workflow validation. Feel free to add further validators if needed.

Caution

Caution

Before the actual validators are executed, a so called WorkflowValidationPreparation takes place, which provides the workflow's computed change set as well as the dependent contents as INFO issues.

The default publication workflow validators offer the following functionality:

PublicationContentStateValidator

All content validators from the application context are applied to check the complete publication set for validity.

PublicationNoAssigneeValidator

If assignees are selected, all assignees are checked for having the required (see below) content rights for the publication set as well as for having the right rights for accepting the next selected task.

PublicationSessionUserRightsWorkflowValidator

For the workflow start, it is checked whether there are contents that need to be checked in and if the current user does not have the right to do it.

PublicationContentRightsWorkflowValidator

Workflow validator that checks if the given members have the configured content rights on the chosen content, that a necessary to perform publication workflow. The validator can be configured.

For each user task of the workflow, you can define the required content rights. For example, the Approve task does not need publish rights.

You can also configure if assignees can accept not only the next selected task but also a number of follow-up tasks, for example if they are auto-accepted. For example, for the case of the built-in 2-step publication workflow, the user that accepts the Approve task also needs to be able to accept the following Publish task.

PublicationWorkflowUndoWithdrawValidator

Validator that removes (undoes) toBeDeleted and toBeWithdrawn states from the given contents and their parent folders.

All the validators are defined as Spring Beans within the PublicationWorkflowValidationConfiguration file, where you can also find their Bean names, defined as constants, which you can import, or override.

The following code shows the validation configuration for the 3-step publication example.

@Configuration
public class ThreeStepPublicationWorkflowConfiguration {

  private static final String THREE_STEP_PUBLICATION_WORKFLOW_NAME = "StudioThreeStepPublication";
  public static final String THREE_STEP_PUBLICATION_VALIDATORS = "threeStepPublicationValidators";
  public static final String THREE_STEP_PUBLICATION_WORKFLOW_VALIDATORS = "threeStepPublicationWorkflowValidators";
  public static final String DO_PUBLISH_TASK_NAME = "DoPublish";

  @Bean(THREE_STEP_PUBLICATION_WORKFLOW_VALIDATORS)
  public WorkflowValidatorsModel threeStepPublicationWorkflowValidators(
        @Qualifier(PUBLICATION_VALIDATION_PREPARATION) WorkflowValidationPreparation publicationValidationPreparation,
        @Qualifier(THREE_STEP_PUBLICATION_VALIDATORS) List<WorkflowValidator> threeStepPublicationValidators) {
    ValidationTask composeRunningTask = new ValidationTask(COMPOSE_TASK_NAME, TaskState.RUNNING);
    ValidationTask approveRunningTask = new ValidationTask(APPROVE_TASK_NAME, TaskState.RUNNING);
    ValidationTask publishRunningTask = new ValidationTask(PUBLISH_TASK_NAME, TaskState.RUNNING);

    final WorkflowTaskValidators taskValidators =
            new WorkflowTaskValidators(publicationValidationPreparation, Map.of(
                    composeRunningTask, threeStepPublicationValidators,
                    approveRunningTask, threeStepPublicationValidators,
                    publishRunningTask, threeStepPublicationValidators));

    return new WorkflowValidatorsModel(
      THREE_STEP_PUBLICATION_WORKFLOW_NAME,
      taskValidators,
      new WorkflowStartValidators(publicationValidationPreparation,
      threeStepPublicationValidators));
  }

  @Bean(THREE_STEP_PUBLICATION_VALIDATORS)
  public List<WorkflowValidator> threeStepPublicationValidators(
        ContentRepository contentRepository,
        @Qualifier(PUBLICATION_NO_ASSIGNEE_VALIDATOR) WorkflowValidator publicationNoAssigneeValidator,
        @Qualifier(PUBLICATION_SESSION_USER_RIGHTS_WORKFLOW_VALIDATOR) WorkflowValidator publicationSessionUserRightsWorkflowValidator,
        @Qualifier(PUBLICATION_WORKFLOW_UNDO_WITHDRAW_VALIDATOR) WorkflowValidator publicationWorkflowUndoWithdrawValidator,
        @Qualifier(PUBLICATION_CONTENT_ISSUES_VALIDATOR) WorkflowValidator publicationContentIssuesValidator) {

    Map<String, Rights> requiredContentRightsForTasks = new HashMap<>();
    requiredContentRightsForTasks.put(APPROVE_TASK_NAME, Rights.valueOf("RA"));
    requiredContentRightsForTasks.put(PUBLISH_TASK_NAME, Rights.valueOf("RAP"));
    requiredContentRightsForTasks.put(DO_PUBLISH_TASK_NAME, Rights.valueOf("RAP"));
    PublicationContentRightsWorkflowValidator publicationContentRightsWorkflowValidator =
        new PublicationContentRightsWorkflowValidator(
            contentRepository,
            requiredContentRightsForTasks,
            Map.of(PUBLISH_TASK_NAME, List.of(DO_PUBLISH_TASK_NAME)));

    return List.of(publicationContentRightsWorkflowValidator,
            publicationNoAssigneeValidator,
            publicationSessionUserRightsWorkflowValidator,
            publicationWorkflowUndoWithdrawValidator,
            publicationContentIssuesValidator);
  }
}

Example 9.109. Workflow validation configuration for the StudioThreeStepPublication workflow


Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.