diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationLifecyclesController.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationLifecyclesController.java index 56b532ec9..b56f4bcc6 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationLifecyclesController.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationLifecyclesController.java @@ -48,6 +48,9 @@ public class ConfigurationLifecyclesController { @Inject private ContentSectionManager sectionManager; + + @Inject + private ContentSectionModel sectionModel; @Inject private ContentSectionsUi sectionsUi; @@ -60,7 +63,7 @@ public class ConfigurationLifecyclesController { @Inject private LifecycleManager lifecycleManager; - + @Inject private LifecycleDefinitionRepository definitionRepo; @@ -89,6 +92,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -120,6 +124,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -127,10 +132,10 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( - section, sectionIdentifierParam + section, lifecycleIdentiferParam ); } final LifecycleDefinition definition = definitionResult.get(); @@ -204,6 +209,7 @@ public class ConfigurationLifecyclesController { @POST @Path("/@add") @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) public String addLifecycleDefinition( @PathParam("sectionIdentifier") final String sectionIdentifierParam, @FormParam("label") final String label @@ -214,6 +220,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -224,6 +231,7 @@ public class ConfigurationLifecyclesController { definition .getLabel() .addValue(globalizationHelper.getNegotiatedLocale(), label); + definitionRepo.save(definition); sectionManager.addLifecycleDefinitionToContentSection( definition, section ); @@ -247,6 +255,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -254,7 +263,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -287,6 +296,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -294,7 +304,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -327,6 +337,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -334,7 +345,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -366,6 +377,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -373,7 +385,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -406,6 +418,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -413,7 +426,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -446,6 +459,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -453,7 +467,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -485,6 +499,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -492,7 +507,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -530,6 +545,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -537,7 +553,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -562,6 +578,8 @@ public class ConfigurationLifecyclesController { phaseDefinition .getLabel() .addValue(globalizationHelper.getNegotiatedLocale(), label); + + phaseDefinititionRepo.save(phaseDefinition); lifecycleManager.addPhaseDefinition(definition, phaseDefinition); return String.format( @@ -586,6 +604,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -593,7 +612,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -608,7 +627,7 @@ public class ConfigurationLifecyclesController { selectedLifecycleDefModel.setUuid(definition.getUuid()); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -707,6 +726,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -714,7 +734,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -722,7 +742,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -769,6 +789,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -776,7 +797,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -784,7 +805,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -797,10 +818,9 @@ public class ConfigurationLifecyclesController { phaseDefinititionRepo.delete(phaseDefinition); return String.format( - "redirect:/%s/configuration/lifecycles/%s/phases/%s", + "redirect:/%s/configuration/lifecycles/%s", sectionIdentifierParam, - lifecycleIdentiferParam, - phaseIdentifierParam + lifecycleIdentiferParam ); } @@ -821,6 +841,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -828,7 +849,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -836,7 +857,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -873,6 +894,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -880,7 +902,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -888,7 +910,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -910,7 +932,8 @@ public class ConfigurationLifecyclesController { @POST @Path( - "/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@remove/{locale}") + "/{lifecycleIdentifier}/phases/{phaseIdentifier}/label/@remove/{locale}" + ) @AuthorizationRequired @Transactional(Transactional.TxType.REQUIRED) public String removePhaseLabel( @@ -925,6 +948,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -932,7 +956,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -940,7 +964,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -977,6 +1001,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -984,7 +1009,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -992,7 +1017,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -1016,7 +1041,8 @@ public class ConfigurationLifecyclesController { @POST @Path( - "/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@edit/{locale}") + "/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@edit/{locale}" + ) @AuthorizationRequired @Transactional(Transactional.TxType.REQUIRED) public String editPhaseDescription( @@ -1032,6 +1058,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -1039,7 +1066,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -1047,7 +1074,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -1071,7 +1098,8 @@ public class ConfigurationLifecyclesController { @POST @Path( - "/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@remove/{locale}") + "/{lifecycleIdentifier}/phases/{phaseIdentifier}/description/@remove/{locale}" + ) @AuthorizationRequired @Transactional(Transactional.TxType.REQUIRED) public String removePhaseDescription( @@ -1086,6 +1114,7 @@ public class ConfigurationLifecyclesController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -1093,7 +1122,7 @@ public class ConfigurationLifecyclesController { } final Optional definitionResult - = findLifecycleDefinition(section, sectionIdentifierParam); + = findLifecycleDefinition(section, lifecycleIdentiferParam); if (!definitionResult.isPresent()) { return showLifecycleDefinitionNotFound( section, sectionIdentifierParam @@ -1101,7 +1130,7 @@ public class ConfigurationLifecyclesController { } final LifecycleDefinition definition = definitionResult.get(); final Optional phaseDefinitionResult - = findPhaseDefinition(definition, sectionIdentifierParam); + = findPhaseDefinition(definition, phaseIdentifierParam); if (!phaseDefinitionResult.isPresent()) { return showPhaseDefinitionNotFound( section, @@ -1207,7 +1236,7 @@ public class ConfigurationLifecyclesController { .stream() .filter( definition -> definition.getDefinitionId() == Long - .parseLong(phaseDefinitionIdentifierParam) + .parseLong(phaseDefinitionIdentifierParam.substring(3)) ).findAny(); } diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationWorkflowController.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationWorkflowController.java index 888eed706..c58e61db2 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationWorkflowController.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ConfigurationWorkflowController.java @@ -51,6 +51,9 @@ public class ConfigurationWorkflowController { @Inject private ContentSectionManager sectionManager; + @Inject + private ContentSectionModel sectionModel; + @Inject private ContentSectionsUi sectionsUi; @@ -94,6 +97,7 @@ public class ConfigurationWorkflowController { return sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerWorkflows(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -125,6 +129,7 @@ public class ConfigurationWorkflowController { return sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerWorkflows(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -212,6 +217,7 @@ public class ConfigurationWorkflowController { @POST @Path("/@add") @AuthorizationRequired + @Transactional(Transactional.TxType.REQUIRED) public String addWorkflowTemplate( @PathParam("sectionIdentifier") final String sectionIdentifierParam, @FormParam("label") final String label @@ -222,6 +228,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -233,6 +240,7 @@ public class ConfigurationWorkflowController { template.getName().addValue( globalizationHelper.getNegotiatedLocale(), label ); + workflowRepo.save(template); sectionManager.addWorkflowTemplateToContentSection(template, section); return String.format( @@ -254,6 +262,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -293,6 +302,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -332,6 +342,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -372,6 +383,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -411,6 +423,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -450,6 +463,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -489,6 +503,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -513,7 +528,7 @@ public class ConfigurationWorkflowController { } @GET - @Path("/{workflowIdentifier}/tasks") + @Path("/{workflowIdentifier}/tasks/{taskIdentifier}") @AuthorizationRequired @Transactional(Transactional.TxType.REQUIRED) public String showTask( @@ -527,6 +542,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -673,6 +689,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -690,6 +707,8 @@ public class ConfigurationWorkflowController { task.getLabel().addValue( globalizationHelper.getNegotiatedLocale(), label ); + + taskRepo.save(task); taskManager.addTask(workflow, task); return String.format( @@ -714,6 +733,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -763,6 +783,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -813,6 +834,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -863,6 +885,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -913,6 +936,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -964,6 +988,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -1014,6 +1039,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -1064,6 +1090,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -1103,7 +1130,7 @@ public class ConfigurationWorkflowController { models.put("workflowTemplateIdentifier", workflowIdentiferParam); models.put("blockedTaskIdentifier", taskIdentifierParam); models.put("blockingTaskIdentifier", blockingTaskParam); - + return "org/librecms/ui/contentsection/configuration/workflow-task-circular-dependency.xhtml"; } @@ -1132,6 +1159,7 @@ public class ConfigurationWorkflowController { sectionsUi.showContentSectionNotFound(sectionIdentifierParam); } final ContentSection section = sectionResult.get(); + sectionModel.setSection(section); if (!adminPermissionsChecker.canAdministerLifecycles(section)) { return sectionsUi.showAccessDenied( "sectionIdentifier", sectionIdentifierParam @@ -1251,7 +1279,7 @@ public class ConfigurationWorkflowController { models.put("sectionIdentifier", section.getLabel()); models.put("workflowTemplateIdentifier", workflowTemplateIdentifier); models.put("workflowTaskTemplateIdentifier", taskTemplateIdentifier); - return "org/librecms/ui/contentsection/configuration/workflowtask-not-found.xhtml"; + return "org/librecms/ui/contentsection/configuration/workflow-task-not-found.xhtml"; } private WorkflowTemplateListModel buildWorkflowTemplateListModel( @@ -1276,22 +1304,6 @@ public class ConfigurationWorkflowController { ) { final WorkflowTaskTemplateListModel model = new WorkflowTaskTemplateListModel(); - model.setBlockedTasks( - task - .getBlockedTasks() - .stream() - .map(dependency -> dependency.getBlockedTask()) - .map(this::buildWorkflowTaskTemplateListModel) - .collect(Collectors.toList()) - ); - model.setBlockingTasks( - task - .getBlockingTasks() - .stream() - .map(dependency -> dependency.getBlockingTask()) - .map(this::buildWorkflowTaskTemplateListModel) - .collect(Collectors.toList()) - ); model.setDescription( globalizationHelper.getValueFromLocalizedString( task.getDescription() diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/ContentSectionApplication.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ContentSectionApplication.java index 56475f048..88f291cde 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/ContentSectionApplication.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/ContentSectionApplication.java @@ -28,7 +28,9 @@ public class ContentSectionApplication extends Application { classes.add(CategoriesController.class); classes.add(ConfigurationController.class); classes.add(ConfigurationDocumentTypesController.class); + classes.add(ConfigurationLifecyclesController.class); classes.add(ConfigurationRolesController.class); + classes.add(ConfigurationWorkflowController.class); classes.add(ContentSectionController.class); classes.add(DocumentFolderController.class); classes.add(IsAuthenticatedFilter.class); diff --git a/ccm-cms/src/main/java/org/librecms/ui/contentsections/WorkflowTaskTemplateListModel.java b/ccm-cms/src/main/java/org/librecms/ui/contentsections/WorkflowTaskTemplateListModel.java index 762dd9251..6d8116804 100644 --- a/ccm-cms/src/main/java/org/librecms/ui/contentsections/WorkflowTaskTemplateListModel.java +++ b/ccm-cms/src/main/java/org/librecms/ui/contentsections/WorkflowTaskTemplateListModel.java @@ -25,10 +25,6 @@ public class WorkflowTaskTemplateListModel { private String description; - private List blockedTasks; - - private List blockingTasks; - public long getTaskId() { return taskId; } @@ -45,26 +41,6 @@ public class WorkflowTaskTemplateListModel { this.uuid = uuid; } - public List getBlockedTasks() { - return Collections.unmodifiableList(blockedTasks); - } - - public void setBlockedTasks( - final List blockedTasks - ) { - this.blockedTasks = new ArrayList<>(blockedTasks); - } - - public List< WorkflowTaskTemplateListModel> getBlockingTasks() { - return Collections.unmodifiableList(blockingTasks); - } - - public void setBlockingTasks( - final List blockingTasks - ) { - this.blockingTasks = new ArrayList<>(blockingTasks); - } - public String getLabel() { return label; } diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle-phase.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle-phase.xhtml index 644e65d54..be716d26f 100644 --- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle-phase.xhtml +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle-phase.xhtml @@ -58,7 +58,9 @@ #{CmsAdminMessages['contentsection.configuration.lifecycles.phase_details.default_delay.label']}
- #{SelectedPhaseDefinitionModel.defaultDelay} + #{SelectedPhaseDefinitionModel.defaultDelay.days} #{CmsAdminMessages['contentsection.configuration.lifecycle.phases.duration.days']} + #{SelectedPhaseDefinitionModel.defaultDelay.hours} #{CmsAdminMessages['contentsection.configuration.lifecycle.phases.duration.hours']} + #{SelectedPhaseDefinitionModel.defaultDelay.minutes} #{CmsAdminMessages['contentsection.configuration.lifecycle.phases.duration.minutes']}
@@ -66,7 +68,9 @@ #{CmsAdminMessages['contentsection.configuration.lifecycles.phase_details.default_duration.label']}
- #{SelectedPhaseDefinitionModel.defaultDuration} + #{SelectedPhaseDefinitionModel.defaultDuration.days} #{CmsAdminMessages['contentsection.configuration.lifecycle.phases.duration.days']} + #{SelectedPhaseDefinitionModel.defaultDuration.hours} #{CmsAdminMessages['contentsection.configuration.lifecycle.phases.duration.hours']} + #{SelectedPhaseDefinitionModel.defaultDuration.minutes} #{CmsAdminMessages['contentsection.configuration.lifecycle.phases.duration.minutes']}
@@ -102,20 +106,56 @@ diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle.xhtml index 3b5c0a294..3897450d6 100644 --- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle.xhtml +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/lifecycle.xhtml @@ -92,7 +92,7 @@ editDialogValueLabel="#{CmsAdminMessages['contentsection.configuration.lifecycles.lifecycle_details.description.edit.value.description']}" editMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/lifecycles/UUID-#{SelectedLifecycleDefinitionModel.uuid}/description/@edit" editorId="lifecycle-description" - hasUnusedLocales="#{SelectedLifecycleDefinitionModel.hasUnusedLabelLocales}" + hasUnusedLocales="#{SelectedLifecycleDefinitionModel.hasUnusedDescriptionLocales}" objectIdentifier="UUID-#{SelectedLifecycleDefinitionModel.uuid}" removeButtonLabel="#{CmsAdminMessages['contentsection.configuration.lifecycles.lifecycle_details.description.remove.button']}" removeDialogCancelLabel="#{CmsAdminMessages['contentsection.configuration.lifecycles.lifecycle_details.description.remove.cancel']}" @@ -101,7 +101,7 @@ removeDialogTitle="#{CmsAdminMessages['contentsection.configuration.lifecycles.lifecycle_details.description.remove.title']}" removeMethod="#{mvc.basePath}/#{ContentSectionModel.sectionName}/configuration/lifecycles/UUID-#{SelectedLifecycleDefinitionModel.uuid}/description/@remove" title="#{CmsAdminMessages['contentsection.configuration.lifecycles.lifecycle_details.description.title']}" - unusedLocales="#{SelectedLifecycleDefinitionModel.unusedLabelLocales}" + unusedLocales="#{SelectedÜ.unusedDescriptionLocales}" useTextarea="true" values="#{SelectedLifecycleDefinitionModel.description}" /> @@ -110,7 +110,7 @@
-
- +
- @@ -112,7 +112,7 @@ #{lifecycleDef.label} - -
#{CmsAdminMessages['contentsection.configuration.lifecycles.table.cols.label']} + #{CmsAdminMessages['contentsection.configuration.lifecycles.table.cols.actions']}
+ + -

#{CmsAdminMessages.getMessage('contentsection.configuration.workflow.task_details.title', [SelectedWorkflowTemplateModel.displayName ,SelectedWorkflowTaskTemplateModel.displayLabel])}

+

#{CmsAdminMessages.getMessage('contentsection.configuration.workflow.task_details.title', [ContentSectionModel.sectionName, SelectedWorkflowTemplate.displayName ,SelectedWorkflowTaskTemplateModel.displayLabel])}

- + + + + + + + + + + + + + + + + + +
+ #{CmsAdminMessages['contentsection.configuration.workflow.tasks.table.cols.label']} + + #{CmsAdminMessages['contentsection.configuration.workflow.tasks.table.cols.actions']} +
+ + #{task.label} + + + + + + +
diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflow.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflow.xhtml index 634db0020..2ae3a6e5f 100644 --- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflow.xhtml +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflow.xhtml @@ -41,211 +41,212 @@ -

#{CmsAdminMessages.getMessage('contentsection.configuration.workflows.workflow_details.title', [SelectedWorkflowTemplateModel.displayName])}

- +

#{CmsAdminMessages.getMessage('contentsection.configuration.workflows.workflow_details.title', [ContentSectionModel.sectionName, SelectedWorkflowTemplateModel.displayName])}

- - + -

#{CmsAdminMessages['contentsection.configuration.workflows.workflow_details.tasks.title']}

+ -
-
- -
+

#{CmsAdminMessages['contentsection.configuration.workflows.workflow_details.tasks.title']}

- - diff --git a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflows.xhtml b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflows.xhtml index 20238485b..7dd7d6599 100644 --- a/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflows.xhtml +++ b/ccm-cms/src/main/resources/WEB-INF/views/org/librecms/ui/contentsection/configuration/workflows.xhtml @@ -75,7 +75,8 @@ help="#{CmsAdminMessages['contentsection.configuration.workflows.add.dialog.label.help']}" inputId="add-workflow-dialog-label" label="#{CmsAdminMessages['contentsection.configuration.workflows.add.dialog.label.label']}" - name="label" /> + name="label" + required="true" />
- +
-
@@ -112,7 +113,7 @@ #{workflowTemplate.name} - + +