Controller for managing Workflow templates
Former-commit-id: 03c06e69b6f7d6957c24ad7d7e4d44c20e14d05bpull/10/head
parent
04c7de59d0
commit
bd5b9cf3e4
|
|
@ -70,7 +70,10 @@ public class ConfigurationLifecyclesController {
|
|||
private PhaseDefinititionRepository phaseDefinititionRepo;
|
||||
|
||||
@Inject
|
||||
private SelectedLifecycleDefinitionModel selectedDefinitionModel;
|
||||
private SelectedLifecycleDefinitionModel selectedLifecycleDefModel;
|
||||
|
||||
@Inject
|
||||
private SelectedPhaseDefinitionModel selectedPhaseDefModel;
|
||||
|
||||
@GET
|
||||
@Path("/")
|
||||
|
|
@ -130,8 +133,8 @@ public class ConfigurationLifecyclesController {
|
|||
);
|
||||
}
|
||||
final LifecycleDefinition definition = definitionResult.get();
|
||||
selectedDefinitionModel.setUuid(definition.getUuid());
|
||||
selectedDefinitionModel.setLabel(
|
||||
selectedLifecycleDefModel.setUuid(definition.getUuid());
|
||||
selectedLifecycleDefModel.setLabel(
|
||||
definition
|
||||
.getLabel()
|
||||
.getValues()
|
||||
|
|
@ -144,7 +147,7 @@ public class ConfigurationLifecyclesController {
|
|||
)
|
||||
)
|
||||
);
|
||||
selectedDefinitionModel.setDescription(
|
||||
selectedLifecycleDefModel.setDescription(
|
||||
definition
|
||||
.getDescription()
|
||||
.getValues()
|
||||
|
|
@ -157,7 +160,7 @@ public class ConfigurationLifecyclesController {
|
|||
)
|
||||
)
|
||||
);
|
||||
selectedDefinitionModel.setPhaseDefinitions(
|
||||
selectedLifecycleDefModel.setPhaseDefinitions(
|
||||
definition
|
||||
.getPhaseDefinitions()
|
||||
.stream()
|
||||
|
|
@ -523,6 +526,79 @@ public class ConfigurationLifecyclesController {
|
|||
);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}")
|
||||
@AuthorizationRequired
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public String showPhase(
|
||||
@PathParam("sectionIdentifier") final String sectionIdentifierParam,
|
||||
@PathParam("lifecycleIdentifier") final String lifecycleIdentiferParam,
|
||||
@PathParam("phaseIdentifier") final String phaseIdentifierParam
|
||||
) {
|
||||
final Optional<ContentSection> sectionResult = sectionsUi
|
||||
.findContentSection(sectionIdentifierParam);
|
||||
if (!sectionResult.isPresent()) {
|
||||
sectionsUi.showContentSectionNotFound(sectionIdentifierParam);
|
||||
}
|
||||
final ContentSection section = sectionResult.get();
|
||||
if (!adminPermissionsChecker.canAdministerLifecycles(section)) {
|
||||
return sectionsUi.showAccessDenied(
|
||||
"sectionIdentifier", sectionIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
final Optional<LifecycleDefinition> definitionResult
|
||||
= findLifecycleDefinition(section, sectionIdentifierParam);
|
||||
if (!definitionResult.isPresent()) {
|
||||
return showLifecycleDefinitionNotFound(
|
||||
section, sectionIdentifierParam
|
||||
);
|
||||
}
|
||||
final LifecycleDefinition definition = definitionResult.get();
|
||||
final Optional<PhaseDefinition> phaseDefinitionResult
|
||||
= findPhaseDefinition(definition, sectionIdentifierParam);
|
||||
if (!phaseDefinitionResult.isPresent()) {
|
||||
return showPhaseDefinitionNotFound(
|
||||
section,
|
||||
sectionIdentifierParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
final PhaseDefinition phaseDefinition = phaseDefinitionResult.get();
|
||||
selectedPhaseDefModel.setDefaultDelay(phaseDefinition.getDefaultDelay());
|
||||
selectedPhaseDefModel.setDefaultDuration(
|
||||
phaseDefinition.getDefaultDuration()
|
||||
);
|
||||
selectedPhaseDefModel.setDefinitionId(phaseDefinition.getDefinitionId());
|
||||
selectedPhaseDefModel.setDescription(
|
||||
phaseDefinition
|
||||
.getDescription()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
)
|
||||
);
|
||||
selectedPhaseDefModel.setLabel(
|
||||
phaseDefinition
|
||||
.getLabel()
|
||||
.getValues()
|
||||
.entrySet()
|
||||
.stream()
|
||||
.collect(
|
||||
Collectors.toMap(
|
||||
entry -> entry.getKey().toString(),
|
||||
entry -> entry.getValue()
|
||||
)
|
||||
)
|
||||
);
|
||||
return "org/librecms/ui/contentsection/configuration/lifecycle-phase.xhtml";
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/{lifecycleIdentifier}/phases/{phaseIdentifier}/@edit")
|
||||
@AuthorizationRequired
|
||||
|
|
@ -570,9 +646,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.save(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -619,9 +696,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.delete(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -670,9 +748,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.save(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -721,9 +800,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.save(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -772,9 +852,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.save(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -825,9 +906,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.save(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -879,9 +961,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.save(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -930,9 +1013,10 @@ public class ConfigurationLifecyclesController {
|
|||
phaseDefinititionRepo.save(phaseDefinition);
|
||||
|
||||
return String.format(
|
||||
"redirect:/%s/configuration/lifecycles/%s",
|
||||
"redirect:/%s/configuration/lifecycles/%s/phases/%s",
|
||||
sectionIdentifierParam,
|
||||
lifecycleIdentiferParam
|
||||
lifecycleIdentiferParam,
|
||||
phaseIdentifierParam
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -19,7 +19,7 @@ import javax.inject.Named;
|
|||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("SelectedLifecycleModel")
|
||||
@Named("SelectedLifecycleDefinitionModel")
|
||||
public class SelectedLifecycleDefinitionModel {
|
||||
|
||||
private String uuid;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.librecms.ui.contentsections;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("SelectedPhaseDefinitionModel")
|
||||
public class SelectedPhaseDefinitionModel {
|
||||
|
||||
private long definitionId;
|
||||
|
||||
private Map<String, String> label;
|
||||
|
||||
private Map<String, String> description;
|
||||
|
||||
private long defaultDelay;
|
||||
|
||||
private long defaultDuration;
|
||||
|
||||
public long getDefinitionId() {
|
||||
return definitionId;
|
||||
}
|
||||
|
||||
public void setDefinitionId(final long definitionId) {
|
||||
this.definitionId = definitionId;
|
||||
}
|
||||
|
||||
public Map<String, String> getLabel() {
|
||||
return Collections.unmodifiableMap(label);
|
||||
}
|
||||
|
||||
public void setLabel(final Map<String, String> label) {
|
||||
this.label = new HashMap<>(label);
|
||||
}
|
||||
|
||||
public Map<String, String> getDescription() {
|
||||
return Collections.unmodifiableMap(description);
|
||||
}
|
||||
|
||||
public void setDescription(final Map<String, String> description) {
|
||||
this.description = new HashMap<>(description);
|
||||
}
|
||||
|
||||
public long getDefaultDelay() {
|
||||
return defaultDelay;
|
||||
}
|
||||
|
||||
public void setDefaultDelay(final long defaultDelay) {
|
||||
this.defaultDelay = defaultDelay;
|
||||
}
|
||||
|
||||
public long getDefaultDuration() {
|
||||
return defaultDuration;
|
||||
}
|
||||
|
||||
public void setDefaultDuration(final long defaultDuration) {
|
||||
this.defaultDuration = defaultDuration;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.librecms.ui.contentsections;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("SelectedWorkflowTaskTemplateModel")
|
||||
public class SelectedWorkflowTaskTemplateModel {
|
||||
|
||||
private long taskId;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private Map<String, String> label;
|
||||
|
||||
private Map<String, String> description;
|
||||
|
||||
private List<WorkflowTaskTemplateListModel> blockedTasks;
|
||||
|
||||
private List<WorkflowTaskTemplateListModel> blockingTasks;
|
||||
|
||||
public long getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(final long taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(final String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public Map<String, String> getLabel() {
|
||||
return Collections.unmodifiableMap(label);
|
||||
}
|
||||
|
||||
public void setLabel(final Map<String, String> label) {
|
||||
this.label = new HashMap<>(label);
|
||||
}
|
||||
|
||||
public Map<String, String> getDescription() {
|
||||
return Collections.unmodifiableMap(description);
|
||||
}
|
||||
|
||||
public void setDescription(final Map<String, String> description) {
|
||||
this.description = new HashMap<>(description);
|
||||
}
|
||||
|
||||
public List<WorkflowTaskTemplateListModel> getBlockedTasks() {
|
||||
return Collections.unmodifiableList(blockedTasks);
|
||||
}
|
||||
|
||||
public void setBlockedTasks(
|
||||
final List<WorkflowTaskTemplateListModel> blockedTasks
|
||||
) {
|
||||
this.blockedTasks = new ArrayList<>(blockedTasks);
|
||||
}
|
||||
|
||||
public List< WorkflowTaskTemplateListModel> getBlockingTasks() {
|
||||
return Collections.unmodifiableList(blockingTasks);
|
||||
}
|
||||
|
||||
public void setBlockingTasks(
|
||||
final List<WorkflowTaskTemplateListModel> blockingTasks
|
||||
) {
|
||||
this.blockingTasks = new ArrayList<>(blockingTasks);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.librecms.ui.contentsections;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RequestScoped
|
||||
@Named("SelectedWorkflowTemplateModel")
|
||||
public class SelectedWorkflowTemplateModel {
|
||||
|
||||
private long workflowId;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private Map<String, String> name;
|
||||
|
||||
private Map<String, String> description;
|
||||
|
||||
private List<WorkflowTaskTemplateListModel> tasks;
|
||||
|
||||
public long getWorkflowId() {
|
||||
return workflowId;
|
||||
}
|
||||
|
||||
public void setWorkflowId(final long workflowId) {
|
||||
this.workflowId = workflowId;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(final String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public Map<String, String> getName() {
|
||||
return Collections.unmodifiableMap(name);
|
||||
}
|
||||
|
||||
public void setName(Map<String, String> name) {
|
||||
this.name = new HashMap<>(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getDescription() {
|
||||
return Collections.unmodifiableMap(description);
|
||||
}
|
||||
|
||||
public void setDescription(final Map<String, String> description) {
|
||||
this.description = new HashMap<>(description);
|
||||
}
|
||||
|
||||
public List<WorkflowTaskTemplateListModel> getTasks() {
|
||||
return Collections.unmodifiableList(tasks);
|
||||
}
|
||||
|
||||
public void setTasks(final List<WorkflowTaskTemplateListModel> tasks) {
|
||||
this.tasks = new ArrayList<>(tasks);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.librecms.ui.contentsections;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class WorkflowTaskTemplateListModel {
|
||||
|
||||
private long taskId;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private String label;
|
||||
|
||||
private String description;
|
||||
|
||||
private List<WorkflowTaskTemplateListModel> blockedTasks;
|
||||
|
||||
private List<WorkflowTaskTemplateListModel> blockingTasks;
|
||||
|
||||
public long getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(final long taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(final String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public List<WorkflowTaskTemplateListModel> getBlockedTasks() {
|
||||
return Collections.unmodifiableList(blockedTasks);
|
||||
}
|
||||
|
||||
public void setBlockedTasks(
|
||||
final List<WorkflowTaskTemplateListModel> blockedTasks
|
||||
) {
|
||||
this.blockedTasks = new ArrayList<>(blockedTasks);
|
||||
}
|
||||
|
||||
public List< WorkflowTaskTemplateListModel> getBlockingTasks() {
|
||||
return Collections.unmodifiableList(blockingTasks);
|
||||
}
|
||||
|
||||
public void setBlockingTasks(
|
||||
final List<WorkflowTaskTemplateListModel> blockingTasks
|
||||
) {
|
||||
this.blockingTasks = new ArrayList<>(blockingTasks);
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(final String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(final String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.librecms.ui.contentsections;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class WorkflowTemplateListModel {
|
||||
|
||||
private long workflowId;
|
||||
|
||||
private String uuid;
|
||||
|
||||
private String name;
|
||||
|
||||
private String description;
|
||||
|
||||
public long getWorkflowId() {
|
||||
return workflowId;
|
||||
}
|
||||
|
||||
public void setWorkflowId(final long workflowId) {
|
||||
this.workflowId = workflowId;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(final String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(final String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue