- Removed class WorkflowTemplate, replaced by property abstractWorkflow in class workflow
- Fixed several test failures



git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5015 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
jensp 2017-09-27 19:45:02 +00:00
parent 82c6b50d7c
commit 81be5540dc
54 changed files with 5950 additions and 2360 deletions

View File

@ -23,8 +23,7 @@ import org.libreccm.workflow.AssignableTask;
import org.libreccm.workflow.AssignableTaskManager; import org.libreccm.workflow.AssignableTaskManager;
import org.libreccm.workflow.Workflow; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowManager; import org.libreccm.workflow.WorkflowManager;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.WorkflowRepository;
import org.libreccm.workflow.WorkflowTemplateRepository;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository; import org.librecms.contentsection.ContentSectionRepository;
@ -56,7 +55,7 @@ class ApplyWorkflowController {
private ContentSectionRepository sectionRepo; private ContentSectionRepository sectionRepo;
@Inject @Inject
private WorkflowTemplateRepository templateRepo; private WorkflowRepository templateRepo;
@Inject @Inject
private WorkflowManager workflowManager; private WorkflowManager workflowManager;
@ -68,7 +67,7 @@ class ApplyWorkflowController {
private PermissionChecker permissionChecker; private PermissionChecker permissionChecker;
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
protected WorkflowTemplate getDefaultWorkflow(final ContentType contentType) { protected Workflow getDefaultWorkflow(final ContentType contentType) {
Objects.requireNonNull(contentType); Objects.requireNonNull(contentType);
@ -83,7 +82,7 @@ class ApplyWorkflowController {
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
Long getDefaultWorkflowId(final ContentType contentType) { Long getDefaultWorkflowId(final ContentType contentType) {
final WorkflowTemplate workflowTemplate final Workflow workflowTemplate
= getDefaultWorkflow(contentType); = getDefaultWorkflow(contentType);
if (workflowTemplate == null) { if (workflowTemplate == null) {
return null; return null;
@ -93,7 +92,7 @@ class ApplyWorkflowController {
} }
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
protected List<WorkflowTemplate> getWorkflowTemplates( protected List<Workflow> getWorkflowTemplates(
final ContentSection section) { final ContentSection section) {
final ContentSection contentSection = sectionRepo final ContentSection contentSection = sectionRepo
@ -115,7 +114,7 @@ class ApplyWorkflowController {
Objects.requireNonNull(folder); Objects.requireNonNull(folder);
Objects.requireNonNull(workflowTemplateId); Objects.requireNonNull(workflowTemplateId);
final WorkflowTemplate workflowTemplate; final Workflow workflowTemplate;
if (workflowTemplateId == null if (workflowTemplateId == null
&& permissionChecker && permissionChecker
.isPermitted(ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, folder)) { .isPermitted(ItemPrivileges.APPLY_ALTERNATE_WORKFLOW, folder)) {

View File

@ -43,7 +43,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.security.PermissionChecker; import org.libreccm.security.PermissionChecker;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.privileges.ItemPrivileges; import org.librecms.contentsection.privileges.ItemPrivileges;
@ -111,7 +111,7 @@ public class ApplyWorkflowFormSection
LOGGER.error("Too many listeners", ex); LOGGER.error("Too many listeners", ex);
} }
add(new Label(new GlobalizedMessage("cms.ui.authoring.workflow", super.add(new Label(new GlobalizedMessage("cms.ui.authoring.workflow",
CmsConstants.CMS_BUNDLE))); CmsConstants.CMS_BUNDLE)));
radioGroup.addValidationListener(new NotNullValidationListener() { radioGroup.addValidationListener(new NotNullValidationListener() {
@ -125,8 +125,8 @@ public class ApplyWorkflowFormSection
} }
}); });
add(radioGroup); super.add(radioGroup);
addInitListener(this); super.addInitListener(this);
} }
/** /**
@ -280,7 +280,7 @@ public class ApplyWorkflowFormSection
} }
@Override @Override
protected List<WorkflowTemplate> getCollection(final PageState state) { protected List<Workflow> getCollection(final PageState state) {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ApplyWorkflowController controller = cdiUtil final ApplyWorkflowController controller = cdiUtil
.findBean(ApplyWorkflowController.class); .findBean(ApplyWorkflowController.class);

View File

@ -21,7 +21,6 @@ package com.arsdigita.cms.ui.authoring;
import com.arsdigita.bebop.ColumnPanel; import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.FormSection;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
@ -38,16 +37,13 @@ import org.librecms.contentsection.Folder;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelConfig;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import org.arsdigita.cms.CMSConfig; import org.arsdigita.cms.CMSConfig;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowTemplate;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItemInitializer; import org.librecms.contentsection.ContentItemInitializer;
import org.librecms.contentsection.ContentItemManager;
import org.librecms.contentsection.ContentType; import org.librecms.contentsection.ContentType;
import java.util.Date; import java.util.Date;
@ -293,7 +289,7 @@ public abstract class BasicPageForm extends BasicItemForm {
final String name, final String name,
final ContentSection section, final ContentSection section,
final Folder folder, final Folder folder,
final WorkflowTemplate workflowTemplate, final Workflow workflowTemplate,
final ContentItemInitializer<T> initializer, final ContentItemInitializer<T> initializer,
final Locale locale) throws FormProcessException { final Locale locale) throws FormProcessException {

View File

@ -18,8 +18,8 @@
*/ */
package com.arsdigita.cms.ui.authoring; package com.arsdigita.cms.ui.authoring;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowTemplateRepository; import org.libreccm.workflow.WorkflowRepository;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemInitializer; import org.librecms.contentsection.ContentItemInitializer;
import org.librecms.contentsection.ContentItemManager; import org.librecms.contentsection.ContentItemManager;
@ -56,7 +56,7 @@ class BasicPageFormController {
private FolderRepository folderRepo; private FolderRepository folderRepo;
@Inject @Inject
private WorkflowTemplateRepository workflowTemplateRepo; private WorkflowRepository workflowRepo;
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
protected <T extends ContentItem> T createContentItem( protected <T extends ContentItem> T createContentItem(
@ -81,7 +81,7 @@ class BasicPageFormController {
final String name, final String name,
final ContentSection section, final ContentSection section,
final Folder folder, final Folder folder,
final WorkflowTemplate workflowTemplate, final Workflow workflowTemplate,
final Class<T> clazz, final Class<T> clazz,
final ContentItemInitializer<T> initializer, final ContentItemInitializer<T> initializer,
final Locale locale) { final Locale locale) {
@ -109,7 +109,7 @@ class BasicPageFormController {
locale); locale);
} else { } else {
final WorkflowTemplate itemWorkflowTemplate = workflowTemplateRepo final Workflow itemWorkflowTemplate = workflowRepo
.findById(workflowTemplate.getWorkflowId()) .findById(workflowTemplate.getWorkflowId())
.orElseThrow(() -> new IllegalArgumentException(String .orElseThrow(() -> new IllegalArgumentException(String
.format("No WorkflowTemplate with ID %d in the database.", .format("No WorkflowTemplate with ID %d in the database.",

View File

@ -39,8 +39,8 @@ import com.arsdigita.util.Assert;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.l10n.GlobalizationHelper; import org.libreccm.l10n.GlobalizationHelper;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowTemplateRepository; import org.libreccm.workflow.WorkflowRepository;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemInitializer; import org.librecms.contentsection.ContentItemInitializer;
@ -100,9 +100,9 @@ public class PageCreateForm
this.selectedLanguageParam = selectedLanguageParam; this.selectedLanguageParam = selectedLanguageParam;
workflowSection.setCreationSelector(creationSelector); workflowSection.setCreationSelector(creationSelector);
addSubmissionListener(this); super.addSubmissionListener(this);
getSaveCancelSection().getSaveButton() super.getSaveCancelSection().getSaveButton()
.setButtonLabel(new GlobalizedMessage("cms.ui.create", .setButtonLabel(new GlobalizedMessage("cms.ui.create",
CmsConstants.CMS_BUNDLE)); CmsConstants.CMS_BUNDLE));
} }
@ -239,9 +239,9 @@ public class PageCreateForm
getItemInitializer(data, state), getItemInitializer(data, state),
locale); locale);
} else { } else {
final WorkflowTemplateRepository workflowTemplateRepo = cdiUtil final WorkflowRepository workflowRepo = cdiUtil
.findBean(WorkflowTemplateRepository.class); .findBean(WorkflowRepository.class);
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(selectedWorkflowTemplateId) .findById(selectedWorkflowTemplateId)
.orElseThrow(() -> new IllegalArgumentException(String.format( .orElseThrow(() -> new IllegalArgumentException(String.format(
"No WorkflowTemplate with ID %d in the database.", "No WorkflowTemplate with ID %d in the database.",

View File

@ -64,7 +64,6 @@ import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.Workflow; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowManager; import org.libreccm.workflow.WorkflowManager;
import org.libreccm.workflow.WorkflowRepository; import org.libreccm.workflow.WorkflowRepository;
import org.libreccm.workflow.WorkflowTemplate;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
import org.librecms.contentsection.ContentItemManager; import org.librecms.contentsection.ContentItemManager;
@ -823,7 +822,7 @@ class ItemLifecycleSelectForm extends BaseForm {
} else { } else {
// restart the workflow by recreating it // restart the workflow by recreating it
// from the same workflow template // from the same workflow template
final WorkflowTemplate template = workflow.getTemplate(); final Workflow template = workflow.getTemplate();
workflowRepo.delete(workflow); workflowRepo.delete(workflow);
final Workflow restarted = workflowManager.createWorkflow( final Workflow restarted = workflowManager.createWorkflow(
template, item); template, item);

View File

@ -18,7 +18,7 @@
*/ */
package com.arsdigita.cms.ui.type; package com.arsdigita.cms.ui.type;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository; import org.librecms.contentsection.ContentSectionRepository;
import org.librecms.contentsection.ContentType; import org.librecms.contentsection.ContentType;
@ -130,7 +130,7 @@ class ContentTypeAdminPaneController {
} }
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public WorkflowTemplate getWorkflowTemplate(final ContentType type) { public Workflow getWorkflowTemplate(final ContentType type) {
final ContentType contentType = typeRepo final ContentType contentType = typeRepo
.findById(type.getObjectId()) .findById(type.getObjectId())
@ -146,7 +146,7 @@ class ContentTypeAdminPaneController {
public Optional<String> getWorkflowTemplateName(final ContentType type, public Optional<String> getWorkflowTemplateName(final ContentType type,
final Locale locale) { final Locale locale) {
final WorkflowTemplate workflowTemplate = getWorkflowTemplate(type); final Workflow workflowTemplate = getWorkflowTemplate(type);
if (workflowTemplate == null) { if (workflowTemplate == null) {
return Optional.empty(); return Optional.empty();
@ -170,7 +170,7 @@ class ContentTypeAdminPaneController {
} }
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public List<WorkflowTemplate> getWorkflowTemplates( public List<Workflow> getWorkflowTemplates(
final ContentSection section) { final ContentSection section) {
final ContentSection contentSection = sectionRepo final ContentSection contentSection = sectionRepo

View File

@ -23,7 +23,6 @@ import com.arsdigita.cms.CMS;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentType; import org.librecms.contentsection.ContentType;
import org.librecms.lifecycle.LifecycleDefinition;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelConfig; import com.arsdigita.kernel.KernelConfig;
@ -34,7 +33,6 @@ import org.libreccm.cdi.utils.CdiUtil;
import java.util.Locale; import java.util.Locale;
import org.libreccm.workflow.WorkflowTemplate;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contenttypes.ContentTypeInfo; import org.librecms.contenttypes.ContentTypeInfo;
import org.librecms.contenttypes.ContentTypesManager; import org.librecms.contenttypes.ContentTypesManager;

View File

@ -42,10 +42,8 @@ import com.arsdigita.cms.CMS;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentType; import org.librecms.contentsection.ContentType;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
import org.libreccm.workflow.WorkflowTemplate;
import com.arsdigita.cms.ui.CMSForm; import com.arsdigita.cms.ui.CMSForm;
import com.arsdigita.cms.ui.GlobalNavigation;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelConfig; import com.arsdigita.kernel.KernelConfig;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
@ -53,7 +51,8 @@ import com.arsdigita.util.UncheckedWrapperException;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.workflow.WorkflowTemplateRepository; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowRepository;
import org.librecms.CmsConstants; import org.librecms.CmsConstants;
import org.librecms.contentsection.ContentTypeManager; import org.librecms.contentsection.ContentTypeManager;
import org.librecms.contentsection.ContentTypeRepository; import org.librecms.contentsection.ContentTypeRepository;
@ -204,7 +203,7 @@ public class EditType extends CMSForm
data.put(m_lcSelect.getName(), cycle.getDefinitionId()); data.put(m_lcSelect.getName(), cycle.getDefinitionId());
} }
WorkflowTemplate template = type.getDefaultWorkflow(); Workflow template = type.getDefaultWorkflow();
if (template != null) { if (template != null) {
data.put(m_wfSelect.getName(), template.getWorkflowId()); data.put(m_wfSelect.getName(), template.getWorkflowId());
} }
@ -215,7 +214,7 @@ public class EditType extends CMSForm
* model. * model.
*/ */
private ContentType getContentType(final PageState state) { private ContentType getContentType(final PageState state) {
final String key = (String) m_types.getSelectedKey(state); final String key = m_types.getSelectedKey(state);
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final ContentTypeRepository typeRepo = cdiUtil.findBean( final ContentTypeRepository typeRepo = cdiUtil.findBean(
@ -226,7 +225,7 @@ public class EditType extends CMSForm
result = typeRepo.findById(Long.parseLong(key)); result = typeRepo.findById(Long.parseLong(key));
} catch (NumberFormatException ex) { } catch (NumberFormatException ex) {
throw new UncheckedWrapperException(String.format( throw new UncheckedWrapperException(String.format(
"The provided key \"%d\" is not a long.", key), "The provided key \"%s\" is not a long.", key),
ex); ex);
} }
@ -265,8 +264,8 @@ public class EditType extends CMSForm
ContentTypeRepository.class); ContentTypeRepository.class);
final LifecycleDefinitionRepository lifecycleDefRepo = cdiUtil.findBean( final LifecycleDefinitionRepository lifecycleDefRepo = cdiUtil.findBean(
LifecycleDefinitionRepository.class); LifecycleDefinitionRepository.class);
final WorkflowTemplateRepository workflowTemplateRepo = cdiUtil final WorkflowRepository workflowRepo = cdiUtil
.findBean(WorkflowTemplateRepository.class); .findBean(WorkflowRepository.class);
final ContentTypeManager typeManager = cdiUtil.findBean( final ContentTypeManager typeManager = cdiUtil.findBean(
ContentTypeManager.class); ContentTypeManager.class);
@ -292,11 +291,11 @@ public class EditType extends CMSForm
} else { } else {
defaultLifecycle = lifecycleDefRepo.findById(lifecycleId).get(); defaultLifecycle = lifecycleDefRepo.findById(lifecycleId).get();
} }
final WorkflowTemplate defaultWorkflow; final Workflow defaultWorkflow;
if (workflowId == 0) { if (workflowId == 0) {
defaultWorkflow = null; defaultWorkflow = null;
} else { } else {
defaultWorkflow = workflowTemplateRepo.findById(workflowId).get(); defaultWorkflow = workflowRepo.findById(workflowId).get();
} }
@ -367,7 +366,7 @@ public class EditType extends CMSForm
final ContentTypeAdminPaneController controller = cdiUtil final ContentTypeAdminPaneController controller = cdiUtil
.findBean(ContentTypeAdminPaneController.class); .findBean(ContentTypeAdminPaneController.class);
final List<WorkflowTemplate> templates = controller final List<Workflow> templates = controller
.getWorkflowTemplates(section); .getWorkflowTemplates(section);
final Locale defaultLocale = KernelConfig.getConfig() final Locale defaultLocale = KernelConfig.getConfig()
.getDefaultLocale(); .getDefaultLocale();

View File

@ -30,16 +30,19 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ui.CMSForm; import com.arsdigita.cms.ui.CMSForm;
import com.arsdigita.web.Web; import com.arsdigita.web.Web;
import org.libreccm.workflow.Workflow; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowTemplate;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.TooManyListenersException; import java.util.TooManyListenersException;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.workflow.WorkflowManager; import org.libreccm.workflow.WorkflowManager;
import org.libreccm.workflow.WorkflowTemplateRepository; import org.libreccm.workflow.WorkflowRepository;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
/** /**
@ -97,12 +100,13 @@ class ItemWorkflowSelectForm extends CMSForm {
if (item.getWorkflow() == null) { if (item.getWorkflow() == null) {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final WorkflowTemplateRepository templateRepo = cdiUtil. final WorkflowRepository templateRepo = cdiUtil.
findBean(WorkflowTemplateRepository.class); findBean(WorkflowRepository.class);
final WorkflowManager workflowManager = cdiUtil.findBean( final WorkflowManager workflowManager = cdiUtil.findBean(
WorkflowManager.class); WorkflowManager.class);
final WorkflowTemplate template = templateRepo.findById(flowId) final Workflow template = templateRepo
.findById(flowId)
.get(); .get();
workflowManager.createWorkflow(template, item); workflowManager.createWorkflow(template, item);
} }

View File

@ -25,8 +25,8 @@ import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import org.libreccm.workflow.WorkflowTemplate;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.workflow.Workflow;
/** /**
* @author Uday Mathur * @author Uday Mathur
@ -60,28 +60,8 @@ class WorkflowAddForm extends BaseWorkflowForm {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final WorkflowAdminPaneController controller = cdiUtil.findBean( final WorkflowAdminPaneController controller = cdiUtil.findBean(
WorkflowAdminPaneController.class); WorkflowAdminPaneController.class);
// final WorkflowTemplateRepository workflowTemplateRepository
// = cdiUtil.findBean(
// WorkflowTemplateRepository.class);
// final ContentSectionManager sectionManager = cdiUtil.findBean(
// ContentSectionManager.class);
// final ConfigurationManager confManager = cdiUtil.findBean(
// ConfigurationManager.class);
// final KernelConfig kernelConfig = confManager.findConfiguration(
// KernelConfig.class);
// final Locale defaultLocale = kernelConfig.getDefaultLocale();
//
// final WorkflowTemplate workflow = new WorkflowTemplate();
// workflow.getName().addValue(defaultLocale, label);
// workflow.getDescription().addValue(defaultLocale, description);
//
// workflowTemplateRepository.save(workflow);
//
// final ContentSection section = CMS.getContext().getContentSection();
// sectionManager
// .addWorkflowTemplateToContentSection(workflow, section);
final WorkflowTemplate workflow = controller.createWorkflow( final Workflow workflow = controller.createWorkflow(
CMS.getContext().getContentSection(), CMS.getContext().getContentSection(),
label, label,
description); description);

View File

@ -29,7 +29,6 @@ import com.arsdigita.cms.ui.VisibilityComponent;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.workflow.Workflow; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowRepository; import org.libreccm.workflow.WorkflowRepository;
import org.libreccm.workflow.WorkflowTemplateRepository;
import org.librecms.contentsection.privileges.AdminPrivileges; import org.librecms.contentsection.privileges.AdminPrivileges;
@ -92,8 +91,8 @@ public final class WorkflowAdminPane extends BaseAdminPane {
.toString(); .toString();
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final WorkflowTemplateRepository templateRepo = cdiUtil.findBean( final WorkflowRepository templateRepo = cdiUtil.findBean(
WorkflowTemplateRepository.class); WorkflowRepository.class);
return templateRepo.findById(Long.parseLong(id)); return templateRepo.findById(Long.parseLong(id));
} }

View File

@ -35,8 +35,6 @@ import org.libreccm.workflow.TaskManager;
import org.libreccm.workflow.TaskRepository; import org.libreccm.workflow.TaskRepository;
import org.libreccm.workflow.Workflow; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowRepository; import org.libreccm.workflow.WorkflowRepository;
import org.libreccm.workflow.WorkflowTemplate;
import org.libreccm.workflow.WorkflowTemplateRepository;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionManager; import org.librecms.contentsection.ContentSectionManager;
import org.librecms.contentsection.ContentSectionRepository; import org.librecms.contentsection.ContentSectionRepository;
@ -54,7 +52,6 @@ import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.management.relation.RoleInfo;
import javax.transaction.Transactional; import javax.transaction.Transactional;
/** /**
@ -79,9 +76,6 @@ public class WorkflowAdminPaneController {
@Inject @Inject
private WorkflowRepository workflowRepo; private WorkflowRepository workflowRepo;
@Inject
private WorkflowTemplateRepository workflowTemplateRepo;
@Inject @Inject
private TaskRepository taskRepo; private TaskRepository taskRepo;
@ -95,7 +89,7 @@ public class WorkflowAdminPaneController {
private RoleRepository roleRepo; private RoleRepository roleRepo;
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public List<WorkflowTemplate> retrieveWorkflows(final ContentSection section) { public List<Workflow> retrieveWorkflows(final ContentSection section) {
final ContentSection contentSection = sectionRepo final ContentSection contentSection = sectionRepo
.findById(section.getObjectId()) .findById(section.getObjectId())
@ -108,9 +102,9 @@ public class WorkflowAdminPaneController {
} }
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public WorkflowTemplate createWorkflow(final ContentSection section, public Workflow createWorkflow(final ContentSection section,
final String name, final String name,
final String desc) { final String desc) {
final KernelConfig kernelConfig = confManager.findConfiguration( final KernelConfig kernelConfig = confManager.findConfiguration(
KernelConfig.class); KernelConfig.class);
@ -123,11 +117,12 @@ public class WorkflowAdminPaneController {
+ "Where did that ID come from?", + "Where did that ID come from?",
section.getObjectId()))); section.getObjectId())));
final WorkflowTemplate workflowTemplate = new WorkflowTemplate(); final Workflow workflowTemplate = new Workflow();
workflowTemplate.setAbstractWorkflow(true);
workflowTemplate.getName().addValue(defaultLocale, name); workflowTemplate.getName().addValue(defaultLocale, name);
workflowTemplate.getDescription().addValue(defaultLocale, desc); workflowTemplate.getDescription().addValue(defaultLocale, desc);
workflowTemplateRepo.save(workflowTemplate); workflowRepo.save(workflowTemplate);
sectionManager.addWorkflowTemplateToContentSection(workflowTemplate, sectionManager.addWorkflowTemplateToContentSection(workflowTemplate,
contentSection); contentSection);
@ -355,14 +350,14 @@ public class WorkflowAdminPaneController {
.retractTask(theTask, assignment.getRole())); .retractTask(theTask, assignment.getRole()));
if (roleIds != null) { if (roleIds != null) {
final List<Role> roles = Arrays final List<Role> roles = Arrays
.stream(roleIds) .stream(roleIds)
.map(roleId -> Long.parseLong(roleId)) .map(roleId -> Long.parseLong(roleId))
.map(roleId -> roleRepo.findById(roleId).orElseThrow( .map(roleId -> roleRepo.findById(roleId).orElseThrow(
() -> new IllegalArgumentException(String.format( () -> new IllegalArgumentException(String.format(
"No role with ID %d in the database. " "No role with ID %d in the database. "
+ "Where did that ID come from?", roleId)))) + "Where did that ID come from?", roleId))))
.collect(Collectors.toList()); .collect(Collectors.toList());
roles.forEach(role -> assignableTaskManager roles.forEach(role -> assignableTaskManager
.assignTask(theTask, role)); .assignTask(theTask, role));
@ -371,21 +366,21 @@ public class WorkflowAdminPaneController {
} }
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void removeAssignment(final Task task, final String roleId ) { public void removeAssignment(final Task task, final String roleId) {
final Role role = roleRepo final Role role = roleRepo
.findById(Long.parseLong(roleId)) .findById(Long.parseLong(roleId))
.orElseThrow(() -> new IllegalArgumentException(String.format( .orElseThrow(() -> new IllegalArgumentException(String.format(
"No Role with ID %s in the database. Where did that ID come from?", "No Role with ID %s in the database. Where did that ID come from?",
roleId))); roleId)));
final CmsTask theTask = (CmsTask) taskRepo final CmsTask theTask = (CmsTask) taskRepo
.findById(task.getTaskId()) .findById(task.getTaskId())
.orElseThrow(() -> new IllegalArgumentException(String.format( .orElseThrow(() -> new IllegalArgumentException(String.format(
"No Task with ID %d in the database. Where did that ID come from?", "No Task with ID %d in the database. Where did that ID come from?",
task.getTaskId()))); task.getTaskId())));
assignableTaskManager.retractTask(theTask, role); assignableTaskManager.retractTask(theTask, role);
} }

View File

@ -26,8 +26,7 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.kernel.KernelConfig; import com.arsdigita.kernel.KernelConfig;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.contentsection.ContentSection; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowTemplate;
import java.util.Iterator; import java.util.Iterator;
import java.util.Locale; import java.util.Locale;
@ -49,8 +48,8 @@ class WorkflowListModelBuilder extends AbstractListModelBuilder {
private class Model implements ListModel { private class Model implements ListModel {
private final Iterator<WorkflowTemplate> templates; private final Iterator<Workflow> templates;
private WorkflowTemplate currentTemplate; private Workflow currentTemplate;
public Model() { public Model() {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();

View File

@ -29,8 +29,8 @@ import com.arsdigita.kernel.KernelConfig;
import java.util.List; import java.util.List;
import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.libreccm.workflow.WorkflowTemplate;
/** /**
* Builds a list of workflow templates registered to the current content * Builds a list of workflow templates registered to the current content
@ -41,7 +41,7 @@ import org.libreccm.workflow.WorkflowTemplate;
*/ */
public class WorkflowsOptionPrintListener implements PrintListener { public class WorkflowsOptionPrintListener implements PrintListener {
protected List<WorkflowTemplate> getCollection(final PageState state) { protected List<Workflow> getCollection(final PageState state) {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil(); final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final WorkflowsOptionPrintListenerController controller = cdiUtil final WorkflowsOptionPrintListenerController controller = cdiUtil
@ -62,9 +62,9 @@ public class WorkflowsOptionPrintListener implements PrintListener {
final OptionGroup target = (OptionGroup) event.getTarget(); final OptionGroup target = (OptionGroup) event.getTarget();
target.clearOptions(); target.clearOptions();
final List<WorkflowTemplate> templates = getCollection(state); final List<Workflow> templates = getCollection(state);
for (final WorkflowTemplate template : templates) { for (final Workflow template : templates) {
target.addOption(new Option( target.addOption(new Option(
Long.toString(template.getWorkflowId()), Long.toString(template.getWorkflowId()),
template.getName().getValue(KernelConfig template.getName().getValue(KernelConfig

View File

@ -19,7 +19,7 @@
package com.arsdigita.cms.ui.workflow; package com.arsdigita.cms.ui.workflow;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository; import org.librecms.contentsection.ContentSectionRepository;
@ -41,7 +41,7 @@ class WorkflowsOptionPrintListenerController {
private ContentSectionRepository sectionRepo; private ContentSectionRepository sectionRepo;
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
protected List<WorkflowTemplate> getWorkflowTemplates( protected List<Workflow> getWorkflowTemplates(
final ContentSection section) { final ContentSection section) {
Objects.requireNonNull(section); Objects.requireNonNull(section);

View File

@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import org.libreccm.categorization.Category; import org.libreccm.categorization.Category;
import org.libreccm.workflow.WorkflowTemplate;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
import java.util.List; import java.util.List;
@ -38,7 +37,6 @@ import javax.inject.Inject;
import org.libreccm.categorization.Categorization; import org.libreccm.categorization.Categorization;
import org.libreccm.categorization.CategoryManager; import org.libreccm.categorization.CategoryManager;
import org.libreccm.categorization.ObjectNotAssignedToCategoryException; import org.libreccm.categorization.ObjectNotAssignedToCategoryException;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException; import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
@ -212,7 +210,7 @@ public class ContentItemManager {
* {@link ContentSection#rootDocumentsFolder} of the provided content * {@link ContentSection#rootDocumentsFolder} of the provided content
* section. Otherwise an {@link IllegalArgumentException} is thrown. * section. Otherwise an {@link IllegalArgumentException} is thrown.
* *
* Likewise the provided {@link WorkflowTemplate} must be defined in the * Likewise the provided abstract {@link Workflow} must be defined in the
* provided content section. Otherwise an {@link IllegalArgumentException} * provided content section. Otherwise an {@link IllegalArgumentException}
* is thrown. * is thrown.
* *
@ -235,7 +233,7 @@ public class ContentItemManager {
final ContentSection section, final ContentSection section,
@RequiresPrivilege(ItemPrivileges.CREATE_NEW) @RequiresPrivilege(ItemPrivileges.CREATE_NEW)
final Folder folder, final Folder folder,
final WorkflowTemplate workflowTemplate, final Workflow workflowTemplate,
final Class<T> type, final Class<T> type,
final Locale locale) { final Locale locale) {
@ -258,7 +256,7 @@ public class ContentItemManager {
* {@link ContentSection#rootDocumentsFolder} of the provided content * {@link ContentSection#rootDocumentsFolder} of the provided content
* section. Otherwise an {@link IllegalArgumentException} is thrown. * section. Otherwise an {@link IllegalArgumentException} is thrown.
* *
* Likewise the provided {@link WorkflowTemplate} must be defined in the * Likewise the provided abstract {@link Workflow} must be defined in the
* provided content section. Otherwise an {@link IllegalArgumentException} * provided content section. Otherwise an {@link IllegalArgumentException}
* is thrown. * is thrown.
* *
@ -283,7 +281,7 @@ public class ContentItemManager {
final ContentSection section, final ContentSection section,
@RequiresPrivilege(ItemPrivileges.CREATE_NEW) @RequiresPrivilege(ItemPrivileges.CREATE_NEW)
final Folder folder, final Folder folder,
final WorkflowTemplate workflowTemplate, final Workflow workflowTemplate,
final Class<T> type, final Class<T> type,
final ContentItemInitializer<T> initializer, final ContentItemInitializer<T> initializer,
final Locale locale) { final Locale locale) {
@ -490,13 +488,10 @@ public class ContentItemManager {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
// final String uuid = UUID.randomUUID().toString();
// copy.setUuid(uuid);
// copy.setItemUuid(uuid);
copy.setContentType(contentType.get()); copy.setContentType(contentType.get());
if (draftItem.getWorkflow() != null) { if (draftItem.getWorkflow() != null) {
final WorkflowTemplate template = draftItem.getWorkflow() final Workflow template = draftItem.getWorkflow()
.getTemplate(); .getTemplate();
final Workflow copyWorkflow = workflowManager.createWorkflow( final Workflow copyWorkflow = workflowManager.createWorkflow(
template, item); template, item);

View File

@ -21,6 +21,7 @@ package org.librecms.contentsection;
import org.libreccm.security.RecursivePermissions; import org.libreccm.security.RecursivePermissions;
import org.libreccm.security.Role; import org.libreccm.security.Role;
import org.libreccm.web.CcmApplication; import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.Workflow;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections; import java.util.Collections;
@ -42,7 +43,6 @@ import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery; import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import org.libreccm.workflow.WorkflowTemplate;
import org.librecms.contentsection.privileges.AssetPrivileges; import org.librecms.contentsection.privileges.AssetPrivileges;
import org.librecms.contentsection.privileges.ItemPrivileges; import org.librecms.contentsection.privileges.ItemPrivileges;
import org.librecms.contentsection.privileges.TypePrivileges; import org.librecms.contentsection.privileges.TypePrivileges;
@ -58,53 +58,53 @@ import static org.librecms.CmsConstants.*;
@Table(name = "CONTENT_SECTIONS", schema = DB_SCHEMA) @Table(name = "CONTENT_SECTIONS", schema = DB_SCHEMA)
@NamedQueries({ @NamedQueries({
@NamedQuery( @NamedQuery(
name = "ContentSection.findById", name = "ContentSection.findById",
query = "SELECT S FROM ContentSection s WHERE s.objectId = :objectId") query = "SELECT S FROM ContentSection s WHERE s.objectId = :objectId")
, ,
@NamedQuery( @NamedQuery(
name = "ContentSection.findByLabel", name = "ContentSection.findByLabel",
query = "SELECT s FROM ContentSection s WHERE s.label = :label") query = "SELECT s FROM ContentSection s WHERE s.label = :label")
, ,
@NamedQuery( @NamedQuery(
name = "ContentSection.findUsableContentTypes", name = "ContentSection.findUsableContentTypes",
query = "SELECT t FROM ContentType t " query = "SELECT t FROM ContentType t "
+ "WHERE t.contentSection = :section " + "WHERE t.contentSection = :section "
+ "AND " + "AND "
+ "(t IN (SELECT p.object FROM Permission p " + "(t IN (SELECT p.object FROM Permission p "
+ "WHERE p.grantedPrivilege = '" + "WHERE p.grantedPrivilege = '"
+ TypePrivileges.USE_TYPE + "' " + TypePrivileges.USE_TYPE + "' "
+ "AND p.grantee in :roles) " + "AND p.grantee in :roles) "
+ "OR true = :isSysAdmin)") + "OR true = :isSysAdmin)")
, ,
@NamedQuery( @NamedQuery(
name = "ContentSection.countUsableContentTypes", name = "ContentSection.countUsableContentTypes",
query = "SELECT COUNT(t) FROM ContentType t " query = "SELECT COUNT(t) FROM ContentType t "
+ "WHERE t.contentSection = :section " + "WHERE t.contentSection = :section "
+ "AND " + "AND "
+ "(t IN (SELECT p.object FROM Permission p " + "(t IN (SELECT p.object FROM Permission p "
+ "WHERE p.grantedPrivilege = '" + "WHERE p.grantedPrivilege = '"
+ TypePrivileges.USE_TYPE + "' " + TypePrivileges.USE_TYPE + "' "
+ "AND p.grantee IN :roles) " + "AND p.grantee IN :roles) "
+ "OR true = :isSysAdmin)") + "OR true = :isSysAdmin)")
, ,
@NamedQuery( @NamedQuery(
name = "ContentSection.hasUsableContentTypes", name = "ContentSection.hasUsableContentTypes",
query = "SELECT (CASE WHEN COUNT(t) > 0 THEN true ELSE false END)" query = "SELECT (CASE WHEN COUNT(t) > 0 THEN true ELSE false END)"
+ "FROM ContentType t " + "FROM ContentType t "
+ "WHERE t.contentSection = :section " + "WHERE t.contentSection = :section "
+ "AND " + "AND "
+ "(t IN (SELECT p.object FROM Permission p " + "(t IN (SELECT p.object FROM Permission p "
+ "WHERE p.grantedPrivilege = '" + "WHERE p.grantedPrivilege = '"
+ TypePrivileges.USE_TYPE + "' " + TypePrivileges.USE_TYPE + "' "
+ "AND p.grantee IN :roles) " + "AND p.grantee IN :roles) "
+ "OR true = :isSysAdmin)") + "OR true = :isSysAdmin)")
, ,
@NamedQuery( @NamedQuery(
name = "ContentSection.findPermissions", name = "ContentSection.findPermissions",
query = "SELECT p FROM Permission p " query = "SELECT p FROM Permission p "
+ "WHERE (p.object = :section " + "WHERE (p.object = :section "
+ " OR p.object = :rootDocumentsFolder" + " OR p.object = :rootDocumentsFolder"
+ " OR p.object = :rootAssetsFolder) " + " OR p.object = :rootAssetsFolder) "
+ "AND p.grantee = :role") + "AND p.grantee = :role")
}) })
//@ApplicationType( //@ApplicationType(
@ -184,29 +184,29 @@ public class ContentSection extends CcmApplication implements Serializable {
@OneToMany @OneToMany
@JoinTable( @JoinTable(
name = "CONTENT_SECTION_LIFECYCLE_DEFINITIONS", name = "CONTENT_SECTION_LIFECYCLE_DEFINITIONS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "CONTENT_SECTION_ID") @JoinColumn(name = "CONTENT_SECTION_ID")
}, },
inverseJoinColumns = { inverseJoinColumns = {
@JoinColumn(name = "LIFECYCLE_DEFINITION_ID") @JoinColumn(name = "LIFECYCLE_DEFINITION_ID")
} }
) )
private List<LifecycleDefinition> lifecycleDefinitions = new ArrayList<>(); private List<LifecycleDefinition> lifecycleDefinitions = new ArrayList<>();
@OneToMany @OneToMany
@JoinTable( @JoinTable(
name = "CONTENT_SECTION_WORKFLOW_TEMPLATES", name = "CONTENT_SECTION_WORKFLOW_TEMPLATES",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "CONTENT_SECTION_ID") @JoinColumn(name = "CONTENT_SECTION_ID")
}, },
inverseJoinColumns = { inverseJoinColumns = {
@JoinColumn(name = "WORKFLOW_TEMPLATE_ID") @JoinColumn(name = "WORKFLOW_TEMPLATE_ID")
} }
) )
private List<WorkflowTemplate> workflowTemplates = new ArrayList<>(); private List<Workflow> workflowTemplates = new ArrayList<>();
public ContentSection() { public ContentSection() {
roles = new ArrayList<>(); roles = new ArrayList<>();
@ -326,7 +326,7 @@ public class ContentSection extends CcmApplication implements Serializable {
} }
protected void setLifecycleDefinitions( protected void setLifecycleDefinitions(
final List<LifecycleDefinition> lifecycleDefinitions) { final List<LifecycleDefinition> lifecycleDefinitions) {
this.lifecycleDefinitions = lifecycleDefinitions; this.lifecycleDefinitions = lifecycleDefinitions;
} }
@ -335,24 +335,28 @@ public class ContentSection extends CcmApplication implements Serializable {
} }
protected void removeLifecycleDefinition( protected void removeLifecycleDefinition(
final LifecycleDefinition definition) { final LifecycleDefinition definition) {
lifecycleDefinitions.remove(definition); lifecycleDefinitions.remove(definition);
} }
public List<WorkflowTemplate> getWorkflowTemplates() { public List<Workflow> getWorkflowTemplates() {
return Collections.unmodifiableList(workflowTemplates); return Collections.unmodifiableList(workflowTemplates);
} }
protected void setWorkflowTemplates( protected void setWorkflowTemplates(
final List<WorkflowTemplate> workflowTemplates) { final List<Workflow> workflowTemplates) {
this.workflowTemplates = workflowTemplates; this.workflowTemplates = workflowTemplates;
} }
protected void addWorkflowTemplate(final WorkflowTemplate template) { protected void addWorkflowTemplate(final Workflow template) {
if (!template.isAbstractWorkflow()) {
throw new IllegalArgumentException(
"The provided workflow is not an abstract workflow.");
}
workflowTemplates.add(template); workflowTemplates.add(template);
} }
protected void removeWorkflowTemplate(final WorkflowTemplate template) { protected void removeWorkflowTemplate(final Workflow template) {
workflowTemplates.remove(template); workflowTemplates.remove(template);
} }
@ -422,23 +426,23 @@ public class ContentSection extends CcmApplication implements Serializable {
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format( return super.toString(String.format(
", label = \"%s\", " ", label = \"%s\", "
+ "rootDocumentsFolder = \"%s\", " + "rootDocumentsFolder = \"%s\", "
+ "rootAssetsFolder = \"%s\", " + "rootAssetsFolder = \"%s\", "
+ "pageResolverClass = \"%s\", " + "pageResolverClass = \"%s\", "
+ "itemResolverClass = \"%s\", " + "itemResolverClass = \"%s\", "
+ "templateResolverClass = \"%s\", " + "templateResolverClass = \"%s\", "
+ "xmlGeneratorClass = \"%s\", " + "xmlGeneratorClass = \"%s\", "
+ "defaultLocale = \"%s\"%s", + "defaultLocale = \"%s\"%s",
label, label,
Objects.toString(rootDocumentsFolder), Objects.toString(rootDocumentsFolder),
Objects.toString(rootAssetsFolder), Objects.toString(rootAssetsFolder),
pageResolverClass, pageResolverClass,
itemResolverClass, itemResolverClass,
templateResolverClass, templateResolverClass,
xmlGeneratorClass, xmlGeneratorClass,
Objects.toString(defaultLocale), Objects.toString(defaultLocale),
data)); data));
} }
} }

View File

@ -30,7 +30,7 @@ import org.libreccm.security.PermissionManager;
import org.libreccm.security.RequiresPrivilege; import org.libreccm.security.RequiresPrivilege;
import org.libreccm.security.Role; import org.libreccm.security.Role;
import org.libreccm.security.RoleRepository; import org.libreccm.security.RoleRepository;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -54,6 +54,8 @@ import java.util.Optional;
import org.librecms.contentsection.privileges.TypePrivileges; import org.librecms.contentsection.privileges.TypePrivileges;
import org.librecms.dispatcher.ItemResolver; import org.librecms.dispatcher.ItemResolver;
import java.util.Objects;
import javax.enterprise.inject.Instance; import javax.enterprise.inject.Instance;
import static org.librecms.contentsection.ContentSection.*; import static org.librecms.contentsection.ContentSection.*;
@ -104,11 +106,11 @@ public class ContentSectionManager {
public ContentSection createContentSection(final String name) { public ContentSection createContentSection(final String name) {
if (name == null || name.isEmpty()) { if (name == null || name.isEmpty()) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"The name of a ContentSection can't be blank."); "The name of a ContentSection can't be blank.");
} }
final KernelConfig kernelConfig = confManager.findConfiguration( final KernelConfig kernelConfig = confManager.findConfiguration(
KernelConfig.class); KernelConfig.class);
final Locale defautLocale = kernelConfig.getDefaultLocale(); final Locale defautLocale = kernelConfig.getDefaultLocale();
final ContentSection section = new ContentSection(); final ContentSection section = new ContentSection();
@ -257,21 +259,21 @@ public class ContentSectionManager {
* {@link CmsConstants#AdminPrivileges.ADMINISTER_ROLES} for the provided * {@link CmsConstants#AdminPrivileges.ADMINISTER_ROLES} for the provided
* content section. * content section.
* *
* @param section The {@link ContentSection} to which the role is added. * @param section The {@link ContentSection} to which the role is added.
* @param roleName The name of the new role. * @param roleName The name of the new role.
* @param privileges The privileges of the new role. * @param privileges The privileges of the new role.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void addRoleToContentSection( public void addRoleToContentSection(
@RequiresPrivilege(AdminPrivileges.ADMINISTER_ROLES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_ROLES)
final ContentSection section, final ContentSection section,
final String roleName, final String roleName,
final String... privileges) { final String... privileges) {
if (section == null) { if (section == null) {
throw new IllegalArgumentException("Can't add a role to " throw new IllegalArgumentException("Can't add a role to "
+ "section null."); + "section null.");
} }
if (roleName == null || roleName.trim().isEmpty()) { if (roleName == null || roleName.trim().isEmpty()) {
@ -296,24 +298,24 @@ public class ContentSectionManager {
* requires {@link CmsConstants#AdminPrivileges.ADMINISTER_ROLES} for the * requires {@link CmsConstants#AdminPrivileges.ADMINISTER_ROLES} for the
* provided content section. * provided content section.
* *
* @param role The role to add. * @param role The role to add.
* @param section The section the role is associated with. * @param section The section the role is associated with.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void addRoleToContentSection( public void addRoleToContentSection(
final Role role, final Role role,
@RequiresPrivilege(AdminPrivileges.ADMINISTER_ROLES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_ROLES)
final ContentSection section) { final ContentSection section) {
if (section == null) { if (section == null) {
throw new IllegalArgumentException("Can't add a role to " throw new IllegalArgumentException("Can't add a role to "
+ "section null."); + "section null.");
} }
if (role == null) { if (role == null) {
throw new IllegalArgumentException("Can't add role null to a " throw new IllegalArgumentException("Can't add role null to a "
+ "content section."); + "content section.");
} }
section.addRole(role); section.addRole(role);
@ -329,18 +331,18 @@ public class ContentSectionManager {
* content section. * content section.
* *
* @param contentSection The section from which the role is removed. * @param contentSection The section from which the role is removed.
* @param role The role to remove from the content section. * @param role The role to remove from the content section.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void removeRoleFromContentSection( public void removeRoleFromContentSection(
@RequiresPrivilege(AdminPrivileges.ADMINISTER_ROLES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_ROLES)
final ContentSection contentSection, final ContentSection contentSection,
final Role role) { final Role role) {
if (contentSection == null) { if (contentSection == null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Can't remove role from ContentSection null"); "Can't remove role from ContentSection null");
} }
if (role == null) { if (role == null) {
@ -351,8 +353,8 @@ public class ContentSectionManager {
sectionRepo.save(contentSection); sectionRepo.save(contentSection);
final TypedQuery<Permission> query = entityManager final TypedQuery<Permission> query = entityManager
.createNamedQuery("ContentSection.findPermissions", .createNamedQuery("ContentSection.findPermissions",
Permission.class); Permission.class);
query.setParameter("section", contentSection); query.setParameter("section", contentSection);
query.setParameter("rootDocumentsFolder", query.setParameter("rootDocumentsFolder",
contentSection.getRootDocumentsFolder()); contentSection.getRootDocumentsFolder());
@ -370,14 +372,14 @@ public class ContentSectionManager {
* provided content section. * provided content section.
* *
* @param definition The lifecycle definition to add. * @param definition The lifecycle definition to add.
* @param section The section to which the definition is added. * @param section The section to which the definition is added.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void addLifecycleDefinitionToContentSection( public void addLifecycleDefinitionToContentSection(
final LifecycleDefinition definition, final LifecycleDefinition definition,
@RequiresPrivilege(AdminPrivileges.ADMINISTER_LIFECYLES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_LIFECYLES)
final ContentSection section) { final ContentSection section) {
section.addLifecycleDefinition(definition); section.addLifecycleDefinition(definition);
sectionRepo.save(section); sectionRepo.save(section);
@ -389,14 +391,14 @@ public class ContentSectionManager {
* the provided content section. * the provided content section.
* *
* @param definition The definition to remove. * @param definition The definition to remove.
* @param section The section from which the definition is removed. * @param section The section from which the definition is removed.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void removeLifecycleDefinitionFromContentSection( public void removeLifecycleDefinitionFromContentSection(
final LifecycleDefinition definition, final LifecycleDefinition definition,
@RequiresPrivilege(AdminPrivileges.ADMINISTER_LIFECYLES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_LIFECYLES)
final ContentSection section) { final ContentSection section) {
section.removeLifecycleDefinition(definition); section.removeLifecycleDefinition(definition);
sectionRepo.save(section); sectionRepo.save(section);
@ -408,14 +410,22 @@ public class ContentSectionManager {
* content section. * content section.
* *
* @param template The template to add. * @param template The template to add.
* @param section The content section to which the template is added. * @param section The content section to which the template is added.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void addWorkflowTemplateToContentSection( public void addWorkflowTemplateToContentSection(
final WorkflowTemplate template, final Workflow template,
@RequiresPrivilege(AdminPrivileges.ADMINISTER_WORKFLOW) @RequiresPrivilege(AdminPrivileges.ADMINISTER_WORKFLOW)
final ContentSection section) { final ContentSection section) {
Objects.requireNonNull(template);
Objects.requireNonNull(section);
if (!template.isAbstractWorkflow()) {
throw new IllegalArgumentException(
"The provided workflow is not abstract workflow.");
}
section.addWorkflowTemplate(template); section.addWorkflowTemplate(template);
sectionRepo.save(section); sectionRepo.save(section);
@ -427,14 +437,14 @@ public class ContentSectionManager {
* provided content section. * provided content section.
* *
* @param template The template to remove. * @param template The template to remove.
* @param section The section from which the template is removed. * @param section The section from which the template is removed.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void removeWorkflowTemplateFromContentSection( public void removeWorkflowTemplateFromContentSection(
final WorkflowTemplate template, final Workflow template,
@RequiresPrivilege(AdminPrivileges.ADMINISTER_WORKFLOW) @RequiresPrivilege(AdminPrivileges.ADMINISTER_WORKFLOW)
final ContentSection section) { final ContentSection section) {
section.removeWorkflowTemplate(template); section.removeWorkflowTemplate(template);
sectionRepo.save(section); sectionRepo.save(section);
@ -444,7 +454,7 @@ public class ContentSectionManager {
* Retrieves the {@link ItemResolver} for the provided content section. * Retrieves the {@link ItemResolver} for the provided content section.
* *
* @param section The section for which the {@link ItemResolver} is * @param section The section for which the {@link ItemResolver} is
* retrieved. * retrieved.
* *
* @return The {@link ItemResolver} for the provided content section. * @return The {@link ItemResolver} for the provided content section.
*/ */
@ -452,8 +462,8 @@ public class ContentSectionManager {
try { try {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Class<ItemResolver> itemResolverClazz final Class<ItemResolver> itemResolverClazz
= (Class<ItemResolver>) Class. = (Class<ItemResolver>) Class.
forName(section.getItemResolverClass()); forName(section.getItemResolverClass());
final Instance<ItemResolver> instance = itemResolvers.select( final Instance<ItemResolver> instance = itemResolvers.select(
itemResolverClazz); itemResolverClazz);
@ -476,72 +486,80 @@ public class ContentSectionManager {
* {@link CmsConstants#AdminPrivileges.ADMINISTER_CONTENT_TYPES} for the * {@link CmsConstants#AdminPrivileges.ADMINISTER_CONTENT_TYPES} for the
* provided content section. * provided content section.
* *
* @param type The type to add (a subclass of {@link ContentItem}. * @param type The type to add (a subclass of
* @param section The section to which the type is added. * {@link ContentItem}.
* @param section The section to which the type is added.
* @param defaultLifecycle The default lifecycle for items of the provided * @param defaultLifecycle The default lifecycle for items of the provided
* type in the provided content section. The lifecycle must be part of the * type in the provided content section. The
* provided section. Otherwise an {@link IllegalArgumentException} is * lifecycle must be part of the provided section.
* thrown. * Otherwise an {@link IllegalArgumentException} is
* @param defaultWorkflow The default workflow for items of the provided * thrown.
* type in the provided content section. The workflow must be part of the * @param defaultWorkflow The default workflow for items of the provided
* provided section. Otherwise an {@link IllegalArgumentException} is * type in the provided content section. The
* thrown. * workflow must be part of the provided section.
* Otherwise an {@link IllegalArgumentException} is
* thrown.
* *
* @return The new {@link ContentType} instance. * @return The new {@link ContentType} instance.
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public ContentType addContentTypeToSection( public ContentType addContentTypeToSection(
final Class<? extends ContentItem> type, final Class<? extends ContentItem> type,
@RequiresPrivilege(AdminPrivileges.ADMINISTER_CONTENT_TYPES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_CONTENT_TYPES)
final ContentSection section, final ContentSection section,
final LifecycleDefinition defaultLifecycle, final LifecycleDefinition defaultLifecycle,
final WorkflowTemplate defaultWorkflow) { final Workflow defaultWorkflow) {
if (type == null) { if (type == null) {
throw new IllegalArgumentException("Can't add null as content type " throw new IllegalArgumentException("Can't add null as content type "
+ "to a content section."); + "to a content section.");
} }
if (section == null) { if (section == null) {
throw new IllegalArgumentException("Can't add a content type" throw new IllegalArgumentException("Can't add a content type"
+ "to section null."); + "to section null.");
} }
if (defaultLifecycle == null) { if (defaultLifecycle == null) {
throw new IllegalArgumentException("Can't create a content type " throw new IllegalArgumentException("Can't create a content type "
+ "without a default lifecycle."); + "without a default lifecycle.");
} }
if (defaultWorkflow == null) { if (defaultWorkflow == null) {
throw new IllegalArgumentException("Can't create a content type " throw new IllegalArgumentException("Can't create a content type "
+ "without a default workflow."); + "without a default workflow.");
}
if (!defaultWorkflow.isAbstractWorkflow()) {
throw new IllegalArgumentException(
"The provided workflow is not an abstract workflow.");
} }
if (!section.getLifecycleDefinitions().contains(defaultLifecycle)) { if (!section.getLifecycleDefinitions().contains(defaultLifecycle)) {
final KernelConfig kernelConfig = confManager.findConfiguration( final KernelConfig kernelConfig = confManager.findConfiguration(
KernelConfig.class); KernelConfig.class);
final Locale defaultLocale = kernelConfig.getDefaultLocale(); final Locale defaultLocale = kernelConfig.getDefaultLocale();
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"The provided default lifecycle %d\"%s\" is not part of the" "The provided default lifecycle %d\"%s\" is not part of the"
+ "provided content section %d\"%s\".", + "provided content section %d\"%s\".",
defaultLifecycle.getDefinitionId(), defaultLifecycle.getDefinitionId(),
defaultLifecycle.getLabel().getValue(defaultLocale), defaultLifecycle.getLabel().getValue(defaultLocale),
section.getObjectId(), section.getObjectId(),
section.getDisplayName())); section.getDisplayName()));
} }
if (!section.getWorkflowTemplates().contains(defaultWorkflow)) { if (!section.getWorkflowTemplates().contains(defaultWorkflow)) {
final KernelConfig kernelConfig = confManager.findConfiguration( final KernelConfig kernelConfig = confManager.findConfiguration(
KernelConfig.class); KernelConfig.class);
final Locale defaultLocale = kernelConfig.getDefaultLocale(); final Locale defaultLocale = kernelConfig.getDefaultLocale();
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"The provided default workflow %d\"%s\" is not part of the" "The provided default workflow %d\"%s\" is not part of the"
+ "provided content section %d\"%s\".", + "provided content section %d\"%s\".",
defaultWorkflow.getWorkflowId(), defaultWorkflow.getWorkflowId(),
defaultWorkflow.getName().getValue(defaultLocale), defaultWorkflow.getName().getValue(defaultLocale),
section.getObjectId(), section.getObjectId(),
section.getDisplayName())); section.getDisplayName()));
} }
if (hasContentType(type, section)) { if (hasContentType(type, section)) {
@ -562,8 +580,8 @@ public class ContentSectionManager {
typeRepo.save(contentType); typeRepo.save(contentType);
section.getRoles().stream() section.getRoles().stream()
.forEach(role -> permissionManager.grantPrivilege( .forEach(role -> permissionManager.grantPrivilege(
TypePrivileges.USE_TYPE, role, contentType)); TypePrivileges.USE_TYPE, role, contentType));
return contentType; return contentType;
} }
@ -572,11 +590,11 @@ public class ContentSectionManager {
* Checks if a content section has a {@link ContentType} for a specific * Checks if a content section has a {@link ContentType} for a specific
* subclass {@link ContentItem}. * subclass {@link ContentItem}.
* *
* @param type The type to check for. * @param type The type to check for.
* @param section The section to check for the {@link ContentType}. * @param section The section to check for the {@link ContentType}.
* *
* @return {@code true} if the section has a {@link ContentType} for * @return {@code true} if the section has a {@link ContentType} for
* {@code type}, {@code false} if not. * {@code type}, {@code false} if not.
*/ */
public boolean hasContentType(final Class<? extends ContentItem> type, public boolean hasContentType(final Class<? extends ContentItem> type,
final ContentSection section) { final ContentSection section) {
@ -590,7 +608,7 @@ public class ContentSectionManager {
} }
final Optional<ContentType> result = typeRepo final Optional<ContentType> result = typeRepo
.findByContentSectionAndClass(section, type); .findByContentSectionAndClass(section, type);
return result.isPresent(); return result.isPresent();
} }
@ -601,20 +619,21 @@ public class ContentSectionManager {
* {@link CmsConstants#AdminPrivileges.ADMINISTER_CONTENT_TYPES} for the * {@link CmsConstants#AdminPrivileges.ADMINISTER_CONTENT_TYPES} for the
* provided content section. * provided content section.
* *
* @param type The type to remove from the section. * @param type The type to remove from the section.
* @param section The section from which the type is removed. * @param section The section from which the type is removed.
* *
* @throws IllegalArgumentException if the provided {@link ContentType} is * @throws IllegalArgumentException if the provided {@link ContentType} is
* in use or the parameters or otherwise illegal. * in use or the parameters or otherwise
* illegal.
* @see * @see
* ContentTypeRepository#delete(org.librecms.contentsection.ContentType) * ContentTypeRepository#delete(org.librecms.contentsection.ContentType)
*/ */
@AuthorizationRequired @AuthorizationRequired
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public void removeContentTypeFromSection( public void removeContentTypeFromSection(
final Class<? extends ContentItem> type, final Class<? extends ContentItem> type,
@RequiresPrivilege(AdminPrivileges.ADMINISTER_CONTENT_TYPES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_CONTENT_TYPES)
final ContentSection section) { final ContentSection section) {
if (type == null) { if (type == null) {
throw new IllegalArgumentException("Can't remove content type null."); throw new IllegalArgumentException("Can't remove content type null.");
@ -622,11 +641,11 @@ public class ContentSectionManager {
if (section == null) { if (section == null) {
throw new IllegalArgumentException("Can't remove a content type " throw new IllegalArgumentException("Can't remove a content type "
+ "from section null."); + "from section null.");
} }
final Optional<ContentType> contentType = typeRepo final Optional<ContentType> contentType = typeRepo
.findByContentSectionAndClass(section, type); .findByContentSectionAndClass(section, type);
if (!contentType.isPresent()) { if (!contentType.isPresent()) {
return; return;
@ -634,12 +653,12 @@ public class ContentSectionManager {
if (typeRepo.isContentTypeInUse(contentType.get())) { if (typeRepo.isContentTypeInUse(contentType.get())) {
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"ContentType %d:\"%s\" is used by content section %d:\"%s\" and " "ContentType %d:\"%s\" is used by content section %d:\"%s\" and "
+ "can't be deleted.", + "can't be deleted.",
contentType.get().getObjectId(), contentType.get().getObjectId(),
contentType.get().getDisplayName(), contentType.get().getDisplayName(),
section.getObjectId(), section.getObjectId(),
section.getDisplayName())); section.getDisplayName()));
} }
typeRepo.delete(contentType.get()); typeRepo.delete(contentType.get());

View File

@ -25,7 +25,7 @@ import static org.librecms.CmsConstants.*;
import org.libreccm.core.CcmObject; import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
import java.io.Serializable; import java.io.Serializable;
@ -117,7 +117,7 @@ public class ContentType extends CcmObject implements Serializable {
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "DEFAULT_WORKFLOW") @JoinColumn(name = "DEFAULT_WORKFLOW")
private WorkflowTemplate defaultWorkflow; private Workflow defaultWorkflow;
public ContentType() { public ContentType() {
super(); super();
@ -192,11 +192,15 @@ public class ContentType extends CcmObject implements Serializable {
this.defaultLifecycle = defaultLifecycle; this.defaultLifecycle = defaultLifecycle;
} }
public WorkflowTemplate getDefaultWorkflow() { public Workflow getDefaultWorkflow() {
return defaultWorkflow; return defaultWorkflow;
} }
protected void setDefaultWorkflow(final WorkflowTemplate defaultWorkflow) { protected void setDefaultWorkflow(final Workflow defaultWorkflow) {
if (!defaultWorkflow.isAbstractWorkflow()) {
throw new IllegalArgumentException(
"The provided workflow is not an abstract workflow.");
}
this.defaultWorkflow = defaultWorkflow; this.defaultWorkflow = defaultWorkflow;
} }

View File

@ -24,10 +24,12 @@ import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.PermissionManager; import org.libreccm.security.PermissionManager;
import org.libreccm.security.RequiresPrivilege; import org.libreccm.security.RequiresPrivilege;
import org.libreccm.security.Role; import org.libreccm.security.Role;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.privileges.AdminPrivileges; import org.librecms.contentsection.privileges.AdminPrivileges;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
import java.util.Objects;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional; import javax.transaction.Transactional;
@ -98,7 +100,7 @@ public class ContentTypeManager {
* Sets the default workflow to use for new items of a content type. * Sets the default workflow to use for new items of a content type.
* *
* @param type * @param type
* @param template The {@link WorkflowTemplate} for the workflow to use for * @param template The abstract {@link Workflow} for the workflow to use for
* new items of the provided {@code type}. * new items of the provided {@code type}.
*/ */
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
@ -106,7 +108,15 @@ public class ContentTypeManager {
public void setDefaultWorkflow( public void setDefaultWorkflow(
@RequiresPrivilege(AdminPrivileges.ADMINISTER_CONTENT_TYPES) @RequiresPrivilege(AdminPrivileges.ADMINISTER_CONTENT_TYPES)
final ContentType type, final ContentType type,
final WorkflowTemplate template) { final Workflow template) {
Objects.requireNonNull(type);
Objects.requireNonNull(template);
if (!template.isAbstractWorkflow()) {
throw new IllegalArgumentException(
"The provided workflow is not an abstract workflow.");
}
type.setDefaultWorkflow(template); type.setDefaultWorkflow(template);

View File

@ -22,7 +22,7 @@ import org.libreccm.categorization.Category;
import org.libreccm.categorization.Domain; import org.libreccm.categorization.Domain;
import org.libreccm.security.Role; import org.libreccm.security.Role;
import org.libreccm.web.CcmApplication; import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.librecms.contentsection.ContentSection; import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentType; import org.librecms.contentsection.ContentType;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
@ -66,7 +66,7 @@ public final class AdminPrivileges {
*/ */
public static final String ADMINISTER_ROLES = "administer_roles"; public static final String ADMINISTER_ROLES = "administer_roles";
/** /**
* Allows manipulation of the {@link WorkflowTemplate}s assigned to a * Allows manipulation of the (abstract) {@link Workflow}s assigned to a
* {@link ContentSection}. * {@link ContentSection}.
* *
* @see ContentSection#workflowTemplates * @see ContentSection#workflowTemplates

View File

@ -0,0 +1,17 @@
drop constraint FKrx08cdjm9tutrp5lvfhgslw48;
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FK1t85m4jehnhd6tyx5dtpavr15
foreign key (WORKFLOW_TEMPLATE_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CMS.CONTENT_TYPES
drop constraint if exists FKhnu9oikw8rpf22lt5fmk41t7k;
alter table CCM_CMS.CONTENT_TYPES
add constraint FKpgeccqsr50xwb268ypmfx0r66
foreign key (DEFAULT_WORKFLOW)
references CCM_CORE.WORKFLOWS;
alter table if exists FKeixdxau4jebw682gd49tdbsjy
drop constraint FKeixdxau4jebw682gd49tdbsjy;

View File

@ -0,0 +1,17 @@
drop constraint FKrx08cdjm9tutrp5lvfhgslw48;
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FK1t85m4jehnhd6tyx5dtpavr15
foreign key (WORKFLOW_TEMPLATE_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CMS.CONTENT_TYPES
drop constraint if exists FKhnu9oikw8rpf22lt5fmk41t7k;
alter table CCM_CMS.CONTENT_TYPES
add constraint FKpgeccqsr50xwb268ypmfx0r66
foreign key (DEFAULT_WORKFLOW)
references CCM_CORE.WORKFLOWS;
alter table if exists FKeixdxau4jebw682gd49tdbsjy
drop constraint FKeixdxau4jebw682gd49tdbsjy;

View File

@ -23,6 +23,7 @@ import java.util.Optional;
import static org.libreccm.testutils.DependenciesHelpers.*; import static org.libreccm.testutils.DependenciesHelpers.*;
import org.apache.shiro.subject.ExecutionException;
import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException; import org.jboss.arquillian.container.test.api.ShouldThrowException;
import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.junit.Arquillian;
@ -51,10 +52,13 @@ import java.util.Locale;
import javax.activation.MimeType; import javax.activation.MimeType;
import javax.activation.MimeTypeParseException; import javax.activation.MimeTypeParseException;
import org.jboss.arquillian.persistence.CleanupUsingScript; import org.jboss.arquillian.persistence.CleanupUsingScript;
import org.librecms.assets.FileAsset; import org.librecms.assets.FileAsset;
import java.util.concurrent.Callable;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -212,19 +216,24 @@ public class AssetManagerTest {
"timestamp", "timestamp",
"uuid"}) "uuid"})
public void shareAsset() throws MimeTypeParseException { public void shareAsset() throws MimeTypeParseException {
final Folder folder = folderRepo.findById(-420L).get();
assertThat(folder, is(not(nullValue())));
final FileAsset file = new FileAsset(); shiro.getSystemUser().execute(() -> {
file.setDisplayName("datasheet.pdf"); final Folder folder = folderRepo.findById(-420L).get();
file.setFileName("datasheet.pdf"); assertThat(folder, is(not(nullValue())));
file.setMimeType(new MimeType("application/pdf"));
file.getTitle().addValue(Locale.ENGLISH, "datasheet.pdf");
assetRepo.save(file);
assetManager.shareAsset(file, folder); final FileAsset file = new FileAsset();
file.setDisplayName("datasheet.pdf");
file.setFileName("datasheet.pdf");
file.setMimeType(new MimeType("application/pdf"));
file.getTitle().addValue(Locale.ENGLISH, "datasheet.pdf");
assetRepo.save(file);
assetManager.shareAsset(file, folder);
assertThat(file.getDisplayName(), is(equalTo("datasheet.pdf")));
return null;
});
assertThat(file.getDisplayName(), is(equalTo("datasheet.pdf")));
} }
/** /**
@ -241,9 +250,12 @@ public class AssetManagerTest {
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void shareAssetNull() { public void shareAssetNull() {
final Folder folder = folderRepo.findById(-420L).get();
assetManager.shareAsset(null, folder); shiro.getSystemUser().execute(() -> {
final Folder folder = folderRepo.findById(-420L).get();
assetManager.shareAsset(null, folder);
});
} }
/** /**
@ -261,13 +273,22 @@ public class AssetManagerTest {
@ShouldMatchDataSet( @ShouldMatchDataSet(
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void shareAssetFolderIsNull() throws MimeTypeParseException { public void shareAssetFolderIsNull() throws Throwable {
final FileAsset file = new FileAsset();
file.setDisplayName("datasheet.pdf");
file.setFileName("datasheet.pdf");
file.setMimeType(new MimeType("application/pdf"));
assetManager.shareAsset(file, null); try {
shiro.getSystemUser().execute(() -> {
final FileAsset file = new FileAsset();
file.setDisplayName("datasheet.pdf");
file.setFileName("datasheet.pdf");
file.setMimeType(new MimeType("application/pdf"));
assetManager.shareAsset(file, null);
return null;
});
} catch (ExecutionException ex) {
//We need the original exception
throw ex.getCause();
}
} }
/** /**
@ -284,11 +305,14 @@ public class AssetManagerTest {
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void shareAlreadySharedAsset() { public void shareAlreadySharedAsset() {
final Folder folder = folderRepo.findById(-420L).get();
final Asset asset = assetRepo.findById(-700L).get(); shiro.getSystemUser().execute(() -> {
final Folder folder = folderRepo.findById(-420L).get();
assetManager.shareAsset(asset, folder); final Asset asset = assetRepo.findById(-700L).get();
assetManager.shareAsset(asset, folder);
});
} }
/** /**
@ -304,7 +328,9 @@ public class AssetManagerTest {
+ "after-clean-orphaned.xml", + "after-clean-orphaned.xml",
excludeColumns = {"timestamp", "object_order"}) excludeColumns = {"timestamp", "object_order"})
public void cleanOrphanedAssets() { public void cleanOrphanedAssets() {
assetManager.cleanOrphanedAssets(); shiro.getSystemUser().execute(() -> {
assetManager.cleanOrphanedAssets();
});
} }
/** /**
@ -324,11 +350,17 @@ public class AssetManagerTest {
"object_order", "object_order",
"uuid"}) "uuid"})
public void moveAssetToOtherFolder() { public void moveAssetToOtherFolder() {
final Asset asset = assetRepo.findById(-900L).get();
final Folder folder = folderRepo.findById(-410L).get(); shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-900L).get();
assetManager.move(asset, folder); shiro.getSystemUser().execute(() -> {
final Folder folder = folderRepo.findById(-410L).get();
assetManager.move(asset, folder);
});
return null;
});
} }
/** /**
@ -348,11 +380,14 @@ public class AssetManagerTest {
"object_order", "object_order",
"uuid"}) "uuid"})
public void moveAssetToFolderInOtherContentSection() { public void moveAssetToFolderInOtherContentSection() {
final Asset asset = assetRepo.findById(-900L).get();
final Folder folder = folderRepo.findById(-1600L).get(); shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-900L).get();
assetManager.move(asset, folder); final Folder folder = folderRepo.findById(-1600L).get();
assetManager.move(asset, folder);
});
} }
/** /**
@ -371,9 +406,11 @@ public class AssetManagerTest {
public void moveAssetNull() { public void moveAssetNull() {
final Asset asset = null; final Asset asset = null;
final Folder folder = folderRepo.findById(-410L).get(); shiro.getSystemUser().execute(() -> {
final Folder folder = folderRepo.findById(-410L).get();
assetManager.move(asset, folder); assetManager.move(asset, folder);
});
} }
/** /**
@ -390,11 +427,14 @@ public class AssetManagerTest {
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void moveAssetTargetFolderIsNull() { public void moveAssetTargetFolderIsNull() {
final Asset asset = assetRepo.findById(-900L).get();
final Folder targetFolder = null; shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-900L).get();
assetManager.move(asset, targetFolder); final Folder targetFolder = null;
assetManager.move(asset, targetFolder);
});
} }
/** /**
@ -411,11 +451,14 @@ public class AssetManagerTest {
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void moveAssetTargetFolderIsNotAssetFolder() { public void moveAssetTargetFolderIsNotAssetFolder() {
final Asset asset = assetRepo.findById(-900L).get();
final Folder folder = folderRepo.findById(-200L).get(); shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-900L).get();
assetManager.move(asset, folder); final Folder folder = folderRepo.findById(-200L).get();
assetManager.move(asset, folder);
});
} }
/** /**
@ -438,11 +481,14 @@ public class AssetManagerTest {
"categorization_id", "categorization_id",
"object_order"}) "object_order"})
public void copyAssetToOtherFolder() { public void copyAssetToOtherFolder() {
final Asset asset = assetRepo.findById(-1100L).get();
final Folder targetFolder = folderRepo.findById(-400L).get(); shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-1100L).get();
assetManager.copy(asset, targetFolder); final Folder targetFolder = folderRepo.findById(-400L).get();
assetManager.copy(asset, targetFolder);
});
} }
/** /**
@ -496,11 +542,14 @@ public class AssetManagerTest {
"categorization_id", "categorization_id",
"object_order"}) "object_order"})
public void copyAssetToOtherContentSection() { public void copyAssetToOtherContentSection() {
final Asset asset = assetRepo.findById(-1100L).get();
final Folder targetFolder = folderRepo.findById(-1600L).get(); shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-1100L).get();
assetManager.copy(asset, targetFolder); final Folder targetFolder = folderRepo.findById(-1600L).get();
assetManager.copy(asset, targetFolder);
});
} }
/** /**
@ -517,11 +566,14 @@ public class AssetManagerTest {
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void copyAssetNull() { public void copyAssetNull() {
final Asset asset = null;
final Folder targetFolder = folderRepo.findById(-420L).get(); shiro.getSystemUser().execute(() -> {
final Asset asset = null;
assetManager.copy(asset, targetFolder); final Folder targetFolder = folderRepo.findById(-420L).get();
assetManager.copy(asset, targetFolder);
});
} }
/** /**
@ -538,11 +590,14 @@ public class AssetManagerTest {
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void copyAssetTargetFolderIsNull() { public void copyAssetTargetFolderIsNull() {
final Asset asset = assetRepo.findById(-1100L).get();
final Folder targetFolder = null; shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-1100L).get();
assetManager.copy(asset, targetFolder); final Folder targetFolder = null;
assetManager.copy(asset, targetFolder);
});
} }
/** /**
@ -559,11 +614,14 @@ public class AssetManagerTest {
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
public void copyAssetTargetFolderIsNotAssetFolder() { public void copyAssetTargetFolderIsNotAssetFolder() {
final Asset asset = assetRepo.findById(-1100L).get();
final Folder targetFolder = folderRepo.findById(-200L).get(); shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-1100L).get();
assetManager.copy(asset, targetFolder); final Folder targetFolder = folderRepo.findById(-200L).get();
assetManager.copy(asset, targetFolder);
});
} }
/** /**
@ -578,17 +636,22 @@ public class AssetManagerTest {
@ShouldMatchDataSet( @ShouldMatchDataSet(
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
public void verifyIsAssetInUse() { public void verifyIsAssetInUse() {
final Asset header = assetRepo.findById(-700L).get();
final Asset phb = assetRepo.findById(-800L).get();
final Asset servicesHeader = assetRepo.findById(-900L).get();
final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
assertThat(assetManager.isAssetInUse(header), is(true)); shiro.getSystemUser().execute(() -> {
assertThat(assetManager.isAssetInUse(phb), is(false)); final Asset header = assetRepo.findById(-700L).get();
assertThat(assetManager.isAssetInUse(servicesHeader), is(true)); final Asset phb = assetRepo.findById(-800L).get();
assertThat(assetManager.isAssetInUse(product1Datasheet), is(true)); final Asset servicesHeader = assetRepo.findById(-900L).get();
assertThat(assetManager.isAssetInUse(catalog), is(true)); final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
assertThat(assetManager.isAssetInUse(header), is(true));
assertThat(assetManager.isAssetInUse(phb), is(false));
assertThat(assetManager.isAssetInUse(servicesHeader), is(true));
assertThat(assetManager.isAssetInUse(product1Datasheet), is(true));
assertThat(assetManager.isAssetInUse(catalog), is(true));
return null;
});
} }
/** /**
@ -603,22 +666,25 @@ public class AssetManagerTest {
@ShouldMatchDataSet( @ShouldMatchDataSet(
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
public void verifyGetAssetPathWithoutContentSection() { public void verifyGetAssetPathWithoutContentSection() {
final Asset header = assetRepo.findById(-700L).get();
final Asset phb = assetRepo.findById(-800L).get();
final Asset servicesHeader = assetRepo.findById(-900L).get();
final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
assertThat(assetManager.getAssetPath(header), shiro.getSystemUser().execute(() -> {
is(equalTo("/media/images/header.png"))); final Asset header = assetRepo.findById(-700L).get();
assertThat(assetManager.getAssetPath(phb), final Asset phb = assetRepo.findById(-800L).get();
is(equalTo("/media/images/the-phb.png"))); final Asset servicesHeader = assetRepo.findById(-900L).get();
assertThat(assetManager.getAssetPath(servicesHeader), final Asset product1Datasheet = assetRepo.findById(-1000L).get();
is(equalTo("/media/services-header.png"))); final Asset catalog = assetRepo.findById(-1100L).get();
assertThat(assetManager.getAssetPath(product1Datasheet),
is(equalTo(""))); assertThat(assetManager.getAssetPath(header),
assertThat(assetManager.getAssetPath(catalog), is(equalTo("/media/images/header.png")));
is(equalTo("/media/downloads/catalog.pdf"))); assertThat(assetManager.getAssetPath(phb),
is(equalTo("/media/images/the-phb.png")));
assertThat(assetManager.getAssetPath(servicesHeader),
is(equalTo("/media/services-header.png")));
assertThat(assetManager.getAssetPath(product1Datasheet),
is(equalTo("")));
assertThat(assetManager.getAssetPath(catalog),
is(equalTo("/media/downloads/catalog.pdf")));
});
} }
/** /**
@ -633,22 +699,25 @@ public class AssetManagerTest {
@ShouldMatchDataSet( @ShouldMatchDataSet(
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
public void verifyGetAssetPathWithContentSection() { public void verifyGetAssetPathWithContentSection() {
final Asset header = assetRepo.findById(-700L).get();
final Asset phb = assetRepo.findById(-800L).get();
final Asset servicesHeader = assetRepo.findById(-900L).get();
final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
assertThat(assetManager.getAssetPath(header, true), shiro.getSystemUser().execute(() -> {
is(equalTo("info:/media/images/header.png"))); final Asset header = assetRepo.findById(-700L).get();
assertThat(assetManager.getAssetPath(phb, true), final Asset phb = assetRepo.findById(-800L).get();
is(equalTo("info:/media/images/the-phb.png"))); final Asset servicesHeader = assetRepo.findById(-900L).get();
assertThat(assetManager.getAssetPath(servicesHeader, true), final Asset product1Datasheet = assetRepo.findById(-1000L).get();
is(equalTo("info:/media/services-header.png"))); final Asset catalog = assetRepo.findById(-1100L).get();
assertThat(assetManager.getAssetPath(product1Datasheet, true),
is(equalTo(""))); assertThat(assetManager.getAssetPath(header, true),
assertThat(assetManager.getAssetPath(catalog, true), is(equalTo("info:/media/images/header.png")));
is(equalTo("info:/media/downloads/catalog.pdf"))); assertThat(assetManager.getAssetPath(phb, true),
is(equalTo("info:/media/images/the-phb.png")));
assertThat(assetManager.getAssetPath(servicesHeader, true),
is(equalTo("info:/media/services-header.png")));
assertThat(assetManager.getAssetPath(product1Datasheet, true),
is(equalTo("")));
assertThat(assetManager.getAssetPath(catalog, true),
is(equalTo("info:/media/downloads/catalog.pdf")));
});
} }
/** /**
@ -663,37 +732,40 @@ public class AssetManagerTest {
@ShouldMatchDataSet( @ShouldMatchDataSet(
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
public void verifyGetAssetFolder() { public void verifyGetAssetFolder() {
final Asset header = assetRepo.findById(-700L).get();
final Asset phb = assetRepo.findById(-800L).get();
final Asset servicesHeader = assetRepo.findById(-900L).get();
final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
final Folder media = folderRepo.findById(-400L).get(); shiro.getSystemUser().execute(() -> {
final Folder images = folderRepo.findById(-410L).get(); final Asset header = assetRepo.findById(-700L).get();
final Folder downloads = folderRepo.findById(-420L).get(); final Asset phb = assetRepo.findById(-800L).get();
final Asset servicesHeader = assetRepo.findById(-900L).get();
final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
final Optional<Folder> headerFolder = assetManager final Folder media = folderRepo.findById(-400L).get();
.getAssetFolder(header); final Folder images = folderRepo.findById(-410L).get();
final Optional<Folder> phbFolder = assetManager final Folder downloads = folderRepo.findById(-420L).get();
.getAssetFolder(phb);
final Optional<Folder> servicesHeaderFolder = assetManager
.getAssetFolder(servicesHeader);
final Optional<Folder> product1DatasheetFolder = assetManager
.getAssetFolder(product1Datasheet);
final Optional<Folder> catalogFolder = assetManager
.getAssetFolder(catalog);
assertThat(headerFolder.isPresent(), is(true)); final Optional<Folder> headerFolder = assetManager
assertThat(phbFolder.isPresent(), is(true)); .getAssetFolder(header);
assertThat(servicesHeaderFolder.isPresent(), is(true)); final Optional<Folder> phbFolder = assetManager
assertThat(product1DatasheetFolder.isPresent(), is(false)); .getAssetFolder(phb);
assertThat(catalogFolder.isPresent(), is(true)); final Optional<Folder> servicesHeaderFolder = assetManager
.getAssetFolder(servicesHeader);
final Optional<Folder> product1DatasheetFolder = assetManager
.getAssetFolder(product1Datasheet);
final Optional<Folder> catalogFolder = assetManager
.getAssetFolder(catalog);
assertThat(headerFolder.get(), is(equalTo(images))); assertThat(headerFolder.isPresent(), is(true));
assertThat(phbFolder.get(), is(equalTo(images))); assertThat(phbFolder.isPresent(), is(true));
assertThat(servicesHeaderFolder.get(), is(equalTo(media))); assertThat(servicesHeaderFolder.isPresent(), is(true));
assertThat(catalogFolder.get(), is(equalTo(downloads))); assertThat(product1DatasheetFolder.isPresent(), is(false));
assertThat(catalogFolder.isPresent(), is(true));
assertThat(headerFolder.get(), is(equalTo(images)));
assertThat(phbFolder.get(), is(equalTo(images)));
assertThat(servicesHeaderFolder.get(), is(equalTo(media)));
assertThat(catalogFolder.get(), is(equalTo(downloads)));
});
} }
/** /**
@ -708,58 +780,63 @@ public class AssetManagerTest {
@ShouldMatchDataSet( @ShouldMatchDataSet(
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml") "datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
public void verifyGetAssetFolders() { public void verifyGetAssetFolders() {
final Asset header = assetRepo.findById(-700L).get();
final Asset phb = assetRepo.findById(-800L).get();
final Asset servicesHeader = assetRepo.findById(-900L).get();
final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
final Folder infoAssets = folderRepo.findById(-300L).get(); shiro.getSystemUser().execute(() -> {
final Folder media = folderRepo.findById(-400L).get(); final Asset header = assetRepo.findById(-700L).get();
final Folder images = folderRepo.findById(-410L).get(); final Asset phb = assetRepo.findById(-800L).get();
final Folder downloads = folderRepo.findById(-420L).get(); final Asset servicesHeader = assetRepo.findById(-900L).get();
final Asset product1Datasheet = assetRepo.findById(-1000L).get();
final Asset catalog = assetRepo.findById(-1100L).get();
final List<Folder> headerFolders = assetManager.getAssetFolders(header); final Folder infoAssets = folderRepo.findById(-300L).get();
final List<Folder> phbFolders = assetManager.getAssetFolders(phb); final Folder media = folderRepo.findById(-400L).get();
final List<Folder> servicesHeaderFolders = assetManager.getAssetFolders( final Folder images = folderRepo.findById(-410L).get();
servicesHeader); final Folder downloads = folderRepo.findById(-420L).get();
final List<Folder> product1DatasheetFolders = assetManager.
getAssetFolders(product1Datasheet);
final List<Folder> catalogFolders = assetManager.
getAssetFolders(catalog);
assertThat(headerFolders, is(not(nullValue()))); final List<Folder> headerFolders = assetManager.getAssetFolders(
assertThat(phbFolders, is(not(nullValue()))); header);
assertThat(servicesHeaderFolders, is(not(nullValue()))); final List<Folder> phbFolders = assetManager.getAssetFolders(phb);
assertThat(product1DatasheetFolders, is(not(nullValue()))); final List<Folder> servicesHeaderFolders = assetManager
assertThat(catalogFolders, is(not(nullValue()))); .getAssetFolders(
servicesHeader);
final List<Folder> product1DatasheetFolders = assetManager.
getAssetFolders(product1Datasheet);
final List<Folder> catalogFolders = assetManager.
getAssetFolders(catalog);
assertThat(headerFolders.isEmpty(), is(false)); assertThat(headerFolders, is(not(nullValue())));
assertThat(phbFolders.isEmpty(), is(false)); assertThat(phbFolders, is(not(nullValue())));
assertThat(servicesHeaderFolders.isEmpty(), is(false)); assertThat(servicesHeaderFolders, is(not(nullValue())));
assertThat(product1DatasheetFolders.isEmpty(), is(true)); assertThat(product1DatasheetFolders, is(not(nullValue())));
assertThat(catalogFolders.isEmpty(), is(false)); assertThat(catalogFolders, is(not(nullValue())));
assertThat(headerFolders.size(), is(3)); assertThat(headerFolders.isEmpty(), is(false));
assertThat(phbFolders.size(), is(3)); assertThat(phbFolders.isEmpty(), is(false));
assertThat(servicesHeaderFolders.size(), is(2)); assertThat(servicesHeaderFolders.isEmpty(), is(false));
assertThat(product1DatasheetFolders.size(), is(0)); assertThat(product1DatasheetFolders.isEmpty(), is(true));
assertThat(catalogFolders.size(), is(3)); assertThat(catalogFolders.isEmpty(), is(false));
assertThat(headerFolders.get(0), is(equalTo(infoAssets))); assertThat(headerFolders.size(), is(3));
assertThat(headerFolders.get(1), is(equalTo(media))); assertThat(phbFolders.size(), is(3));
assertThat(headerFolders.get(2), is(equalTo(images))); assertThat(servicesHeaderFolders.size(), is(2));
assertThat(product1DatasheetFolders.size(), is(0));
assertThat(catalogFolders.size(), is(3));
assertThat(phbFolders.get(0), is(equalTo(infoAssets))); assertThat(headerFolders.get(0), is(equalTo(infoAssets)));
assertThat(phbFolders.get(1), is(equalTo(media))); assertThat(headerFolders.get(1), is(equalTo(media)));
assertThat(phbFolders.get(2), is(equalTo(images))); assertThat(headerFolders.get(2), is(equalTo(images)));
assertThat(servicesHeaderFolders.get(0), is(equalTo(infoAssets))); assertThat(phbFolders.get(0), is(equalTo(infoAssets)));
assertThat(servicesHeaderFolders.get(1), is(equalTo(media))); assertThat(phbFolders.get(1), is(equalTo(media)));
assertThat(phbFolders.get(2), is(equalTo(images)));
assertThat(catalogFolders.get(0), is(equalTo(infoAssets))); assertThat(servicesHeaderFolders.get(0), is(equalTo(infoAssets)));
assertThat(catalogFolders.get(1), is(equalTo(media))); assertThat(servicesHeaderFolders.get(1), is(equalTo(media)));
assertThat(catalogFolders.get(2), is(equalTo(downloads)));
assertThat(catalogFolders.get(0), is(equalTo(infoAssets)));
assertThat(catalogFolders.get(1), is(equalTo(media)));
assertThat(catalogFolders.get(2), is(equalTo(downloads)));
});
} }

View File

@ -20,6 +20,7 @@ package org.librecms.contentsection;
import static org.libreccm.testutils.DependenciesHelpers.*; import static org.libreccm.testutils.DependenciesHelpers.*;
import org.apache.shiro.subject.ExecutionException;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException; import org.jboss.arquillian.container.test.api.ShouldThrowException;
@ -56,6 +57,8 @@ import org.librecms.assets.Image;
import org.librecms.assets.VideoAsset; import org.librecms.assets.VideoAsset;
import org.librecms.contentsection.rs.Assets; import org.librecms.contentsection.rs.Assets;
import java.util.concurrent.Callable;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -202,15 +205,19 @@ public class AssetRepositoryTest {
excludeColumns = {"timestamp", "object_order"} excludeColumns = {"timestamp", "object_order"}
) )
public void deleteUnusedAsset() { public void deleteUnusedAsset() {
final Asset asset = assetRepo.findById(-800L).get();
assetRepo.delete(asset); shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-800L).get();
assetRepo.delete(asset);
});
} }
/** /**
* Verifies that an {@link Asset} which is associated to at least one * Verifies that an {@link Asset} which is associated to at least one
* {@link ContentItem} can't be deleted by using * {@link ContentItem} can't be deleted by using
* {@link AssetRepository#delete(org.librecms.assets.Asset)}. * {@link AssetRepository#delete(org.librecms.assets.Asset)}.
* @throws java.lang.Throwable
*/ */
@Test(expected = AssetInUseException.class) @Test(expected = AssetInUseException.class)
@InSequence(110) @InSequence(110)
@ -220,10 +227,18 @@ public class AssetRepositoryTest {
"datasets/org/librecms/contentsection/AssetRepositoryTest/" "datasets/org/librecms/contentsection/AssetRepositoryTest/"
+ "data.xml") + "data.xml")
@ShouldThrowException(AssetInUseException.class) @ShouldThrowException(AssetInUseException.class)
public void deleteUsedAsset() { public void deleteUsedAsset() throws Throwable {
final Asset asset = assetRepo.findById(-700L).get();
assetRepo.delete(asset); try {
shiro.getSystemUser().execute(() -> {
final Asset asset = assetRepo.findById(-700L).get();
assetRepo.delete(asset);
return null;
});
} catch (ExecutionException ex) {
throw ex.getCause();
}
} }
/** /**
@ -234,6 +249,7 @@ public class AssetRepositoryTest {
@InSequence(200) @InSequence(200)
@UsingDataSet( @UsingDataSet(
"datasets/org/librecms/contentsection/AssetRepositoryTest/data.xml") "datasets/org/librecms/contentsection/AssetRepositoryTest/data.xml")
public void findAssetByUuid() { public void findAssetByUuid() {
final Optional<Asset> header = shiro final Optional<Asset> header = shiro
@ -342,7 +358,6 @@ public class AssetRepositoryTest {
is(equalTo("services-header.png"))); is(equalTo("services-header.png")));
assertThat(images.get(2).getDisplayName(), is(equalTo("the-phb.png"))); assertThat(images.get(2).getDisplayName(), is(equalTo("the-phb.png")));
assertThat(files.get(0).getDisplayName(), is(equalTo("catalog.pdf"))); assertThat(files.get(0).getDisplayName(), is(equalTo("catalog.pdf")));
assertThat(files.get(1).getDisplayName(), assertThat(files.get(1).getDisplayName(),
is(equalTo("product1-datasheet.pdf"))); is(equalTo("product1-datasheet.pdf")));

View File

@ -39,8 +39,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.libreccm.security.Shiro; import org.libreccm.security.Shiro;
import org.libreccm.tests.categories.IntegrationTest; import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.workflow.WorkflowTemplate;
import org.libreccm.workflow.WorkflowTemplateRepository;
import org.librecms.contenttypes.Article; import org.librecms.contenttypes.Article;
import org.librecms.contenttypes.Event; import org.librecms.contenttypes.Event;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
@ -52,6 +50,7 @@ import java.util.Optional;
import javax.inject.Inject; import javax.inject.Inject;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import org.jboss.arquillian.persistence.CleanupUsingScript; import org.jboss.arquillian.persistence.CleanupUsingScript;
import org.jboss.arquillian.persistence.TestExecutionPhase; import org.jboss.arquillian.persistence.TestExecutionPhase;
@ -60,6 +59,9 @@ import static org.junit.Assert.*;
import static org.libreccm.testutils.DependenciesHelpers.*; import static org.libreccm.testutils.DependenciesHelpers.*;
import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowRepository;
/** /**
* Tests for the {@link ContentItemManager}. * Tests for the {@link ContentItemManager}.
* *
@ -90,7 +92,7 @@ public class ContentItemManagerTest {
private Shiro shiro; private Shiro shiro;
@Inject @Inject
private WorkflowTemplateRepository workflowTemplateRepo; private WorkflowRepository workflowRepo;
@Inject @Inject
private LifecycleDefinitionRepository lifecycleDefinitionRepo; private LifecycleDefinitionRepository lifecycleDefinitionRepo;
@ -194,7 +196,7 @@ public class ContentItemManagerTest {
assertThat(itemManager, is(not(nullValue()))); assertThat(itemManager, is(not(nullValue())));
assertThat(folderRepo, is(not(nullValue()))); assertThat(folderRepo, is(not(nullValue())));
assertThat(shiro, is(not(nullValue()))); assertThat(shiro, is(not(nullValue())));
assertThat(workflowTemplateRepo, is(not(nullValue()))); assertThat(workflowRepo, is(not(nullValue())));
assertThat(lifecycleDefinitionRepo, is(not(nullValue()))); assertThat(lifecycleDefinitionRepo, is(not(nullValue())));
assertThat(entityManager, is(not(nullValue()))); assertThat(entityManager, is(not(nullValue())));
} }
@ -418,8 +420,9 @@ public class ContentItemManagerTest {
.get(); .get();
final Folder folder = section.getRootDocumentsFolder(); final Folder folder = section.getRootDocumentsFolder();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-110L).get(); .findById(-110L)
.get();
final Article article = itemManager.createContentItem( final Article article = itemManager.createContentItem(
"new-article", "new-article",
@ -466,8 +469,9 @@ public class ContentItemManagerTest {
.get(); .get();
final Folder folder = section.getRootDocumentsFolder(); final Folder folder = section.getRootDocumentsFolder();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-110L).get(); .findById(-110L)
.get();
itemManager.createContentItem("Test", itemManager.createContentItem("Test",
section, section,
@ -499,8 +503,9 @@ public class ContentItemManagerTest {
.get(); .get();
final Folder folder = section.getRootDocumentsFolder(); final Folder folder = section.getRootDocumentsFolder();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-110L).get(); .findById(-110L)
.get();
itemManager.createContentItem(null, itemManager.createContentItem(null,
section, section,
@ -561,8 +566,9 @@ public class ContentItemManagerTest {
.findByLabel("info") .findByLabel("info")
.get(); .get();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-110L).get(); .findById(-110L)
.get();
itemManager.createContentItem("Test", itemManager.createContentItem("Test",
section, section,

View File

@ -152,11 +152,11 @@ public class ContentItemPermissionTest {
.addClass(org.libreccm.workflow.TaskComment.class) .addClass(org.libreccm.workflow.TaskComment.class)
.addClass(org.libreccm.workflow.TaskState.class) .addClass(org.libreccm.workflow.TaskState.class)
.addClass(org.libreccm.workflow.Workflow.class) .addClass(org.libreccm.workflow.Workflow.class)
.addClass(org.libreccm.workflow.AbstractWorkflowException.class)
//Classes required by org.libreccm.categorization.Category //Classes required by org.libreccm.categorization.Category
.addClass(org.libreccm.security.RecursivePermissions.class) .addClass(org.libreccm.security.RecursivePermissions.class)
//Classes required by org.libreccm.workflow.Workflow.class //Classes required by org.libreccm.workflow.Workflow.class
.addClass(org.libreccm.workflow.WorkflowState.class) .addClass(org.libreccm.workflow.WorkflowState.class)
.addClass(org.libreccm.workflow.WorkflowTemplate.class)
//Classes required by org.librecms.contentsection.ContentItem //Classes required by org.librecms.contentsection.ContentItem
.addClass(org.librecms.contentsection.AttachmentList.class) .addClass(org.librecms.contentsection.AttachmentList.class)
.addClass(org.librecms.contentsection.ContentItemVersion.class) .addClass(org.librecms.contentsection.ContentItemVersion.class)

View File

@ -57,8 +57,8 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
import org.jboss.arquillian.container.test.api.ShouldThrowException; import org.jboss.arquillian.container.test.api.ShouldThrowException;
import org.jboss.arquillian.persistence.CleanupUsingScript; import org.jboss.arquillian.persistence.CleanupUsingScript;
import org.jboss.arquillian.persistence.TestExecutionPhase; import org.jboss.arquillian.persistence.TestExecutionPhase;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowTemplateRepository; import org.libreccm.workflow.WorkflowRepository;
import org.librecms.contentsection.privileges.ItemPrivileges; import org.librecms.contentsection.privileges.ItemPrivileges;
import org.librecms.contenttypes.Article; import org.librecms.contenttypes.Article;
import org.librecms.contenttypes.Event; import org.librecms.contenttypes.Event;
@ -102,7 +102,7 @@ public class ContentSectionManagerTest {
private LifecycleDefinitionRepository lifecycleDefRepo; private LifecycleDefinitionRepository lifecycleDefRepo;
@Inject @Inject
private WorkflowTemplateRepository workflowTemplateRepo; private WorkflowRepository workflowRepo;
public ContentSectionManagerTest() { public ContentSectionManagerTest() {
} }
@ -198,7 +198,7 @@ public class ContentSectionManagerTest {
assertThat(categoryRepo, is(not(nullValue()))); assertThat(categoryRepo, is(not(nullValue())));
assertThat(typeRepo, is(not(nullValue()))); assertThat(typeRepo, is(not(nullValue())));
assertThat(lifecycleDefRepo, is(not(nullValue()))); assertThat(lifecycleDefRepo, is(not(nullValue())));
assertThat(workflowTemplateRepo, is(not(nullValue()))); assertThat(workflowRepo, is(not(nullValue())));
} }
/** /**
@ -449,9 +449,11 @@ public class ContentSectionManagerTest {
public void addContentTypeToSection() { public void addContentTypeToSection() {
final ContentSection section = repository.findById(-1100L).get(); final ContentSection section = repository.findById(-1100L).get();
final LifecycleDefinition lifecycleDef = lifecycleDefRepo final LifecycleDefinition lifecycleDef = lifecycleDefRepo
.findById(-13002L).get(); .findById(-13002L)
final WorkflowTemplate workflowTemplate = workflowTemplateRepo .get();
.findById(-14001L).get(); final Workflow workflowTemplate = workflowRepo
.findById(-14001L)
.get();
manager.addContentTypeToSection(Event.class, manager.addContentTypeToSection(Event.class,
section, section,
@ -474,9 +476,11 @@ public class ContentSectionManagerTest {
public void addAlreadyAddedContentTypeToSection() { public void addAlreadyAddedContentTypeToSection() {
final ContentSection section = repository.findById(-1100L).get(); final ContentSection section = repository.findById(-1100L).get();
final LifecycleDefinition lifecycleDef = lifecycleDefRepo final LifecycleDefinition lifecycleDef = lifecycleDefRepo
.findById(-13002L).get(); .findById(-13002L)
final WorkflowTemplate workflowTemplate = workflowTemplateRepo .get();
.findById(-14002L).get(); final Workflow workflowTemplate = workflowRepo
.findById(-14002L)
.get();
manager.addContentTypeToSection(News.class, manager.addContentTypeToSection(News.class,
section, section,
@ -501,7 +505,7 @@ public class ContentSectionManagerTest {
final ContentSection section = repository.findById(-1100L).get(); final ContentSection section = repository.findById(-1100L).get();
final LifecycleDefinition lifecycleDef = lifecycleDefRepo final LifecycleDefinition lifecycleDef = lifecycleDefRepo
.findById(-13002L).get(); .findById(-13002L).get();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-14002L).get(); .findById(-14002L).get();
manager.addContentTypeToSection(null, manager.addContentTypeToSection(null,
@ -527,7 +531,7 @@ public class ContentSectionManagerTest {
public void addContentTypeToSectionSectionIsNull() { public void addContentTypeToSectionSectionIsNull() {
final LifecycleDefinition lifecycleDef = lifecycleDefRepo final LifecycleDefinition lifecycleDef = lifecycleDefRepo
.findById(-13002L).get(); .findById(-13002L).get();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-14002L).get(); .findById(-14002L).get();
manager.addContentTypeToSection(Event.class, manager.addContentTypeToSection(Event.class,
@ -551,7 +555,7 @@ public class ContentSectionManagerTest {
@InSequence(800) @InSequence(800)
public void addContentTypeToSectionLifecycleIsNull() { public void addContentTypeToSectionLifecycleIsNull() {
final ContentSection section = repository.findById(-1100L).get(); final ContentSection section = repository.findById(-1100L).get();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-14001L).get(); .findById(-14001L).get();
manager.addContentTypeToSection(Event.class, manager.addContentTypeToSection(Event.class,
@ -602,7 +606,7 @@ public class ContentSectionManagerTest {
final ContentSection section = repository.findById(-1100L).get(); final ContentSection section = repository.findById(-1100L).get();
final LifecycleDefinition lifecycleDef = lifecycleDefRepo final LifecycleDefinition lifecycleDef = lifecycleDefRepo
.findById(-13003L).get(); .findById(-13003L).get();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-14001L).get(); .findById(-14001L).get();
manager.addContentTypeToSection(Event.class, manager.addContentTypeToSection(Event.class,
@ -628,7 +632,7 @@ public class ContentSectionManagerTest {
final ContentSection section = repository.findById(-1100L).get(); final ContentSection section = repository.findById(-1100L).get();
final LifecycleDefinition lifecycleDef = lifecycleDefRepo final LifecycleDefinition lifecycleDef = lifecycleDefRepo
.findById(-13002L).get(); .findById(-13002L).get();
final WorkflowTemplate workflowTemplate = workflowTemplateRepo final Workflow workflowTemplate = workflowRepo
.findById(-14003L).get(); .findById(-14003L).get();
manager.addContentTypeToSection(Event.class, manager.addContentTypeToSection(Event.class,

View File

@ -388,7 +388,7 @@ public class ContentTypeRepositoryTest {
.addClass(org.libreccm.workflow.TaskState.class) .addClass(org.libreccm.workflow.TaskState.class)
.addClass(org.libreccm.workflow.Workflow.class) .addClass(org.libreccm.workflow.Workflow.class)
.addClass(org.libreccm.workflow.WorkflowState.class) .addClass(org.libreccm.workflow.WorkflowState.class)
.addClass(org.libreccm.workflow.WorkflowTemplate.class) .addClass(org.libreccm.workflow.AbstractWorkflowException.class)
.addClass(org.librecms.CmsConstants.class) .addClass(org.librecms.CmsConstants.class)
.addClass(org.librecms.contentsection.Asset.class) .addClass(org.librecms.contentsection.Asset.class)
.addClass(org.librecms.contentsection.AttachmentList.class) .addClass(org.librecms.contentsection.AttachmentList.class)

View File

@ -30,12 +30,11 @@ import org.libreccm.security.User;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier; import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.web.CcmApplication; import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.WorkflowTemplate; import org.libreccm.workflow.Workflow;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Locale;
/** /**
* *
@ -144,13 +143,11 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
final LifecycleDefinition lifecycleDef2 = new LifecycleDefinition(); final LifecycleDefinition lifecycleDef2 = new LifecycleDefinition();
lifecycleDef2.setDefinitionId(-110); lifecycleDef2.setDefinitionId(-110);
final WorkflowTemplate workflowTemplate1 = new WorkflowTemplate(); final Workflow workflow1 = new Workflow();
workflowTemplate1.getName().addValue(Locale.ENGLISH, workflow1.setAbstractWorkflow(true);
"Workflow Template 1");
final WorkflowTemplate workflowTemplate2 = new WorkflowTemplate(); final Workflow workflow2 = new Workflow();
workflowTemplate2.getName().addValue(Locale.ENGLISH, workflow2.setAbstractWorkflow(false);
"Workflow Template 2");
verifier verifier
.withPrefabValues(ContentItem.class, item1, item2) .withPrefabValues(ContentItem.class, item1, item2)
@ -167,9 +164,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
.withPrefabValues(LifecycleDefinition.class, .withPrefabValues(LifecycleDefinition.class,
lifecycleDef1, lifecycleDef1,
lifecycleDef2) lifecycleDef2)
.withPrefabValues(WorkflowTemplate.class, .withPrefabValues(Workflow.class, workflow1, workflow2);
workflowTemplate1,
workflowTemplate2);
} }
/** /**

View File

@ -82,8 +82,6 @@ DELETE FROM ccm_core.workflow_task_descriptions;
DELETE FROM ccm_cms.content_section_workflow_templates; DELETE FROM ccm_cms.content_section_workflow_templates;
DELETE FROM ccm_core.workflow_templates;
DELETE FROM ccm_core.workflows; DELETE FROM ccm_core.workflows;
DELETE FROM ccm_cms.lifecycle_phase_definition_labels; DELETE FROM ccm_cms.lifecycle_phase_definition_labels;

View File

@ -82,8 +82,6 @@ DELETE FROM ccm_core.workflow_task_descriptions;
DELETE FROM ccm_cms.content_section_workflow_templates; DELETE FROM ccm_cms.content_section_workflow_templates;
DELETE FROM ccm_core.workflow_templates;
DELETE FROM ccm_core.workflows; DELETE FROM ccm_core.workflows;
DELETE FROM ccm_cms.lifecycle_phase_definition_labels; DELETE FROM ccm_cms.lifecycle_phase_definition_labels;

View File

@ -0,0 +1,67 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.workflow;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class AbstractWorkflowException extends RuntimeException {
private static final long serialVersionUID = 1L;
/**
* Creates a new instance of <code>AbstractWorkflowException</code> without detail message.
*/
public AbstractWorkflowException() {
super();
}
/**
* Constructs an instance of <code>AbstractWorkflowException</code> with the specified detail message.
*
* @param msg The detail message.
*/
public AbstractWorkflowException(final String msg) {
super(msg);
}
/**
* Constructs an instance of <code>AbstractWorkflowException</code> which wraps the
* specified exception.
*
* @param exception The exception to wrap.
*/
public AbstractWorkflowException(final Exception exception) {
super(exception);
}
/**
* Constructs an instance of <code>AbstractWorkflowException</code> with the specified message which also wraps the
* specified exception.
*
* @param msg The detail message.
* @param exception The exception to wrap.
*/
public AbstractWorkflowException(final String msg, final Exception exception) {
super(msg, exception);
}
}

View File

@ -29,6 +29,7 @@ import org.libreccm.portation.Portable;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -37,6 +38,8 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import java.util.Locale;
/** /**
* A workflow is a collection of tasks which are performed on an object. Tasks * A workflow is a collection of tasks which are performed on an object. Tasks
* can depend on each other. * can depend on each other.
@ -78,13 +81,18 @@ public class Workflow implements Identifiable, Serializable, Portable {
@NotNull @NotNull
private String uuid; private String uuid;
/**
* Indicates that this {@code Workflow} can be assigned to an object.
*/
@Column(name = "abstract_workflow")
private boolean abstractWorkflow;
/** /**
* The template which was used to generate the workflow. * The template which was used to generate the workflow.
*/ */
@ManyToOne @ManyToOne
@JoinColumn(name = "TEMPLATE_ID") @JoinColumn(name = "TEMPLATE_ID")
@JsonIdentityReference(alwaysAsId = true) private Workflow template;
private WorkflowTemplate template;
/** /**
* Human readable name of the workflow. * Human readable name of the workflow.
@ -173,11 +181,19 @@ public class Workflow implements Identifiable, Serializable, Portable {
this.uuid = uuid; this.uuid = uuid;
} }
public WorkflowTemplate getTemplate() { public boolean isAbstractWorkflow() {
return abstractWorkflow;
}
public void setAbstractWorkflow(boolean abstractWorkflow) {
this.abstractWorkflow = abstractWorkflow;
}
public Workflow getTemplate() {
return template; return template;
} }
protected void setTemplate(final WorkflowTemplate template) { protected void setTemplate(final Workflow template) {
this.template = template; this.template = template;
} }
@ -228,6 +244,11 @@ public class Workflow implements Identifiable, Serializable, Portable {
} }
protected void setObject(final CcmObject object) { protected void setObject(final CcmObject object) {
if (abstractWorkflow) {
throw new AbstractWorkflowException(String.format(
"Workflow %s is abstrct and can not assigned to an object.",
uuid));
}
this.object = object; this.object = object;
} }
@ -257,6 +278,7 @@ public class Workflow implements Identifiable, Serializable, Portable {
hash = 79 * hash + (int) (workflowId ^ (workflowId >>> 32)); hash = 79 * hash + (int) (workflowId ^ (workflowId >>> 32));
hash = 79 * hash + Objects.hashCode(uuid); hash = 79 * hash + Objects.hashCode(uuid);
hash = 79 * hash + Objects.hashCode(name); hash = 79 * hash + Objects.hashCode(name);
hash = 79 * hash + (abstractWorkflow ? 1 : 0);
hash = 79 * hash + Objects.hashCode(description); hash = 79 * hash + Objects.hashCode(description);
hash = 79 * hash + Objects.hashCode(state); hash = 79 * hash + Objects.hashCode(state);
hash = 79 * hash + (active ? 1 : 0); hash = 79 * hash + (active ? 1 : 0);
@ -289,6 +311,10 @@ public class Workflow implements Identifiable, Serializable, Portable {
return false; return false;
} }
if (abstractWorkflow != other.isAbstractWorkflow()) {
return false;
}
if (!Objects.equals(description, other.getDescription())) { if (!Objects.equals(description, other.getDescription())) {
return false; return false;
} }
@ -319,6 +345,7 @@ public class Workflow implements Identifiable, Serializable, Portable {
+ "uuid = \"%s\", " + "uuid = \"%s\", "
+ "name = \"%s\", " + "name = \"%s\", "
+ "description = \"%s\", " + "description = \"%s\", "
+ "abstractWorkflow = %b, "
+ "state = \"%s\", " + "state = \"%s\", "
+ "active = %b%s" + "active = %b%s"
+ " }", + " }",
@ -327,6 +354,7 @@ public class Workflow implements Identifiable, Serializable, Portable {
uuid, uuid,
Objects.toString(name), Objects.toString(name),
Objects.toString(description), Objects.toString(description),
abstractWorkflow,
Objects.toString(state), Objects.toString(state),
active, active,
data); data);

View File

@ -19,6 +19,7 @@
package org.libreccm.workflow; package org.libreccm.workflow;
import com.arsdigita.kernel.KernelConfig; import com.arsdigita.kernel.KernelConfig;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.shiro.subject.Subject; import org.apache.shiro.subject.Subject;
@ -37,13 +38,22 @@ import javax.inject.Inject;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.beans.BeanInfo; import java.beans.BeanInfo;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.beans.Introspector; import java.beans.Introspector;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
/** /**
* Manager for {@link Workflow}s. The logic of some of these classes has been * Manager for {@link Workflow}s. The logic of some of these classes has been
@ -109,17 +119,17 @@ public class WorkflowManager {
@AuthorizationRequired @AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public Workflow createWorkflow(final WorkflowTemplate template, public Workflow createWorkflow(final Workflow template,
final CcmObject object) { final CcmObject object) {
if (template == null) { Objects.requireNonNull(template,
"Can't create a workflow without a template.");
if (!template.isAbstractWorkflow()) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Can't create a workflow without a template."); "The provided template is not an abstract workflow");
} }
if (object == null) { Objects.requireNonNull(object,
throw new IllegalArgumentException( "Can't create a workflow without an object.");
"Can't create a workflow without an object.");
}
final Workflow workflow = new Workflow(); final Workflow workflow = new Workflow();
@ -219,8 +229,8 @@ public class WorkflowManager {
writeMethod.invoke(task, value); writeMethod.invoke(task, value);
} }
} catch (IllegalAccessException } catch (IllegalAccessException
| IllegalArgumentException | IllegalArgumentException
| InvocationTargetException ex) { | InvocationTargetException ex) {
throw new RuntimeException(); throw new RuntimeException();
} }
} }

View File

@ -1,98 +0,0 @@
/*
* Copyright (C) 2016 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.workflow;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.core.CcmObject;
import org.libreccm.portation.Portable;
import org.libreccm.security.GroupIdResolver;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import java.io.Serializable;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
/**
* Objects of these class are used as templates for new workflows. The tasks
* in the template are copied when a new workflow is generated.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "WORKFLOW_TEMPLATES", schema = DB_SCHEMA)
@NamedQueries({
@NamedQuery(
name = "WorkflowTemplate.findByUuid",
query = "SELECT t FROM WorkflowTemplate t " +
"WHERE t.uuid = :uuid")
})
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = WorkflowTemplateIdResolver.class,
property = "uuid")
public class WorkflowTemplate extends Workflow implements Serializable,
Portable {
private static final long serialVersionUID = 5770519379144947171L;
/**
* A workflow template has no object. Therefore the {@code setObject
* (CcmObject)} method has been overwritten to throw an
* {@link UnsupportedOperationException} when called on the workflow
* template.
*
* @param object
*/
@Override
protected void setObject(final CcmObject object) {
//throw new UnsupportedOperationException(
// "A WorkflowTemplate has no object.");
}
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof WorkflowTemplate)) {
return false;
}
final WorkflowTemplate other = (WorkflowTemplate) obj;
return other.canEqual(obj);
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof WorkflowTemplate;
}
}

View File

@ -1,62 +0,0 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.workflow;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
import com.fasterxml.jackson.annotation.ObjectIdResolver;
import org.libreccm.cdi.utils.CdiUtil;
import javax.enterprise.context.RequestScoped;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 9/6/17
*/
@RequestScoped
public class WorkflowTemplateIdResolver implements ObjectIdResolver {
@Override
public void bindItem(ObjectIdGenerator.IdKey idKey, Object o) {
// According to the Jackson JavaDoc, this method can be used to keep
// track of objects directly in a resolver implementation. We don't need
// this here therefore this method is empty.
}
@Override
public Object resolveId(ObjectIdGenerator.IdKey id) {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final WorkflowTemplateRepository workflowTemplateRepository = cdiUtil
.findBean(WorkflowTemplateRepository.class);
return workflowTemplateRepository
.findByUuid(id.key.toString())
.orElseThrow(() -> new IllegalArgumentException(String
.format("No workflow templates with uuid %s in the " +
"database.", id.key.toString())));
}
@Override
public ObjectIdResolver newForDeserialization(Object o) {
return new WorkflowTemplateIdResolver();
}
@Override
public boolean canUseFor(ObjectIdResolver resolverType) {
return resolverType instanceof WorkflowTemplateIdResolver;
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller;
import org.libreccm.portation.Marshals;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @version created on 11/21/16
*/
@RequestScoped
@Marshals(WorkflowTemplate.class)
public class WorkflowTemplateMarshaller extends
AbstractMarshaller<WorkflowTemplate> {
@Inject
private WorkflowTemplateRepository workflowTemplateRepository;
@Override
protected Class<WorkflowTemplate> getObjectClass() {
return WorkflowTemplate.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(WorkflowTemplate portableObject) {
workflowTemplateRepository.save(portableObject);
}
}

View File

@ -1,80 +0,0 @@
/*
* Copyright (C) 2016 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.workflow;
import org.libreccm.core.AbstractEntityRepository;
import javax.enterprise.context.RequestScoped;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
import java.util.Optional;
import java.util.UUID;
/**
* A repository for {@link WorkflowTemplate}s.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
public class WorkflowTemplateRepository
extends AbstractEntityRepository<Long, WorkflowTemplate> {
@Override
public Class<WorkflowTemplate> getEntityClass() {
return WorkflowTemplate.class;
}
@Override
public boolean isNew(final WorkflowTemplate template) {
return template.getWorkflowId() == 0;
}
@Override
public void initNewEntity(final WorkflowTemplate workflowTemplate) {
super.initNewEntity(workflowTemplate);
workflowTemplate.setUuid(UUID.randomUUID().toString());
}
/**
* Find a {@link WorkflowTemplate} by its UUID.
*
* @param uuid The UUID of the {@link WorkflowTemplate} to find.
*
* @return An {@link Optional} containing the {@link WorkflowTemplate}
* identified by the provided UUID.
*/
public Optional<WorkflowTemplate> findByUuid(final String uuid) {
if (uuid == null || uuid.trim().isEmpty()) {
throw new IllegalArgumentException(
"The UUID of the WorkflowTemplate to retrieve can't be " +
"null or empty.");
}
final TypedQuery<WorkflowTemplate> query = getEntityManager()
.createNamedQuery("WorkflowTemplate.findByUuid",
WorkflowTemplate.class);
query.setParameter("uuid", uuid);
try {
return Optional.of(query.getSingleResult());
} catch(NoResultException ex) {
return Optional.empty();
}
}
}

View File

@ -0,0 +1,13 @@
alter table CCM_CORE.WORKFLOWS add column ABSTRACT_WORKFLOW boolean;
update CCM_CORE.WORKFLOWS set ABSTRACT_WORKFLOW = true
where WORKFLOW_ID in (select WORKFLOW_ID from CCM_CORE.WORKFLOW_TEMPLATES);
alter table CCM_CORE.WORKFLOW_TEMPLATES
drop constraint if exists FK8692vdme4yxnkj1m0k1dw74pk;
alter table CCM_CORE.WORKFLOWS
drop constraint if exists FKeixdxau4jebw682gd49tdbsjy;
drop table CCM_CORE.WORKFLOW_TEMPLATES cascade;

View File

@ -0,0 +1,13 @@
alter table CCM_CORE.WORKFLOWS add column ABSTRACT_WORKFLOW boolean;
update CCM_CORE.WORKFLOWS set ABSTRACT_WORKFLOW = true
where WORKFLOW_ID in (select WORKFLOW_ID from CCM_CORE.WORKFLOW_TEMPLATES);
alter table CCM_CORE.WORKFLOW_TEMPLATES
drop constraint if exists FK8692vdme4yxnkj1m0k1dw74pk;
alter table CCM_CORE.WORKFLOWS
drop constraint if exists FKeixdxau4jebw682gd49tdbsjy;
drop table CCM_CORE.WORKFLOW_TEMPLATES cascade;

View File

@ -144,7 +144,7 @@ public class CoreDataImportTest {
Assert.assertFalse(importHelper.importPermissions()); Assert.assertFalse(importHelper.importPermissions());
Assert.assertFalse(importHelper.importWorkflowTemplates()); // Assert.assertFalse(importHelper.importWorkflowTemplates());
Assert.assertFalse(importHelper.importWorkflows()); Assert.assertFalse(importHelper.importWorkflows());
Assert.assertFalse(importHelper.importTaskComments()); Assert.assertFalse(importHelper.importTaskComments());
//Assert.assertFalse(importHelper.importAssignableTasks()); //Assert.assertFalse(importHelper.importAssignableTasks());

View File

@ -79,13 +79,6 @@ class ImportHelper {
@Marshals(DomainOwnership.class) @Marshals(DomainOwnership.class)
private DomainOwnershipMarshaller domainOwnershipMarshaller; private DomainOwnershipMarshaller domainOwnershipMarshaller;
@Inject
@Marshals(Permission.class)
private PermissionMarshaller permissionMarshaller;
@Inject
@Marshals(WorkflowTemplate.class)
private WorkflowTemplateMarshaller workflowTemplateMarshaller;
@Inject @Inject
@Marshals(Workflow.class) @Marshals(Workflow.class)
private WorkflowMarshaller workflowMarshaller; private WorkflowMarshaller workflowMarshaller;
@ -209,14 +202,6 @@ class ImportHelper {
return permissionMarshaller.importFile(); return permissionMarshaller.importFile();
} }
boolean importWorkflowTemplates() {
workflowTemplateMarshaller.prepare(
Format.XML,
repoPath + projectPath,
"workflowTemplates.xml",
indentation);
return workflowTemplateMarshaller.importFile();
}
boolean importWorkflows() { boolean importWorkflows() {
workflowMarshaller.prepare( workflowMarshaller.prepare(

View File

@ -109,36 +109,36 @@ public class PermissionManagerTest {
@Deployment @Deployment
public static WebArchive createDeployment() { public static WebArchive createDeployment() {
return ShrinkWrap return ShrinkWrap
.create(WebArchive.class, .create(WebArchive.class,
"LibreCCM-org.libreccm.security.PermissionManagerTest.war"). "LibreCCM-org.libreccm.security.PermissionManagerTest.war").
addPackage(org.libreccm.categorization.Categorization.class addPackage(org.libreccm.categorization.Categorization.class
.getPackage()) .getPackage())
.addPackage(org.libreccm.configuration.Configuration.class .addPackage(org.libreccm.configuration.Configuration.class
.getPackage()) .getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage()) .addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class .addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage()) .getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class .addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage()) .getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage()). .addPackage(org.libreccm.l10n.LocalizedString.class.getPackage()).
addPackage(org.libreccm.security.User.class.getPackage()) addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class .addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage()) .getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class .addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage()) .getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage()) .addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage()) .addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage()). .addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage()).
addPackage(com.arsdigita.kernel.security.SecurityConfig.class addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage()) .getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage()) .addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.portation.Portable.class) .addClass(org.libreccm.portation.Portable.class)
.addAsLibraries(getModuleDependencies()) .addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml", .addAsResource("test-persistence.xml",
"META-INF/persistence.xml") "META-INF/persistence.xml")
.addAsResource("configs/shiro.ini", "shiro.ini") .addAsResource("configs/shiro.ini", "shiro.ini")
.addAsWebInfResource("test-web.xml", "web.xml") .addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource("META-INF/beans.xml", "beans.xml"); .addAsWebInfResource("META-INF/beans.xml", "beans.xml");
} }
/** /**
@ -177,11 +177,11 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "after-grant.yml", + "after-grant.yml",
excludeColumns = {"permission_id"}) excludeColumns = {"permission_id"})
@InSequence(200) @InSequence(200)
public void grantPermission() { public void grantPermission() {
final Role role2 = roleRepository.findByName("role2").get(); final Role role2 = roleRepository.findByName("role2").get();
@ -202,10 +202,10 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "data.yml") + "data.yml")
@InSequence(210) @InSequence(210)
public void grantPermissionAgain() { public void grantPermissionAgain() {
final Role role1 = roleRepository.findByName("role1").get(); final Role role1 = roleRepository.findByName("role1").get();
@ -224,11 +224,11 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet("datasets/org/libreccm/security/PermissionManagerTest/" @UsingDataSet("datasets/org/libreccm/security/PermissionManagerTest/"
+ "data-recursivly.yml") + "data-recursivly.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "after-grant-recursivly.yml", + "after-grant-recursivly.yml",
excludeColumns = {"permission_id"}) excludeColumns = {"permission_id"})
@InSequence(211) @InSequence(211)
public void grantPermissionRecursively() { public void grantPermissionRecursively() {
final Role role1 = roleRepository.findByName("role1").get(); final Role role1 = roleRepository.findByName("role1").get();
@ -249,7 +249,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(220) @InSequence(220)
public void grantPermissionPrivilegeNull() throws Throwable { public void grantPermissionPrivilegeNull() throws Throwable {
@ -257,7 +257,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.grantPrivilege(null, role1)); () -> permissionManager.grantPrivilege(null, role1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -273,7 +273,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(225) @InSequence(225)
public void grantPermissionOnObjectPrivilegeNull() throws Throwable { public void grantPermissionOnObjectPrivilegeNull() throws Throwable {
@ -282,7 +282,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.grantPrivilege(null, role1, object1)); () -> permissionManager.grantPrivilege(null, role1, object1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -298,7 +298,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(230) @InSequence(230)
public void grantPermissionEmptyPrivilege() throws Throwable { public void grantPermissionEmptyPrivilege() throws Throwable {
@ -306,7 +306,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.grantPrivilege("", role1)); () -> permissionManager.grantPrivilege("", role1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -322,7 +322,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(235) @InSequence(235)
public void grantPermissionOnObjectEmptyPrivilege() throws Throwable { public void grantPermissionOnObjectEmptyPrivilege() throws Throwable {
@ -331,7 +331,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.grantPrivilege("", role1, object1)); () -> permissionManager.grantPrivilege("", role1, object1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -347,13 +347,13 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(240) @InSequence(240)
public void grantPermissionToRoleNull() throws Throwable { public void grantPermissionToRoleNull() throws Throwable {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.grantPrivilege("privilege", null)); () -> permissionManager.grantPrivilege("privilege", null));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -369,7 +369,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(240) @InSequence(240)
public void grantPermissionOnObjectToRoleNull() throws Throwable { public void grantPermissionOnObjectToRoleNull() throws Throwable {
@ -377,9 +377,9 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.grantPrivilege("privilege", () -> permissionManager.grantPrivilege("privilege",
null, null,
object1)); object1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -395,7 +395,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(250) @InSequence(250)
public void grantPermissionNullObject() throws Throwable { public void grantPermissionNullObject() throws Throwable {
@ -403,9 +403,9 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.grantPrivilege("privilege1", () -> permissionManager.grantPrivilege("privilege1",
role1, role1,
null)); null));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -420,11 +420,11 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "after-revoke.yml", + "after-revoke.yml",
excludeColumns = {"permission_id"}) excludeColumns = {"permission_id"})
@InSequence(300) @InSequence(300)
public void revokePermission() { public void revokePermission() {
final Role role1 = roleRepository.findByName("role1").get(); final Role role1 = roleRepository.findByName("role1").get();
@ -446,16 +446,16 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "data.yml") + "data.yml")
@InSequence(310) @InSequence(310)
public void revokeNotExistingPermission() throws Throwable { public void revokeNotExistingPermission() throws Throwable {
final Role role1 = roleRepository.findByName("role1").get(); final Role role1 = roleRepository.findByName("role1").get();
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege("privilege999", role1)); () -> permissionManager.revokePrivilege("privilege999", role1));
} }
/** /**
@ -464,10 +464,10 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet("datasets/org/libreccm/security/PermissionManagerTest/" @UsingDataSet("datasets/org/libreccm/security/PermissionManagerTest/"
+ "after-grant-recursivly.yml") + "after-grant-recursivly.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "after-revoke-recursivly.yml") + "after-revoke-recursivly.yml")
@InSequence(311) @InSequence(311)
public void revokePermissionRecursivly() { public void revokePermissionRecursivly() {
final Role role1 = roleRepository.findByName("role1").get(); final Role role1 = roleRepository.findByName("role1").get();
@ -487,19 +487,19 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "data.yml") + "data.yml")
@InSequence(310) @InSequence(310)
public void revokeNotExistingPermissionOnObject() { public void revokeNotExistingPermissionOnObject() {
final Role role1 = roleRepository.findByName("role1").get(); final Role role1 = roleRepository.findByName("role1").get();
final CcmObject object1 = ccmObjectRepository.findById(-20001L).get(); final CcmObject object1 = ccmObjectRepository.findById(-20001L).get();
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege("privilege999", () -> permissionManager.revokePrivilege("privilege999",
role1, role1,
object1)); object1));
} }
/** /**
@ -512,7 +512,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(320) @InSequence(320)
public void revokePermissionPrivilegeNull() throws Throwable { public void revokePermissionPrivilegeNull() throws Throwable {
@ -520,7 +520,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege(null, role1)); () -> permissionManager.revokePrivilege(null, role1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -536,7 +536,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(320) @InSequence(320)
public void revokePermissionOnObjectPrivilegeNull() throws Throwable { public void revokePermissionOnObjectPrivilegeNull() throws Throwable {
@ -545,8 +545,8 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager. () -> permissionManager.
revokePrivilege(null, role1, object1)); revokePrivilege(null, role1, object1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -562,7 +562,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(330) @InSequence(330)
public void revokePermissionEmptyPrivilege() throws Throwable { public void revokePermissionEmptyPrivilege() throws Throwable {
@ -570,7 +570,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege("", role1)); () -> permissionManager.revokePrivilege("", role1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -579,15 +579,14 @@ public class PermissionManagerTest {
/** /**
* Verifies that * Verifies that
* {@link PermissionManager#revokePrivilege(java.lang.String, org.libreccm.security.Role, org.libreccm.core.CcmObject)} * {@link PermissionManager#revokePrivilege(java.lang.String, org.libreccm.security.Role, org.libreccm.core.CcmObject)}
* throws an {@link IllegalArgumentException} if called with {@code null} * throws an {@link NullPointerException} if called with {@code null} for
* for the privilege to revoke. * the privilege to revoke.
* *
* @throws Throwable * @throws Throwable
*/ */
@Test(expected @Test(expected = IllegalArgumentException.class)
= IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(320) @InSequence(320)
public void revokePermissionOnObjectEmptyPrivilege() throws Throwable { public void revokePermissionOnObjectEmptyPrivilege() throws Throwable {
@ -596,7 +595,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege("", role1, object1)); () -> permissionManager.revokePrivilege("", role1, object1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -605,21 +604,20 @@ public class PermissionManagerTest {
/** /**
* Verifies that * Verifies that
* {@link PermissionManager#revokePrivilege(java.lang.String, org.libreccm.security.Role)} * {@link PermissionManager#revokePrivilege(java.lang.String, org.libreccm.security.Role)}
* throws an {@link IllegalArgumentException} if called with {@code null} * throws an {@link NullPointerException} if called with {@code null} for
* for the role to revoke the permission from. * the role to revoke the permission from.
* *
* @throws Throwable * @throws Throwable
*/ */
@Test(expected @Test(expected = IllegalArgumentException.class)
= IllegalArgumentException.class) @UsingDataSet("datasets/org/libreccm/security/PermissionManagerTest/"
@UsingDataSet( + "data.yml")
"datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(340) @InSequence(340)
public void revokePermissionFromRoleNull() throws Throwable { public void revokePermissionFromRoleNull() throws Throwable {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege("privilege1", null)); () -> permissionManager.revokePrivilege("privilege1", null));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -628,24 +626,24 @@ public class PermissionManagerTest {
/** /**
* Verifies that * Verifies that
* {@link PermissionManager#revokePrivilege(java.lang.String, org.libreccm.security.Role, org.libreccm.core.CcmObject)} * {@link PermissionManager#revokePrivilege(java.lang.String, org.libreccm.security.Role, org.libreccm.core.CcmObject)}
* throws an {@link IllegalArgumentException} if called with {@code null} * throws an {@link NullPointerException} if called with {@code null} for
* for the role to revoke the permission from. * the role to revoke the permission from.
* *
* @throws Throwable * @throws Throwable
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = NullPointerException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(NullPointerException.class)
@InSequence(345) @InSequence(345)
public void revokePermissionOnObjectFromRoleNull() throws Throwable { public void revokePermissionOnObjectFromRoleNull() throws Throwable {
final CcmObject object1 = ccmObjectRepository.findById(-20001L).get(); final CcmObject object1 = ccmObjectRepository.findById(-20001L).get();
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege("privilege1", () -> permissionManager.revokePrivilege("privilege1",
null, null,
object1)); object1));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -659,19 +657,19 @@ public class PermissionManagerTest {
* *
* @throws Throwable * @throws Throwable
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = NullPointerException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(NullPointerException.class)
@InSequence(350) @InSequence(350)
public void revokePermissionNullObject() throws Throwable { public void revokePermissionNullObject() throws Throwable {
final Role role1 = roleRepository.findByName("role1").get(); final Role role1 = roleRepository.findByName("role1").get();
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.revokePrivilege("privilege2", () -> permissionManager.revokePrivilege("privilege2",
role1, role1,
null)); null));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -686,18 +684,18 @@ public class PermissionManagerTest {
*/ */
@Test @Test
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldMatchDataSet( @ShouldMatchDataSet(
value = "datasets/org/libreccm/security/PermissionManagerTest/" value = "datasets/org/libreccm/security/PermissionManagerTest/"
+ "after-copy.yml", + "after-copy.yml",
excludeColumns = {"permission_id"}) excludeColumns = {"permission_id"})
@InSequence(400) @InSequence(400)
public void copyPermissions() throws Throwable { public void copyPermissions() throws Throwable {
final CcmObject object2 = ccmObjectRepository.findById(-20002L).get(); final CcmObject object2 = ccmObjectRepository.findById(-20002L).get();
final CcmObject object3 = ccmObjectRepository.findById(-20003L).get(); final CcmObject object3 = ccmObjectRepository.findById(-20003L).get();
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.copyPermissions(object2, object3)); () -> permissionManager.copyPermissions(object2, object3));
} }
/** /**
@ -710,7 +708,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(410) @InSequence(410)
public void copyPermissionsNullSource() throws Throwable { public void copyPermissionsNullSource() throws Throwable {
@ -718,7 +716,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.copyPermissions(null, object3)); () -> permissionManager.copyPermissions(null, object3));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -734,7 +732,7 @@ public class PermissionManagerTest {
*/ */
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/security/PermissionManagerTest/data.yml") "datasets/org/libreccm/security/PermissionManagerTest/data.yml")
@ShouldThrowException(IllegalArgumentException.class) @ShouldThrowException(IllegalArgumentException.class)
@InSequence(420) @InSequence(420)
public void copyPermissionsNullTarget() throws Throwable { public void copyPermissionsNullTarget() throws Throwable {
@ -742,7 +740,7 @@ public class PermissionManagerTest {
try { try {
shiro.getSystemUser().execute( shiro.getSystemUser().execute(
() -> permissionManager.copyPermissions(object2, null)); () -> permissionManager.copyPermissions(object2, null));
} catch (ExecutionException ex) { } catch (ExecutionException ex) {
throw ex.getCause(); throw ex.getCause();
} }
@ -758,9 +756,9 @@ public class PermissionManagerTest {
public void verifyListPrivileges() { public void verifyListPrivileges() {
final List<String> corePrivileges = permissionManager final List<String> corePrivileges = permissionManager
.listDefiniedPrivileges(CoreConstants.class); .listDefiniedPrivileges(CoreConstants.class);
final List<String> catPrivileges = permissionManager final List<String> catPrivileges = permissionManager
.listDefiniedPrivileges(CategorizationConstants.class); .listDefiniedPrivileges(CategorizationConstants.class);
assertThat(corePrivileges, is(not(nullValue()))); assertThat(corePrivileges, is(not(nullValue())));
assertThat(corePrivileges.isEmpty(), is(false)); assertThat(corePrivileges.isEmpty(), is(false));

View File

@ -47,8 +47,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
TaskComment.class, TaskComment.class,
TaskAssignment.class, TaskAssignment.class,
AssignableTask.class, AssignableTask.class,
Workflow.class, Workflow.class
WorkflowTemplate.class
}); });
} }
@ -98,12 +97,6 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
final Workflow workflow2 = new Workflow(); final Workflow workflow2 = new Workflow();
workflow2.getName().addValue(Locale.ENGLISH, "Workflow 2"); workflow2.getName().addValue(Locale.ENGLISH, "Workflow 2");
final WorkflowTemplate template1 = new WorkflowTemplate();
template1.getName().addValue(Locale.ENGLISH, "Template 1");
final WorkflowTemplate template2 = new WorkflowTemplate();
template1.getName().addValue(Locale.ENGLISH, "Template 2");
final CcmObject object1 = new CcmObject(); final CcmObject object1 = new CcmObject();
object1.setDisplayName("Object 1"); object1.setDisplayName("Object 1");
@ -117,7 +110,6 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
.withPrefabValues(Group.class, group1, group2) .withPrefabValues(Group.class, group1, group2)
.withPrefabValues(User.class, user1, user2) .withPrefabValues(User.class, user1, user2)
.withPrefabValues(Workflow.class, workflow1, workflow2) .withPrefabValues(Workflow.class, workflow1, workflow2)
.withPrefabValues(WorkflowTemplate.class, template1, template2)
.withPrefabValues(CcmObject.class, object1, object2); .withPrefabValues(CcmObject.class, object1, object2);
} }

View File

@ -46,7 +46,7 @@ create schema CCM_CORE;
create table CCM_CORE.CATEGORY_DESCRIPTIONS ( create table CCM_CORE.CATEGORY_DESCRIPTIONS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
@ -63,7 +63,7 @@ create schema CCM_CORE;
create table CCM_CORE.CATEGORY_TITLES ( create table CCM_CORE.CATEGORY_TITLES (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
@ -111,7 +111,7 @@ create schema CCM_CORE;
create table CCM_CORE.DOMAIN_DESCRIPTIONS ( create table CCM_CORE.DOMAIN_DESCRIPTIONS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
@ -128,14 +128,14 @@ create schema CCM_CORE;
create table CCM_CORE.DOMAIN_TITLES ( create table CCM_CORE.DOMAIN_TITLES (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
create table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS ( create table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS (
COMPONENT_ID bigint not null, COMPONENT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (COMPONENT_ID, LOCALE) primary key (COMPONENT_ID, LOCALE)
); );
@ -180,14 +180,14 @@ create schema CCM_CORE;
create table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS ( create table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS (
DATA_QUERY_ID bigint not null, DATA_QUERY_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (DATA_QUERY_ID, LOCALE) primary key (DATA_QUERY_ID, LOCALE)
); );
create table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES ( create table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES (
DATA_QUERY_ID bigint not null, DATA_QUERY_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (DATA_QUERY_ID, LOCALE) primary key (DATA_QUERY_ID, LOCALE)
); );
@ -224,7 +224,7 @@ create schema CCM_CORE;
create table CCM_CORE.FORMBUILDER_OPTION_LABELS ( create table CCM_CORE.FORMBUILDER_OPTION_LABELS (
OPTION_ID bigint not null, OPTION_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OPTION_ID, LOCALE) primary key (OPTION_ID, LOCALE)
); );
@ -237,14 +237,14 @@ create schema CCM_CORE;
create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS ( create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS (
PROCESS_LISTENER_ID bigint not null, PROCESS_LISTENER_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PROCESS_LISTENER_ID, LOCALE) primary key (PROCESS_LISTENER_ID, LOCALE)
); );
create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES ( create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES (
PROCESS_LISTENER_ID bigint not null, PROCESS_LISTENER_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PROCESS_LISTENER_ID, LOCALE) primary key (PROCESS_LISTENER_ID, LOCALE)
); );
@ -403,14 +403,14 @@ create schema CCM_CORE;
create table CCM_CORE.PAGE_MODEL_DESCRIPTIONS ( create table CCM_CORE.PAGE_MODEL_DESCRIPTIONS (
PAGE_MODEL_ID bigint not null, PAGE_MODEL_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PAGE_MODEL_ID, LOCALE) primary key (PAGE_MODEL_ID, LOCALE)
); );
create table CCM_CORE.PAGE_MODEL_TITLES ( create table CCM_CORE.PAGE_MODEL_TITLES (
PAGE_MODEL_ID bigint not null, PAGE_MODEL_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PAGE_MODEL_ID, LOCALE) primary key (PAGE_MODEL_ID, LOCALE)
); );
@ -436,7 +436,7 @@ create schema CCM_CORE;
PERMISSION_ID bigint not null, PERMISSION_ID bigint not null,
CREATION_DATE timestamp, CREATION_DATE timestamp,
CREATION_IP varchar(255), CREATION_IP varchar(255),
granted_privilege varchar(255), GRANTED_PRIVILEGE varchar(255),
INHERITED boolean, INHERITED boolean,
CREATION_USER_ID bigint, CREATION_USER_ID bigint,
GRANTEE_ID bigint, GRANTEE_ID bigint,
@ -473,21 +473,21 @@ create schema CCM_CORE;
create table CCM_CORE.RESOURCE_DESCRIPTIONS ( create table CCM_CORE.RESOURCE_DESCRIPTIONS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
create table CCM_CORE.RESOURCE_TITLES ( create table CCM_CORE.RESOURCE_TITLES (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
create table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS ( create table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS (
RESOURCE_TYPE_ID bigint not null, RESOURCE_TYPE_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (RESOURCE_TYPE_ID, LOCALE) primary key (RESOURCE_TYPE_ID, LOCALE)
); );
@ -512,7 +512,7 @@ create schema CCM_CORE;
create table CCM_CORE.ROLE_DESCRIPTIONS ( create table CCM_CORE.ROLE_DESCRIPTIONS (
ROLE_ID bigint not null, ROLE_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (ROLE_ID, LOCALE) primary key (ROLE_ID, LOCALE)
); );
@ -529,11 +529,11 @@ create schema CCM_CORE;
SETTING_ID bigint not null, SETTING_ID bigint not null,
CONFIGURATION_CLASS varchar(512) not null, CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null, NAME varchar(512) not null,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024), SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_LONG bigint, SETTING_VALUE_LONG bigint,
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_STRING varchar(1024),
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -544,7 +544,7 @@ create schema CCM_CORE;
create table CCM_CORE.SETTINGS_L10N_STR_VALUES ( create table CCM_CORE.SETTINGS_L10N_STR_VALUES (
ENTRY_ID bigint not null, ENTRY_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (ENTRY_ID, LOCALE) primary key (ENTRY_ID, LOCALE)
); );
@ -593,14 +593,14 @@ create schema CCM_CORE;
create table CCM_CORE.WORKFLOW_DESCRIPTIONS ( create table CCM_CORE.WORKFLOW_DESCRIPTIONS (
WORKFLOW_ID bigint not null, WORKFLOW_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (WORKFLOW_ID, LOCALE) primary key (WORKFLOW_ID, LOCALE)
); );
create table CCM_CORE.WORKFLOW_NAMES ( create table CCM_CORE.WORKFLOW_NAMES (
WORKFLOW_ID bigint not null, WORKFLOW_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (WORKFLOW_ID, LOCALE) primary key (WORKFLOW_ID, LOCALE)
); );
@ -614,7 +614,7 @@ create schema CCM_CORE;
create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( create table CCM_CORE.WORKFLOW_TASK_COMMENTS (
COMMENT_ID bigint not null, COMMENT_ID bigint not null,
COMMENT longvarchar, COMMENT varchar(2147483647),
UUID varchar(255) not null, UUID varchar(255) not null,
AUTHOR_ID bigint, AUTHOR_ID bigint,
TASK_ID bigint, TASK_ID bigint,
@ -628,14 +628,14 @@ create schema CCM_CORE;
create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS ( create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS (
TASK_ID bigint not null, TASK_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (TASK_ID, LOCALE) primary key (TASK_ID, LOCALE)
); );
create table CCM_CORE.WORKFLOW_TASK_LABELS ( create table CCM_CORE.WORKFLOW_TASK_LABELS (
TASK_ID bigint not null, TASK_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (TASK_ID, LOCALE) primary key (TASK_ID, LOCALE)
); );
@ -649,13 +649,9 @@ create schema CCM_CORE;
primary key (TASK_ID) primary key (TASK_ID)
); );
create table CCM_CORE.WORKFLOW_TEMPLATES (
WORKFLOW_ID bigint not null,
primary key (WORKFLOW_ID)
);
create table CCM_CORE.WORKFLOWS ( create table CCM_CORE.WORKFLOWS (
WORKFLOW_ID bigint not null, WORKFLOW_ID bigint not null,
abstract_workflow boolean,
ACTIVE boolean, ACTIVE boolean,
WORKFLOW_STATE varchar(255), WORKFLOW_STATE varchar(255),
TASKS_STATE varchar(255), TASKS_STATE varchar(255),
@ -691,7 +687,8 @@ create schema CCM_CORE;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID);
create sequence hibernate_sequence start with 1 increment by 1;
create sequence hibernate_sequence start with 1 increment by 1;
alter table CCM_CORE.APPLICATIONS alter table CCM_CORE.APPLICATIONS
add constraint FKatcp9ij6mbkx0nfeig1o6n3lm add constraint FKatcp9ij6mbkx0nfeig1o6n3lm
@ -1014,7 +1011,7 @@ create sequence hibernate_sequence start with 1 increment by 1;
references CCM_CORE.CCM_ROLES; references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.PERMISSIONS alter table CCM_CORE.PERMISSIONS
add constraint FKc1x3h1p3o20qiwmonpmva7t5i add constraint FKg56ujjoe0j30pq579rf0l5yc6
foreign key (INHERITED_FROM_ID) foreign key (INHERITED_FROM_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
@ -1198,17 +1195,12 @@ create sequence hibernate_sequence start with 1 increment by 1;
foreign key (WORKFLOW_ID) foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS; references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_TEMPLATES
add constraint FK8692vdme4yxnkj1m0k1dw74pk
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKrm2yfrs6veoxoy304upq2wc64 add constraint FKrm2yfrs6veoxoy304upq2wc64
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKeixdxau4jebw682gd49tdbsjy add constraint FK9ray5beiny6wm2mi0uwyecay2
foreign key (TEMPLATE_ID) foreign key (TEMPLATE_ID)
references CCM_CORE.WORKFLOW_TEMPLATES; references CCM_CORE.WORKFLOWS;

View File

@ -2,7 +2,7 @@ drop schema if exists CCM_CORE cascade;
drop sequence if exists HIBERNATE_SEQUENCE; drop sequence if exists HIBERNATE_SEQUENCE;
create schema CCM_CORE; create schema CCM_CORE;
create table CCM_CORE.APPLICATIONS ( create table CCM_CORE.APPLICATIONS (
APPLICATION_TYPE varchar(1024) not null, APPLICATION_TYPE varchar(1024) not null,
@ -436,7 +436,7 @@ create schema CCM_CORE;
PERMISSION_ID int8 not null, PERMISSION_ID int8 not null,
CREATION_DATE timestamp, CREATION_DATE timestamp,
CREATION_IP varchar(255), CREATION_IP varchar(255),
granted_privilege varchar(255), GRANTED_PRIVILEGE varchar(255),
INHERITED boolean, INHERITED boolean,
CREATION_USER_ID int8, CREATION_USER_ID int8,
GRANTEE_ID int8, GRANTEE_ID int8,
@ -529,11 +529,11 @@ create schema CCM_CORE;
SETTING_ID int8 not null, SETTING_ID int8 not null,
CONFIGURATION_CLASS varchar(512) not null, CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null, NAME varchar(512) not null,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024), SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_LONG int8, SETTING_VALUE_LONG int8,
SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_STRING varchar(1024),
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -649,13 +649,9 @@ create schema CCM_CORE;
primary key (TASK_ID) primary key (TASK_ID)
); );
create table CCM_CORE.WORKFLOW_TEMPLATES (
WORKFLOW_ID int8 not null,
primary key (WORKFLOW_ID)
);
create table CCM_CORE.WORKFLOWS ( create table CCM_CORE.WORKFLOWS (
WORKFLOW_ID int8 not null, WORKFLOW_ID int8 not null,
abstract_workflow boolean,
ACTIVE boolean, ACTIVE boolean,
WORKFLOW_STATE varchar(255), WORKFLOW_STATE varchar(255),
TASKS_STATE varchar(255), TASKS_STATE varchar(255),
@ -691,7 +687,8 @@ create schema CCM_CORE;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID);
create sequence hibernate_sequence start 1 increment 1;
create sequence hibernate_sequence start 1 increment 1;
alter table CCM_CORE.APPLICATIONS alter table CCM_CORE.APPLICATIONS
add constraint FKatcp9ij6mbkx0nfeig1o6n3lm add constraint FKatcp9ij6mbkx0nfeig1o6n3lm
@ -1014,7 +1011,7 @@ create sequence hibernate_sequence start 1 increment 1;
references CCM_CORE.CCM_ROLES; references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.PERMISSIONS alter table CCM_CORE.PERMISSIONS
add constraint FKc1x3h1p3o20qiwmonpmva7t5i add constraint FKg56ujjoe0j30pq579rf0l5yc6
foreign key (INHERITED_FROM_ID) foreign key (INHERITED_FROM_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
@ -1198,17 +1195,12 @@ create sequence hibernate_sequence start 1 increment 1;
foreign key (WORKFLOW_ID) foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS; references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_TEMPLATES
add constraint FK8692vdme4yxnkj1m0k1dw74pk
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKrm2yfrs6veoxoy304upq2wc64 add constraint FKrm2yfrs6veoxoy304upq2wc64
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKeixdxau4jebw682gd49tdbsjy add constraint FK9ray5beiny6wm2mi0uwyecay2
foreign key (TEMPLATE_ID) foreign key (TEMPLATE_ID)
references CCM_CORE.WORKFLOW_TEMPLATES; references CCM_CORE.WORKFLOWS;

View File

@ -48,7 +48,7 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.CATEGORY_DESCRIPTIONS ( create table CCM_CORE.CATEGORY_DESCRIPTIONS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
@ -65,7 +65,7 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.CATEGORY_TITLES ( create table CCM_CORE.CATEGORY_TITLES (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
@ -81,7 +81,6 @@ CREATE SCHEMA ccm_shortcuts;
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
REV integer not null, REV integer not null,
REVTYPE tinyint, REVTYPE tinyint,
REVEND integer,
DISPLAY_NAME varchar(255), DISPLAY_NAME varchar(255),
primary key (OBJECT_ID, REV) primary key (OBJECT_ID, REV)
); );
@ -113,7 +112,7 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.DOMAIN_DESCRIPTIONS ( create table CCM_CORE.DOMAIN_DESCRIPTIONS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
@ -130,14 +129,14 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.DOMAIN_TITLES ( create table CCM_CORE.DOMAIN_TITLES (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
create table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS ( create table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS (
COMPONENT_ID bigint not null, COMPONENT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (COMPONENT_ID, LOCALE) primary key (COMPONENT_ID, LOCALE)
); );
@ -182,14 +181,14 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS ( create table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS (
DATA_QUERY_ID bigint not null, DATA_QUERY_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (DATA_QUERY_ID, LOCALE) primary key (DATA_QUERY_ID, LOCALE)
); );
create table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES ( create table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES (
DATA_QUERY_ID bigint not null, DATA_QUERY_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (DATA_QUERY_ID, LOCALE) primary key (DATA_QUERY_ID, LOCALE)
); );
@ -226,7 +225,7 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.FORMBUILDER_OPTION_LABELS ( create table CCM_CORE.FORMBUILDER_OPTION_LABELS (
OPTION_ID bigint not null, OPTION_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OPTION_ID, LOCALE) primary key (OPTION_ID, LOCALE)
); );
@ -239,14 +238,14 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS ( create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS (
PROCESS_LISTENER_ID bigint not null, PROCESS_LISTENER_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PROCESS_LISTENER_ID, LOCALE) primary key (PROCESS_LISTENER_ID, LOCALE)
); );
create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES ( create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES (
PROCESS_LISTENER_ID bigint not null, PROCESS_LISTENER_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PROCESS_LISTENER_ID, LOCALE) primary key (PROCESS_LISTENER_ID, LOCALE)
); );
@ -405,14 +404,14 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.PAGE_MODEL_DESCRIPTIONS ( create table CCM_CORE.PAGE_MODEL_DESCRIPTIONS (
PAGE_MODEL_ID bigint not null, PAGE_MODEL_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PAGE_MODEL_ID, LOCALE) primary key (PAGE_MODEL_ID, LOCALE)
); );
create table CCM_CORE.PAGE_MODEL_TITLES ( create table CCM_CORE.PAGE_MODEL_TITLES (
PAGE_MODEL_ID bigint not null, PAGE_MODEL_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (PAGE_MODEL_ID, LOCALE) primary key (PAGE_MODEL_ID, LOCALE)
); );
@ -438,7 +437,7 @@ CREATE SCHEMA ccm_shortcuts;
PERMISSION_ID bigint not null, PERMISSION_ID bigint not null,
CREATION_DATE timestamp, CREATION_DATE timestamp,
CREATION_IP varchar(255), CREATION_IP varchar(255),
granted_privilege varchar(255), GRANTED_PRIVILEGE varchar(255),
INHERITED boolean, INHERITED boolean,
CREATION_USER_ID bigint, CREATION_USER_ID bigint,
GRANTEE_ID bigint, GRANTEE_ID bigint,
@ -475,21 +474,21 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.RESOURCE_DESCRIPTIONS ( create table CCM_CORE.RESOURCE_DESCRIPTIONS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
create table CCM_CORE.RESOURCE_TITLES ( create table CCM_CORE.RESOURCE_TITLES (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (OBJECT_ID, LOCALE) primary key (OBJECT_ID, LOCALE)
); );
create table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS ( create table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS (
RESOURCE_TYPE_ID bigint not null, RESOURCE_TYPE_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (RESOURCE_TYPE_ID, LOCALE) primary key (RESOURCE_TYPE_ID, LOCALE)
); );
@ -514,7 +513,7 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.ROLE_DESCRIPTIONS ( create table CCM_CORE.ROLE_DESCRIPTIONS (
ROLE_ID bigint not null, ROLE_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (ROLE_ID, LOCALE) primary key (ROLE_ID, LOCALE)
); );
@ -531,11 +530,11 @@ CREATE SCHEMA ccm_shortcuts;
SETTING_ID bigint not null, SETTING_ID bigint not null,
CONFIGURATION_CLASS varchar(512) not null, CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null, NAME varchar(512) not null,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_DOUBLE double, SETTING_VALUE_DOUBLE double,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_LONG bigint, SETTING_VALUE_LONG bigint,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -546,7 +545,7 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.SETTINGS_L10N_STR_VALUES ( create table CCM_CORE.SETTINGS_L10N_STR_VALUES (
ENTRY_ID bigint not null, ENTRY_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (ENTRY_ID, LOCALE) primary key (ENTRY_ID, LOCALE)
); );
@ -595,14 +594,14 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.WORKFLOW_DESCRIPTIONS ( create table CCM_CORE.WORKFLOW_DESCRIPTIONS (
WORKFLOW_ID bigint not null, WORKFLOW_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (WORKFLOW_ID, LOCALE) primary key (WORKFLOW_ID, LOCALE)
); );
create table CCM_CORE.WORKFLOW_NAMES ( create table CCM_CORE.WORKFLOW_NAMES (
WORKFLOW_ID bigint not null, WORKFLOW_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (WORKFLOW_ID, LOCALE) primary key (WORKFLOW_ID, LOCALE)
); );
@ -616,7 +615,7 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( create table CCM_CORE.WORKFLOW_TASK_COMMENTS (
COMMENT_ID bigint not null, COMMENT_ID bigint not null,
COMMENT longvarchar, COMMENT varchar(2147483647),
UUID varchar(255) not null, UUID varchar(255) not null,
AUTHOR_ID bigint, AUTHOR_ID bigint,
TASK_ID bigint, TASK_ID bigint,
@ -630,14 +629,14 @@ CREATE SCHEMA ccm_shortcuts;
create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS ( create table CCM_CORE.WORKFLOW_TASK_DESCRIPTIONS (
TASK_ID bigint not null, TASK_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (TASK_ID, LOCALE) primary key (TASK_ID, LOCALE)
); );
create table CCM_CORE.WORKFLOW_TASK_LABELS ( create table CCM_CORE.WORKFLOW_TASK_LABELS (
TASK_ID bigint not null, TASK_ID bigint not null,
LOCALIZED_VALUE longvarchar, LOCALIZED_VALUE varchar(2147483647),
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
primary key (TASK_ID, LOCALE) primary key (TASK_ID, LOCALE)
); );
@ -651,13 +650,9 @@ CREATE SCHEMA ccm_shortcuts;
primary key (TASK_ID) primary key (TASK_ID)
); );
create table CCM_CORE.WORKFLOW_TEMPLATES (
WORKFLOW_ID bigint not null,
primary key (WORKFLOW_ID)
);
create table CCM_CORE.WORKFLOWS ( create table CCM_CORE.WORKFLOWS (
WORKFLOW_ID bigint not null, WORKFLOW_ID bigint not null,
abstract_workflow boolean,
ACTIVE boolean, ACTIVE boolean,
WORKFLOW_STATE varchar(255), WORKFLOW_STATE varchar(255),
TASKS_STATE varchar(255), TASKS_STATE varchar(255),
@ -693,7 +688,18 @@ CREATE SCHEMA ccm_shortcuts;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID);
create sequence hibernate_sequence start with 1 increment by 1;
create table CCM_SHORTCUTS.SHORTCUTS (
SHORTCUT_ID bigint not null,
REDIRECT varchar(1024),
URL_KEY varchar(1024),
primary key (SHORTCUT_ID)
);
alter table CCM_SHORTCUTS.SHORTCUTS
add constraint UK_4otuwtog6qqdbg4e6p8xdpw8h unique (URL_KEY);
create sequence hibernate_sequence start with 1 increment by 1;
alter table CCM_CORE.APPLICATIONS alter table CCM_CORE.APPLICATIONS
add constraint FKatcp9ij6mbkx0nfeig1o6n3lm add constraint FKatcp9ij6mbkx0nfeig1o6n3lm
@ -750,11 +756,6 @@ create sequence hibernate_sequence start with 1 increment by 1;
foreign key (REV) foreign key (REV)
references CCM_CORE.CCM_REVISIONS; references CCM_CORE.CCM_REVISIONS;
alter table CCM_CORE.CCM_OBJECTS_AUD
add constraint FKo5s37ctcdny7tmewjwv7705h5
foreign key (REVEND)
references CCM_CORE.CCM_REVISIONS;
alter table CCM_CORE.DIGESTS alter table CCM_CORE.DIGESTS
add constraint FKc53g09agnye3w1v4euy3e0gsi add constraint FKc53g09agnye3w1v4euy3e0gsi
foreign key (FROM_PARTY_ID) foreign key (FROM_PARTY_ID)
@ -1016,7 +1017,7 @@ create sequence hibernate_sequence start with 1 increment by 1;
references CCM_CORE.CCM_ROLES; references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.PERMISSIONS alter table CCM_CORE.PERMISSIONS
add constraint FKc1x3h1p3o20qiwmonpmva7t5i add constraint FKg56ujjoe0j30pq579rf0l5yc6
foreign key (INHERITED_FROM_ID) foreign key (INHERITED_FROM_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
@ -1200,27 +1201,12 @@ create sequence hibernate_sequence start with 1 increment by 1;
foreign key (WORKFLOW_ID) foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS; references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_TEMPLATES
add constraint FK8692vdme4yxnkj1m0k1dw74pk
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKrm2yfrs6veoxoy304upq2wc64 add constraint FKrm2yfrs6veoxoy304upq2wc64
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKeixdxau4jebw682gd49tdbsjy add constraint FK9ray5beiny6wm2mi0uwyecay2
foreign key (TEMPLATE_ID) foreign key (TEMPLATE_ID)
references CCM_CORE.WORKFLOW_TEMPLATES; references CCM_CORE.WORKFLOWS;
create table CCM_SHORTCUTS.SHORTCUTS (
SHORTCUT_ID bigint not null,
REDIRECT varchar(1024),
URL_KEY varchar(1024),
primary key (SHORTCUT_ID)
);
alter table CCM_SHORTCUTS.SHORTCUTS
add constraint UK_4otuwtog6qqdbg4e6p8xdpw8h unique (URL_KEY);

View File

@ -81,7 +81,6 @@ create table CCM_CORE.APPLICATIONS (
OBJECT_ID int8 not null, OBJECT_ID int8 not null,
REV int4 not null, REV int4 not null,
REVTYPE int2, REVTYPE int2,
REVEND int4,
DISPLAY_NAME varchar(255), DISPLAY_NAME varchar(255),
primary key (OBJECT_ID, REV) primary key (OBJECT_ID, REV)
); );
@ -438,7 +437,7 @@ create table CCM_CORE.APPLICATIONS (
PERMISSION_ID int8 not null, PERMISSION_ID int8 not null,
CREATION_DATE timestamp, CREATION_DATE timestamp,
CREATION_IP varchar(255), CREATION_IP varchar(255),
granted_privilege varchar(255), GRANTED_PRIVILEGE varchar(255),
INHERITED boolean, INHERITED boolean,
CREATION_USER_ID int8, CREATION_USER_ID int8,
GRANTEE_ID int8, GRANTEE_ID int8,
@ -531,11 +530,11 @@ create table CCM_CORE.APPLICATIONS (
SETTING_ID int8 not null, SETTING_ID int8 not null,
CONFIGURATION_CLASS varchar(512) not null, CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null, NAME varchar(512) not null,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_DOUBLE float8, SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_LONG int8, SETTING_VALUE_LONG int8,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -651,13 +650,9 @@ create table CCM_CORE.APPLICATIONS (
primary key (TASK_ID) primary key (TASK_ID)
); );
create table CCM_CORE.WORKFLOW_TEMPLATES (
WORKFLOW_ID int8 not null,
primary key (WORKFLOW_ID)
);
create table CCM_CORE.WORKFLOWS ( create table CCM_CORE.WORKFLOWS (
WORKFLOW_ID int8 not null, WORKFLOW_ID int8 not null,
abstract_workflow boolean,
ACTIVE boolean, ACTIVE boolean,
WORKFLOW_STATE varchar(255), WORKFLOW_STATE varchar(255),
TASKS_STATE varchar(255), TASKS_STATE varchar(255),
@ -693,7 +688,18 @@ create table CCM_CORE.APPLICATIONS (
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID); add constraint UK_o113id7d1cxql0edsrohlnn9x unique (UUID);
create sequence hibernate_sequence start 1 increment 1;
create table CCM_SHORTCUTS.SHORTCUTS (
SHORTCUT_ID int8 not null,
REDIRECT varchar(1024),
URL_KEY varchar(1024),
primary key (SHORTCUT_ID)
);
alter table CCM_SHORTCUTS.SHORTCUTS
add constraint UK_4otuwtog6qqdbg4e6p8xdpw8h unique (URL_KEY);
create sequence hibernate_sequence start 1 increment 1;
alter table CCM_CORE.APPLICATIONS alter table CCM_CORE.APPLICATIONS
add constraint FKatcp9ij6mbkx0nfeig1o6n3lm add constraint FKatcp9ij6mbkx0nfeig1o6n3lm
@ -750,11 +756,6 @@ create sequence hibernate_sequence start 1 increment 1;
foreign key (REV) foreign key (REV)
references CCM_CORE.CCM_REVISIONS; references CCM_CORE.CCM_REVISIONS;
alter table CCM_CORE.CCM_OBJECTS_AUD
add constraint FKo5s37ctcdny7tmewjwv7705h5
foreign key (REVEND)
references CCM_CORE.CCM_REVISIONS;
alter table CCM_CORE.DIGESTS alter table CCM_CORE.DIGESTS
add constraint FKc53g09agnye3w1v4euy3e0gsi add constraint FKc53g09agnye3w1v4euy3e0gsi
foreign key (FROM_PARTY_ID) foreign key (FROM_PARTY_ID)
@ -1016,7 +1017,7 @@ create sequence hibernate_sequence start 1 increment 1;
references CCM_CORE.CCM_ROLES; references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.PERMISSIONS alter table CCM_CORE.PERMISSIONS
add constraint FKc1x3h1p3o20qiwmonpmva7t5i add constraint FKg56ujjoe0j30pq579rf0l5yc6
foreign key (INHERITED_FROM_ID) foreign key (INHERITED_FROM_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
@ -1200,28 +1201,12 @@ create sequence hibernate_sequence start 1 increment 1;
foreign key (WORKFLOW_ID) foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS; references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOW_TEMPLATES
add constraint FK8692vdme4yxnkj1m0k1dw74pk
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKrm2yfrs6veoxoy304upq2wc64 add constraint FKrm2yfrs6veoxoy304upq2wc64
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.WORKFLOWS alter table CCM_CORE.WORKFLOWS
add constraint FKeixdxau4jebw682gd49tdbsjy add constraint FK9ray5beiny6wm2mi0uwyecay2
foreign key (TEMPLATE_ID) foreign key (TEMPLATE_ID)
references CCM_CORE.WORKFLOW_TEMPLATES; references CCM_CORE.WORKFLOWS;
create table CCM_SHORTCUTS.SHORTCUTS (
SHORTCUT_ID int8 not null,
REDIRECT varchar(1024),
URL_KEY varchar(1024),
primary key (SHORTCUT_ID)
);
alter table CCM_SHORTCUTS.SHORTCUTS
add constraint UK_4otuwtog6qqdbg4e6p8xdpw8h unique (URL_KEY);