parent
13aa01726d
commit
acc3eab962
|
|
@ -18,9 +18,12 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.lifecycle;
|
||||
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.toolbox.ui.Property;
|
||||
|
||||
import org.libreccm.configuration.ConfigurationManager;
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentSectionManager;
|
||||
import org.librecms.contentsection.ContentSectionRepository;
|
||||
|
|
@ -102,6 +105,47 @@ class LifecycleAdminPaneController {
|
|||
);
|
||||
return item;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Property> getLifecycleProperties(
|
||||
final LifecycleDefinition ofLifecycleDefinition
|
||||
) {
|
||||
final LifecycleDefinition definition = lifecycleDefRepo
|
||||
.findById(ofLifecycleDefinition.getDefinitionId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No LifecycleDefinition with ID %d found.",
|
||||
ofLifecycleDefinition.getDefinitionId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final KernelConfig kernelConfig = confManager
|
||||
.findConfiguration(KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final List<Property> properties = new ArrayList<>();
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.lifecycle.name",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
definition.getLabel().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.lifecycle.description",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
definition.getDescription().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new lifecycle definition
|
||||
|
|
|
|||
|
|
@ -61,9 +61,11 @@ import java.util.Locale;
|
|||
class LifecycleItemPane extends BaseItemPane {
|
||||
|
||||
private final LifecycleDefinitionRequestLocal selectedLifecycle;
|
||||
|
||||
private final PhaseRequestLocal selectedPhase;
|
||||
|
||||
private final Container detailPane;
|
||||
|
||||
private final Table phasesTable;
|
||||
|
||||
public LifecycleItemPane(
|
||||
|
|
@ -144,23 +146,27 @@ class LifecycleItemPane extends BaseItemPane {
|
|||
final PageState state) {
|
||||
|
||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||
final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
ConfigurationManager.class);
|
||||
final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
// final ConfigurationManager confManager = cdiUtil.findBean(
|
||||
// ConfigurationManager.class);
|
||||
// final KernelConfig kernelConfig = confManager.findConfiguration(
|
||||
// KernelConfig.class);
|
||||
// final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final LifecycleAdminPaneController controller = cdiUtil
|
||||
.findBean(LifecycleAdminPaneController.class);
|
||||
|
||||
final java.util.List<Property> props = super.properties(state);
|
||||
final LifecycleDefinition cycle = selectedLifecycle
|
||||
.getLifecycleDefinition(state);
|
||||
|
||||
props.add(new Property(
|
||||
gz("cms.ui.lifecycle.name"),
|
||||
cycle.getLabel().getValue(defaultLocale)));
|
||||
props.add(new Property(
|
||||
gz("cms.ui.lifecycle.description"),
|
||||
cycle.getDescription().getValue(defaultLocale)));
|
||||
props.addAll(controller.getLifecycleProperties(cycle));
|
||||
|
||||
// props.add(new Property(
|
||||
// gz("cms.ui.lifecycle.name"),
|
||||
// cycle.getLabel().getValue(defaultLocale)));
|
||||
// props.add(new Property(
|
||||
// gz("cms.ui.lifecycle.description"),
|
||||
// cycle.getDescription().getValue(defaultLocale)));
|
||||
return props;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -255,22 +255,28 @@ abstract class BaseWorkflowItemPane extends BaseItemPane {
|
|||
= ((Optional<Workflow>) workflowRequestLocal
|
||||
.get(state)).get();
|
||||
|
||||
final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
// final KernelConfig kernelConfig = KernelConfig.getConfig();
|
||||
// final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
props.add(new Property(gz("cms.ui.workflow.name"),
|
||||
workflow.getName()
|
||||
.getValue(defaultLocale)));
|
||||
props.add(new Property(
|
||||
gz("cms.ui.workflow.description"),
|
||||
workflow.getDescription().getValue(defaultLocale)));
|
||||
if (workflow.getState() == null) {
|
||||
props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
gz("cms.ui.workflow.current_state.none")));
|
||||
} else {
|
||||
props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
workflow.getState().toString()));
|
||||
}
|
||||
final WorkflowAdminPaneController controller = CdiUtil
|
||||
.createCdiUtil()
|
||||
.findBean(WorkflowAdminPaneController.class);
|
||||
|
||||
props.addAll(controller.getWorkflowProperties(workflow));
|
||||
// props.add(new Property(gz("cms.ui.workflow.name"),
|
||||
// workflow.getName()
|
||||
// .getValue(defaultLocale)));
|
||||
// props.add(new Property(
|
||||
// gz("cms.ui.workflow.description"),
|
||||
// workflow.getDescription().getValue(defaultLocale)));
|
||||
// if (workflow.getState() == null) {
|
||||
// props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
// gz("cms.ui.workflow.current_state.none")));
|
||||
// } else {
|
||||
// props.add(new Property(gz("cms.ui.workflow.current_state"),
|
||||
// workflow.getState().toString()));
|
||||
// }
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.workflow;
|
||||
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.KernelConfig;
|
||||
import com.arsdigita.toolbox.ui.Property;
|
||||
import com.arsdigita.util.GraphSet;
|
||||
import com.arsdigita.util.Graphs;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -36,6 +38,7 @@ import org.libreccm.workflow.TaskManager;
|
|||
import org.libreccm.workflow.TaskRepository;
|
||||
import org.libreccm.workflow.Workflow;
|
||||
import org.libreccm.workflow.WorkflowRepository;
|
||||
import org.librecms.CmsConstants;
|
||||
import org.librecms.contentsection.ContentSection;
|
||||
import org.librecms.contentsection.ContentSectionManager;
|
||||
import org.librecms.contentsection.ContentSectionRepository;
|
||||
|
|
@ -131,6 +134,68 @@ public class WorkflowAdminPaneController {
|
|||
return item;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public List<Property> getWorkflowProperties(final Workflow ofWorkflow) {
|
||||
final Workflow workflow = workflowRepo
|
||||
.findById(ofWorkflow.getWorkflowId())
|
||||
.orElseThrow(
|
||||
() -> new IllegalArgumentException(
|
||||
String.format(
|
||||
"No Workflow with ID %d available.",
|
||||
ofWorkflow.getWorkflowId()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
final KernelConfig kernelConfig = confManager
|
||||
.findConfiguration(KernelConfig.class);
|
||||
final Locale defaultLocale = kernelConfig.getDefaultLocale();
|
||||
|
||||
final List<Property> properties = new ArrayList<>();
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.name", CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
workflow.getName().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.description",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
workflow.getDescription().getValue(defaultLocale)
|
||||
)
|
||||
);
|
||||
if (workflow.getState() == null) {
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.current_state",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.current_state.none",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
properties.add(
|
||||
new Property(
|
||||
new GlobalizedMessage(
|
||||
"cms.ui.workflow.current_state",
|
||||
CmsConstants.CMS_BUNDLE
|
||||
),
|
||||
workflow.getState().toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
public Workflow createWorkflow(final ContentSection section,
|
||||
final String name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue