CCM NG: Fixed several bugs found by tests related to the methods of ContentItemManager

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4291 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-09-09 18:53:05 +00:00
parent 437cda2db2
commit 9e593aaf9c
21 changed files with 1219 additions and 99 deletions

View File

@ -163,6 +163,7 @@
<version>2.18.1</version> <version>2.18.1</version>
<configuration> <configuration>
<groups>org.libreccm.tests.categories.UnitTest</groups> <groups>org.libreccm.tests.categories.UnitTest</groups>
<trimStackTrace>false</trimStackTrace>
</configuration> </configuration>
</plugin> </plugin>
@ -280,6 +281,9 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId> <artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version> <version>2.18.1</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.jacoco</groupId> <groupId>org.jacoco</groupId>
@ -417,6 +421,7 @@
<forkMode>always</forkMode> <forkMode>always</forkMode>
<forkCount>999</forkCount> <forkCount>999</forkCount>
<reuseForks>true</reuseForks> <reuseForks>true</reuseForks>
<trimStackTrace>false</trimStackTrace>
<systemPropertyVariables> <systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<!--<jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home> <!--<jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home>
@ -500,6 +505,7 @@
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version> <version>2.19.1</version>
<configuration> <configuration>
<trimStackTrace>false</trimStackTrace>
<forkMode>always</forkMode> <forkMode>always</forkMode>
<forkCount>999</forkCount> <forkCount>999</forkCount>
<reuseForks>true</reuseForks> <reuseForks>true</reuseForks>

View File

@ -30,6 +30,7 @@ import org.librecms.attachments.AttachmentList;
import org.librecms.lifecycle.Lifecycle; import org.librecms.lifecycle.Lifecycle;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -218,6 +219,13 @@ public class ContentItem extends CcmObject implements Serializable,
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
private Workflow workflow; private Workflow workflow;
public ContentItem() {
name = new LocalizedString();
title = new LocalizedString();
description = new LocalizedString();
attachments = new ArrayList<>();
}
public LocalizedString getName() { public LocalizedString getName() {
return name; return name;
} }

View File

@ -180,11 +180,6 @@ public class ContentItemManager {
type.getName())); type.getName()));
} }
final Lifecycle lifecycle = lifecycleManager.createLifecycle(
lifecycleDefinition);
final Workflow workflow = workflowManager.createWorkflow(
workflowTemplate);
final T item; final T item;
try { try {
item = type.newInstance(); item = type.newInstance();
@ -202,10 +197,25 @@ public class ContentItemManager {
item.setDisplayName(name); item.setDisplayName(name);
item.getName().addValue(kernelConfig.getDefaultLocale(), item.getName().addValue(kernelConfig.getDefaultLocale(),
name); name);
item.setLifecycle(lifecycle);
item.setWorkflow(workflow);
categoryManager.addObjectToCategory(item, folder); item.setVersion(ContentItemVersion.DRAFT);
item.setContentType(contentType.get());
if (lifecycleDefinition != null) {
final Lifecycle lifecycle = lifecycleManager.createLifecycle(
lifecycleDefinition);
item.setLifecycle(lifecycle);
}
if (workflowTemplate != null) {
final Workflow workflow = workflowManager.createWorkflow(
workflowTemplate);
item.setWorkflow(workflow);
}
categoryManager.addObjectToCategory(
item,
folder,
CmsConstants.CATEGORIZATION_TYPE_FOLDER);
contentItemRepo.save(item); contentItemRepo.save(item);

View File

@ -135,7 +135,7 @@ public class ContentTypeRepository
try { try {
final Class<?> clazz = Class.forName(className); final Class<?> clazz = Class.forName(className);
if (!clazz.isAssignableFrom(ContentItem.class)) { if (!ContentItem.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"The provided class \"%s\" is not a subclass of \"%s\".", "The provided class \"%s\" is not a subclass of \"%s\".",
className, className,

View File

@ -69,6 +69,7 @@ public class Phase implements Serializable {
private boolean finished; private boolean finished;
@ManyToOne @ManyToOne
@JoinColumn(name = "LIFECYCLE_ID")
private Lifecycle lifecycle; private Lifecycle lifecycle;
@OneToOne @OneToOne

View File

@ -0,0 +1,2 @@
alter table CCM_CMS.LIFECYLE_PHASES
alter column lifecycle_LIFECYCLE_ID rename to LIFECYCLE_ID;

View File

@ -0,0 +1,2 @@
alter table CCM_CMS.LIFECYLE_PHASES
rename column lifecycle_LIFECYCLE_ID to LIFECYCLE_ID;

View File

@ -18,105 +18,263 @@
*/ */
package org.librecms.contentsection; package org.librecms.contentsection;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.arquillian.persistence.CreateSchema;
import org.jboss.arquillian.persistence.PersistenceTest;
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
import org.jboss.arquillian.persistence.UsingDataSet;
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
import org.jboss.arquillian.transaction.api.annotation.Transactional;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType;
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenDependencies;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.libreccm.categorization.Category;
import org.libreccm.security.Shiro;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.workflow.Workflow;
import org.libreccm.workflow.WorkflowRepository;
import org.librecms.contenttypes.Article;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.stream.IntStream;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
/** /**
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@org.junit.experimental.categories.Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"create_ccm_cms_schema.sql"})
public class ContentItemManagerTest { public class ContentItemManagerTest {
@Inject
private ContentSectionRepository sectionRepo;
@Inject
private ContentItemManager itemManager;
@Inject
private Shiro shiro;
@Inject
private EntityManager entityManager;
public ContentItemManagerTest() { public ContentItemManagerTest() {
} }
@BeforeClass @BeforeClass
public static void setUpClass() { public static void setUpClass() {
} }
@AfterClass @AfterClass
public static void tearDownClass() { public static void tearDownClass() {
} }
@Before @Before
public void setUp() { public void setUp() {
} }
@After @After
public void tearDown() { public void tearDown() {
} }
// TODO add test methods here. @Deployment
// The methods must be annotated with annotation @Test. For example: public static WebArchive createDeployment() {
// final PomEquippedResolveStage pom = Maven
// @Test .resolver()
// public void hello() {} .loadPomFromFile("pom.xml");
final PomEquippedResolveStage dependencies = pom
// Create content item .importCompileAndRuntimeDependencies();
dependencies.addDependency(MavenDependencies.createDependency(
"org.libreccm:ccm-core", ScopeType.RUNTIME, false));
dependencies.addDependency(MavenDependencies.createDependency(
"org.libreccm:ccm-testutils", ScopeType.RUNTIME, false));
dependencies.addDependency(MavenDependencies.createDependency(
"net.sf.saxon:Saxon-HE", ScopeType.RUNTIME, false));
dependencies.addDependency(MavenDependencies.createDependency(
"org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven",
ScopeType.RUNTIME, false));
final File[] libsWithCcmCore = dependencies.resolve().withTransitivity()
.asFile();
final List<File> libsList = new ArrayList<>(libsWithCcmCore.length - 1);
IntStream.range(0, libsWithCcmCore.length).forEach(i -> {
final File lib = libsWithCcmCore[i];
if (!lib.getName().startsWith("ccm-core")) {
libsList.add(lib);
}
});
final File[] libs = libsList.toArray(new File[libsList.size()]);
for (File lib : libs) {
System.err.printf("Adding file '%s' to test archive...%n",
lib.getName());
}
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.librecms.contentsection.ContentItemManagerTest.war")
.addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmCore.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.bebop.Component.class.getPackage())
.addPackage(com.arsdigita.bebop.util.BebopConstants.class
.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.runtime.CCMResourceManager.class)
.addClass(
com.arsdigita.ui.admin.applications.AbstractAppInstanceForm.class)
.addClass(
com.arsdigita.ui.admin.applications.AbstractAppSettingsPane.class)
.addClass(
com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class)
.addClass(
com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class)
.addClass(com.arsdigita.cms.dispatcher.ItemResolver.class)
.addPackage(com.arsdigita.util.Lockable.class.getPackage())
.addPackage(com.arsdigita.web.BaseServlet.class.getPackage())
.addPackage(org.librecms.Cms.class.getPackage())
.addPackage(org.librecms.assets.Asset.class.getPackage())
.addPackage(org.librecms.attachments.AttachmentList.class
.getPackage())
.addPackage(org.librecms.lifecycle.Lifecycle.class.getPackage())
.addPackage(org.librecms.contentsection.ContentSection.class
.getPackage())
.addPackage(org.librecms.contenttypes.Article.class.getPackage())
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addAsLibraries(libs)
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource(
"configs/org/librecms/contentsection/ContentItemManagerTest/log4j2.xml",
"log4j2.xml")
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
}
@Test
@InSequence(10)
public void checkInjections() {
assertThat(sectionRepo, is(not(nullValue())));
assertThat(itemManager, is(not(nullValue())));
assertThat(shiro, is(not(nullValue())));
}
@Test
@InSequence(20)
public void checkShiro() {
assertThat(shiro.getSecurityManager(), is(not(nullValue())));
assertThat(shiro.getSystemUser(), is(not(nullValue())));
}
@Test
@InSequence(100)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentItemManagerTest/data.xml")
@ShouldMatchDataSet(value = "datasets/org/librecms/contentsection/"
+ "ContentItemManagerTest/after-create-contentitem.xml",
excludeColumns = {"categorization_id",
"lifecycle_id",
"object_id",
"object_order",
"phase_id",
"task_id",
"uuid",
"workflow_id"
})
public void createContentItem() {
final ContentSection section = sectionRepo.findByLabel("info");
final Category folder = section.getRootDocumentsFolder();
final Article article = itemManager.createContentItem("new-article",
section,
folder,
Article.class);
assertThat("DisplayName has not the expected value.",
article.getDisplayName(), is(equalTo("new-article")));
final Locale locale = new Locale("en");
assertThat("Name has not the expected value.",
article.getName().getValue(locale),
is(equalTo("new-article")));
assertThat("lifecycle was not added to content item.",
article.getLifecycle(), is(not(nullValue())));
assertThat("workflow was not added to content item.",
article.getWorkflow(), is(not(nullValue())));
final TypedQuery<Long> query = entityManager.createQuery(
"SELECT COUNT(w) FROM Workflow w", Long.class);
final long workflowCount = query.getSingleResult();
assertThat("Expected three workflows in database.",
workflowCount, is(3L));
}
// Create content item type not in content section // Create content item type not in content section
// Create content item name null // Create content item name null
// Create content item name empty // Create content item name empty
// Create content item folder null // Create content item folder null
// Create content item folder no a folder // Create content item folder no a folder
// Create content item with lifecycle and workflow // Create content item with lifecycle and workflow
// Create content item with lifecycle and workflow type not in content section // Create content item with lifecycle and workflow type not in content section
// Create content item with lifecycle and workflow name null // Create content item with lifecycle and workflow name null
// Create content item with lifecycle and workflow name empty // Create content item with lifecycle and workflow name empty
// Create content item with lifecycle and workflow folder null // Create content item with lifecycle and workflow folder null
// Create content item with lifecycle and workflow folder no a folder // Create content item with lifecycle and workflow folder no a folder
// Move item // Move item
// Move item item null // Move item item null
// Move item folder null // Move item folder null
// Move item folder not a folder // Move item folder not a folder
// copy item // copy item
// copy item item null // copy item item null
// copy item folder null // copy item folder null
// copy item folder not a folder // copy item folder not a folder
// publish item (draft) // publish item (draft)
// publish item (live) // publish item (live)
// publish item null // publish item null
// unpublish item // unpublish item
// unpublish non live // unpublish non live
// unpublish item null // unpublish item null
// isLive // isLive
// isDraft // isDraft
// getLiveVersion // getLiveVersion
// getDraftVersion // getDraftVersion
// getPendingVersions? // getPendingVersions?
} }

View File

@ -41,6 +41,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.libreccm.categorization.Category; import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryRepository; import org.libreccm.categorization.CategoryRepository;
import org.libreccm.security.Shiro;
import org.libreccm.tests.categories.IntegrationTest; import org.libreccm.tests.categories.IntegrationTest;
import org.librecms.contenttypes.Article; import org.librecms.contenttypes.Article;
import org.librecms.contenttypes.News; import org.librecms.contenttypes.News;
@ -329,23 +330,23 @@ public class ContentItemRepositoryTest {
public void countFilterByFolderAndName() { public void countFilterByFolderAndName() {
final Category folder = categoryRepo.findById(-2100L); final Category folder = categoryRepo.findById(-2100L);
assertThat(itemRepo.countFilterByFolderAndName(folder, "article"), assertThat(itemRepo.countFilterByFolderAndName(folder, "article"),
is(3L)); is(3L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "art"), assertThat(itemRepo.countFilterByFolderAndName(folder, "art"),
is(3L)); is(3L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article1"), assertThat(itemRepo.countFilterByFolderAndName(folder, "article1"),
is(1L)); is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article2"), assertThat(itemRepo.countFilterByFolderAndName(folder, "article2"),
is(1L)); is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article3"), assertThat(itemRepo.countFilterByFolderAndName(folder, "article3"),
is(1L)); is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "news"), assertThat(itemRepo.countFilterByFolderAndName(folder, "news"),
is(1L)); is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article10"), assertThat(itemRepo.countFilterByFolderAndName(folder, "article10"),
is(0L)); is(0L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "foo"), assertThat(itemRepo.countFilterByFolderAndName(folder, "foo"),
is(0L)); is(0L));
} }

View File

@ -49,7 +49,8 @@ public class DatasetsTest extends DatasetsVerifier {
"/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-role.xml", "/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-remove-role.xml",
"/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-rename.xml", "/datasets/org/librecms/contentsection/ContentSectionManagerTest/after-rename.xml",
"/datasets/org/librecms/contentsection/ContentItemRepositoryTest/data.xml", "/datasets/org/librecms/contentsection/ContentItemRepositoryTest/data.xml",
"/datasets/org/librecms/contentsection/ContentItemManagerTest/data.xml"}); "/datasets/org/librecms/contentsection/ContentItemManagerTest/data.xml",
"/datasets/org/librecms/contentsection/ContentItemManagerTest/after-create-contentitem.xml"});
} }
public DatasetsTest(final String datasetPath) { public DatasetsTest(final String datasetPath) {

View File

@ -626,7 +626,7 @@ create table CCM_CMS.ARTICLE_LEADS (
START_DATE_TIME date, START_DATE_TIME date,
STARTED boolean, STARTED boolean,
DEFINITION_ID bigint, DEFINITION_ID bigint,
lifecycle_LIFECYCLE_ID bigint, LIFECYCLE_ID bigint,
primary key (PHASE_ID) primary key (PHASE_ID)
); );
@ -2042,7 +2042,7 @@ create sequence hibernate_sequence start with 1 increment by 1;
alter table CCM_CMS.LIFECYLE_PHASES alter table CCM_CMS.LIFECYLE_PHASES
add constraint FKerihqw4gpb0lwap6x73us7wos add constraint FKerihqw4gpb0lwap6x73us7wos
foreign key (lifecycle_LIFECYCLE_ID) foreign key (LIFECYCLE_ID)
references CCM_CMS.LIFECYCLES; references CCM_CMS.LIFECYCLES;
alter table CCM_CMS.MPA_SECTION_TEXTS alter table CCM_CMS.MPA_SECTION_TEXTS

View File

@ -626,7 +626,7 @@ CREATE SCHEMA ccm_cms;
START_DATE_TIME date, START_DATE_TIME date,
STARTED boolean, STARTED boolean,
DEFINITION_ID int8, DEFINITION_ID int8,
lifecycle_LIFECYCLE_ID int8, LIFECYCLE_ID int8,
primary key (PHASE_ID) primary key (PHASE_ID)
); );
@ -2042,7 +2042,7 @@ create sequence hibernate_sequence start 1 increment 1;
alter table CCM_CMS.LIFECYLE_PHASES alter table CCM_CMS.LIFECYLE_PHASES
add constraint FKerihqw4gpb0lwap6x73us7wos add constraint FKerihqw4gpb0lwap6x73us7wos
foreign key (lifecycle_LIFECYCLE_ID) foreign key (LIFECYCLE_ID)
references CCM_CMS.LIFECYCLES; references CCM_CMS.LIFECYCLES;
alter table CCM_CMS.MPA_SECTION_TEXTS alter table CCM_CMS.MPA_SECTION_TEXTS

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
<Logger name="org.apache.shiro"
level="info">
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.libreccm.security.Shiro"
level="debug">
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.librecms.contentsection.ContentItemManager"
level="debug">
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.librecms.contentsection.ContentItemRepository"
level="debug">
<AppenderRef ref="Console"/>
</Logger>
</Loggers>
</Configuration>

View File

@ -6,7 +6,7 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
CREATE SCHEMA ccm_core; CREATE SCHEMA ccm_core;
CREATE SCHEMA ccm_cms; CREATE SCHEMA ccm_cms;
create table CCM_CMS.ARTICLE_LEADS ( create table CCM_CMS.ARTICLE_LEADS (
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
LOCALIZED_VALUE clob, LOCALIZED_VALUE clob,
LOCALE varchar(255) not null, LOCALE varchar(255) not null,
@ -170,7 +170,7 @@ CREATE SCHEMA ccm_cms;
create table CCM_CMS.BINARY_ASSETS ( create table CCM_CMS.BINARY_ASSETS (
ASSET_DATA blob, ASSET_DATA blob,
FILENAME varchar(512) not null, FILENAME varchar(512) not null,
MIME_TYPE binary(512) not null, MIME_TYPE varchar(512) not null,
DATA_SIZE bigint, DATA_SIZE bigint,
ASSET_ID bigint not null, ASSET_ID bigint not null,
primary key (ASSET_ID) primary key (ASSET_ID)
@ -181,7 +181,7 @@ CREATE SCHEMA ccm_cms;
REV integer not null, REV integer not null,
ASSET_DATA blob, ASSET_DATA blob,
FILENAME varchar(512), FILENAME varchar(512),
MIME_TYPE binary(512), MIME_TYPE varchar(512),
DATA_SIZE bigint, DATA_SIZE bigint,
primary key (ASSET_ID, REV) primary key (ASSET_ID, REV)
); );
@ -273,6 +273,8 @@ CREATE SCHEMA ccm_cms;
VERSION varchar(255), VERSION varchar(255),
OBJECT_ID bigint not null, OBJECT_ID bigint not null,
CONTENT_TYPE_ID bigint, CONTENT_TYPE_ID bigint,
LIFECYCLE_ID bigint,
WORKFLOW_ID bigint,
primary key (OBJECT_ID) primary key (OBJECT_ID)
); );
@ -283,6 +285,8 @@ CREATE SCHEMA ccm_cms;
LAUNCH_DATE date, LAUNCH_DATE date,
VERSION varchar(255), VERSION varchar(255),
CONTENT_TYPE_ID bigint, CONTENT_TYPE_ID bigint,
LIFECYCLE_ID bigint,
WORKFLOW_ID bigint,
primary key (OBJECT_ID, REV) primary key (OBJECT_ID, REV)
); );
@ -622,7 +626,7 @@ CREATE SCHEMA ccm_cms;
START_DATE_TIME date, START_DATE_TIME date,
STARTED boolean, STARTED boolean,
DEFINITION_ID bigint, DEFINITION_ID bigint,
lifecycle_LIFECYCLE_ID bigint, LIFECYCLE_ID bigint,
primary key (PHASE_ID) primary key (PHASE_ID)
); );
@ -876,10 +880,10 @@ CREATE SCHEMA ccm_cms;
create table CCM_CORE.CATEGORIZATIONS ( create table CCM_CORE.CATEGORIZATIONS (
CATEGORIZATION_ID bigint not null, CATEGORIZATION_ID bigint not null,
TYPE varchar(255),
CATEGORY_ORDER bigint, CATEGORY_ORDER bigint,
CATEGORY_INDEX boolean, CATEGORY_INDEX boolean,
OBJECT_ORDER bigint, OBJECT_ORDER bigint,
TYPE varchar(255),
OBJECT_ID bigint, OBJECT_ID bigint,
CATEGORY_ID bigint, CATEGORY_ID bigint,
primary key (CATEGORIZATION_ID) primary key (CATEGORIZATION_ID)
@ -1331,11 +1335,11 @@ CREATE SCHEMA ccm_cms;
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_LONG bigint,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024), SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_LONG bigint,
SETTING_VALUE_DOUBLE double, SETTING_VALUE_DOUBLE double,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -1475,6 +1479,22 @@ CREATE SCHEMA ccm_cms;
add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME);
create sequence hibernate_sequence start with 1 increment by 1; create sequence hibernate_sequence start with 1 increment by 1;
create table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS (
CONTENT_SECTION_ID bigint not null,
LIFECYCLE_DEFINITION_ID bigint not null
);
create table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES (
CONTENT_SECTION_ID bigint not null,
WORKFLOW_TEMPLATE_ID bigint not null
);
alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint UK_dhbp1f81iaw6sl7tg36xh439e unique (LIFECYCLE_DEFINITION_ID);
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
alter table CCM_CMS.ARTICLE_LEADS alter table CCM_CMS.ARTICLE_LEADS
add constraint FK4g66u3qtfyepw0f733kuiiaul add constraint FK4g66u3qtfyepw0f733kuiiaul
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
@ -1706,9 +1726,14 @@ create sequence hibernate_sequence start with 1 increment by 1;
references CCM_CMS.CONTENT_TYPES; references CCM_CMS.CONTENT_TYPES;
alter table CCM_CMS.CONTENT_ITEMS alter table CCM_CMS.CONTENT_ITEMS
add constraint FKi1ce005bvnavqy8xlyim60yav add constraint FKfh1nm46qpw6xcwkmgaqw2iu3h
foreign key (CONTENT_TYPE_ID) foreign key (LIFECYCLE_ID)
references CCM_CMS.CONTENT_TYPES; references CCM_CMS.LIFECYCLES;
alter table CCM_CMS.CONTENT_ITEMS
add constraint FKl00ldjygr6as8gqbt3j14ke7j
foreign key (WORKFLOW_ID)
references CCM_CORE.WORKFLOWS;
alter table CCM_CMS.CONTENT_ITEMS alter table CCM_CMS.CONTENT_ITEMS
add constraint FK1fr2q5y1wpmrufruja5ivfpuf add constraint FK1fr2q5y1wpmrufruja5ivfpuf
@ -1755,6 +1780,21 @@ create sequence hibernate_sequence start with 1 increment by 1;
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
references CCM_CMS.CONTENT_TYPES; references CCM_CMS.CONTENT_TYPES;
alter table CCM_CMS.CONTENT_TYPES
add constraint FKriohuo8093its1k5rgoc5yrfc
foreign key (CONTENT_SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS;
alter table CCM_CMS.CONTENT_TYPES
add constraint FK8s83we1tuh9r3j57dyos69wfa
foreign key (DEFAULT_LIFECYCLE_ID)
references CCM_CMS.LIFECYLE_DEFINITIONS;
alter table CCM_CMS.CONTENT_TYPES
add constraint FKhnu9oikw8rpf22lt5fmk41t7k
foreign key (DEFAULT_WORKFLOW)
references CCM_CORE.WORKFLOW_TEMPLATES;
alter table CCM_CMS.CONTENT_TYPES alter table CCM_CMS.CONTENT_TYPES
add constraint FK96vwsbqfbdg33ujeeawajr0v4 add constraint FK96vwsbqfbdg33ujeeawajr0v4
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
@ -2002,7 +2042,7 @@ create sequence hibernate_sequence start with 1 increment by 1;
alter table CCM_CMS.LIFECYLE_PHASES alter table CCM_CMS.LIFECYLE_PHASES
add constraint FKerihqw4gpb0lwap6x73us7wos add constraint FKerihqw4gpb0lwap6x73us7wos
foreign key (lifecycle_LIFECYCLE_ID) foreign key (LIFECYCLE_ID)
references CCM_CMS.LIFECYCLES; references CCM_CMS.LIFECYCLES;
alter table CCM_CMS.MPA_SECTION_TEXTS alter table CCM_CMS.MPA_SECTION_TEXTS
@ -2694,3 +2734,23 @@ create sequence hibernate_sequence start with 1 increment by 1;
add constraint FKefpdf9ojplu7loo31hfm0wl2h add constraint FKefpdf9ojplu7loo31hfm0wl2h
foreign key (TASK_ID) foreign key (TASK_ID)
references CCM_CORE.WORKFLOW_TASKS; references CCM_CORE.WORKFLOW_TASKS;
alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint FKqnsnk1eju8vrbm7x0wr5od4ll
foreign key (LIFECYCLE_DEFINITION_ID)
references CCM_CMS.LIFECYLE_DEFINITIONS;
alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint FK7daejlunqsnhgky4b92n019a9
foreign key (CONTENT_SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS;
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FKrx08cdjm9tutrp5lvfhgslw48
foreign key (WORKFLOW_TEMPLATE_ID)
references CCM_CORE.WORKFLOW_TEMPLATES;
alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FK6kuejkcl9hcbkr8q6bdlatt8q
foreign key (CONTENT_SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS;

View File

@ -0,0 +1,540 @@
<?xml version="1.0" encoding="utf-8"?>
<dataset>
<ccm_core.workflows workflow_id="-100" />
<ccm_core.workflows workflow_id="-110" />
<ccm_core.workflows workflow_id="-120" />
<ccm_core.workflow_names workflow_id="-100"
locale="en"
localized_value="Standard workflow" />
<ccm_core.workflow_names workflow_id="-110"
locale="en"
localized_value="Fast workflow" />
<ccm_core.workflow_names workflow_id="-120"
locale="en"
localized_value="Standard workflow" />
<ccm_core.workflow_templates workflow_id="-100" />
<ccm_core.workflow_templates workflow_id="-110" />
<ccm_core.workflow_tasks task_id="-100100"
active="false"
task_state="waiting"
workflow_id="-100" />
<ccm_core.workflow_tasks task_id="-100200"
active="false"
task_state="waiting"
workflow_id="-100" />
<ccm_core.workflow_tasks task_id="-110100"
active="false"
task_state="waiting"
workflow_id="-110" />
<ccm_core.workflow_tasks task_id="-120100"
active="false"
task_state="waiting"
workflow_id="-120" />
<ccm_core.workflow_tasks task_id="-120200"
active="false"
task_state="waiting"
workflow_id="-120" />
<ccm_core.workflow_task_labels task_id="-100100"
localized_value="Task 1.1"
locale="en" />
<ccm_core.workflow_task_labels task_id="-100200"
localized_value="Task 1.2"
locale="en" />
<ccm_core.workflow_task_labels task_id="-110100"
localized_value="Task 2.1"
locale="en" />
<ccm_core.workflow_task_labels task_id="-120100"
localized_value="Task 1.1"
locale="en" />
<ccm_core.workflow_task_labels task_id="-120200"
localized_value="Task 1.2"
locale="en" />
<ccm_core.workflow_user_tasks task_id="-100100"
duration_minutes="0"
locked="false" />
<ccm_core.workflow_user_tasks task_id="-100200"
duration_minutes="0"
locked="false" />
<ccm_core.workflow_user_tasks task_id="-110100"
duration_minutes="0"
locked="false" />
<ccm_core.workflow_user_tasks task_id="-120100"
duration_minutes="0"
locked="false" />
<ccm_core.workflow_user_tasks task_id="-120200"
duration_minutes="0"
locked="false" />
<ccm_cms.lifecyle_definitions lifecycle_definition_id="-200" />
<ccm_cms.lifecyle_definitions lifecycle_definition_id="-210" />
<ccm_cms.lifecycle_definition_labels object_id="-200"
localized_value="Default lifecycle"
locale="en" />
<ccm_cms.lifecycle_definition_labels object_id="-210"
localized_value="Alternate lifecycle"
locale="en" />
<ccm_cms.lifecycle_phase_definitions phase_definition_id="-200100"
lifecycle_definition_id="-200"
default_delay="0"
default_duration="0" />
<ccm_cms.lifecycle_phase_definitions phase_definition_id="-200200"
lifecycle_definition_id="-200"
default_delay="0"
default_duration="0" />
<ccm_cms.lifecycle_phase_definitions phase_definition_id="-210100"
lifecycle_definition_id="-210"
default_delay="0"
default_duration="0" />
<ccm_cms.lifecycle_phase_definition_labels object_id="-200100"
localized_value="Phase 1"
locale="en" />
<ccm_cms.lifecycle_phase_definition_labels object_id="-200200"
localized_value="Phase 2"
locale="en" />
<ccm_cms.lifecycle_phase_definition_labels object_id="-210100"
localized_value="The only phase"
locale="en" />
<ccm_cms.lifecycles lifecycle_id="-300"
started="false"
finished="false"
definition_id="-200" />
<ccm_cms.lifecyle_phases phase_id="-300100"
started="false"
finished="false" />
<ccm_cms.lifecyle_phases phase_id="-300200"
started="false"
finished="false" />
<ccm_core.ccm_objects object_id="-1100"
display_name="info"
uuid="963bcae7-3aeb-4b62-891c-e16c4defa1f2" />
<ccm_core.ccm_objects object_id="-2100"
display_name="info_root"
uuid="82014239-9c06-486d-ae8c-4ae47f52a699" />
<ccm_core.ccm_objects object_id="-2200"
display_name="info_assets"
uuid="b163f73c-9ac2-44d7-a037-de621f5ca828" />
<ccm_core.ccm_objects object_id="-10100"
display_name="article1"
uuid="aed4b402-1180-46c6-b42d-7245f4dca248" />
<ccm_core.ccm_objects object_id="-10300"
display_name="article3"
uuid="f4b38abb-234b-4354-bc92-e36c068a1ebd" />
<ccm_core.ccm_objects object_id="-10200"
display_name="article2"
uuid="acae860f-2ffa-450d-b486-054292f0dae6" />
<ccm_core.ccm_objects object_id="-10400"
display_name="news1"
uuid="d9ea527d-c6e3-4bdd-962d-c0a1a80c6c72" />
<ccm_core.ccm_objects object_id="-20100"
display_name="org.librecms.contenttypes.Article"
uuid="2c8ec2fb-319d-4d44-9698-697c08b2b941" />
<ccm_core.ccm_objects object_id="-20200"
display_name="org.librecms.contenttypes.News"
uuid="47740f22-f89f-4ec3-90cf-d62859e53c7e" />
<ccm_core.ccm_objects object_id="-11100"
display_name="new-article"
uuid="cfa0efb6-7ce2-41e8-be03-4ee8c7f18b05" />
<ccm_core.categories object_id="-2100"
unique_id="82014239-9c06-486d-ae8c-4ae47f52a699"
name="info_root"
enabled="true"
visible="true"
abstract_category="false"
category_order="1" />
<ccm_core.categories object_id="-2200"
unique_id="b163f73c-9ac2-44d7-a037-de621f5ca828"
name="info_assets"
enabled="true"
visible="true"
abstract_category="false"
category_order="1" />
<ccm_core.category_titles object_id="-2100"
locale="en"
localized_value="info_root" />
<ccm_core.category_titles object_id="-2200"
locale="en"
localized_value="info_assets" />
<ccm_core.resources object_id="-1100"
created="2016-07-15" />
<ccm_core.resource_titles object_id="-1100"
locale="en"
localized_value="info" />
<ccm_core.applications object_id="-1100"
application_type="org.librecms.contentsection.ContentSection"
primary_url="info" />
<ccm_cms.content_sections object_id="-1100"
label="info"
root_documents_folder_id="-2100"
root_assets_folder_id="-2200" />
<ccm_cms.content_section_workflow_templates
content_section_id="-1100"
workflow_template_id="-100" />
<ccm_cms.content_section_workflow_templates
content_section_id="-1100"
workflow_template_id="-110" />
<ccm_cms.content_section_lifecycle_definitions
content_section_id="-1100"
lifecycle_definition_id="-200" />
<ccm_cms.content_section_lifecycle_definitions
content_section_id="-1100"
lifecycle_definition_id="-210" />
<ccm_cms.content_types object_id="-20100"
content_item_class="org.librecms.contenttypes.Article"
content_section_id="-1100"
default_workflow="-100"
default_lifecycle_id="-200" />
<ccm_cms.content_types object_id="-20200"
content_item_class="org.librecms.contenttypes.News"
content_section_id="-1100"
default_workflow="-100"
default_lifecycle_id="-200" />
<ccm_cms.content_items object_id="-10100"
version="DRAFT"
content_type_id="-20100" />
<ccm_cms.content_items object_id="-10200"
version="DRAFT"
content_type_id="-20100" />
<ccm_cms.content_items object_id="-10300"
version="DRAFT"
content_type_id="-20100" />
<ccm_cms.content_items object_id="-10400"
version="DRAFT"
content_type_id="-20200" />
<ccm_cms.content_items object_id="-11100"
version="DRAFT"
content_type_id="-20100"
workflow_id="-120" />
<ccm_cms.content_item_names object_id="-10100"
locale="en"
localized_value="article1" />
<ccm_cms.content_item_names object_id="-10200"
locale="en"
localized_value="article2" />
<ccm_cms.content_item_names object_id="-10300"
locale="en"
localized_value="article3" />
<ccm_cms.content_item_names object_id="-10400"
locale="en"
localized_value="news1" />
<ccm_cms.content_item_names object_id="-11100"
locale="en"
localized_value="new-article" />
<ccm_cms.content_item_titles object_id="-10100"
locale="en"
localized_value="Article 1" />
<ccm_cms.content_item_titles object_id="-10200"
locale="en"
localized_value="Article 2" />
<ccm_cms.content_item_titles object_id="-10300"
locale="en"
localized_value="Article 3" />
<ccm_cms.content_item_titles object_id="-10400"
locale="en"
localized_value="News 1" />
<!--<ccm_cms.content_item_titles object_id="-11100"
locale="en"
localized_value="new-article" />-->
<ccm_cms.content_type_labels object_id="-20100"
locale="en"
localized_value="Article" />
<ccm_cms.content_type_labels object_id="-20200"
locale="en"
localized_value="News" />
<ccm_cms.articles object_id="-10100" />
<ccm_cms.articles object_id="-10200" />
<ccm_cms.articles object_id="-10300" />
<ccm_cms.articles object_id="-11100" />
<ccm_cms.article_texts
object_id="-10100"
locale="en"
localized_value="Quisque varius turpis et nibh rhoncus consequat. In sapien metus, fermentum quis." />
<ccm_cms.article_texts
object_id="-10200"
locale="en"
localized_value="Duis quis tincidunt elit. In pharetra justo sit amet ipsum dictum, at." />
<ccm_cms.article_texts
object_id="-10300"
locale="en"
localized_value="Etiam euismod lacus laoreet sodales ultricies. Pellentesque non elit vitae purus sagittis." />
<ccm_cms.news object_id="-10400"
news_date="2016-08-08"
homepage="false" />
<ccm_cms.news_texts
object_id="-10400"
locale="en"
localized_value="Curabitur vel sapien eu eros gravida bibendum vitae." />
<ccm_core.categorizations categorization_id="-30100"
category_id="-2100"
object_id="-10100"
category_order="1"
object_order="1"
category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30200"
category_id="-2100"
object_id="-10200"
category_order="1"
object_order="2"
category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30300"
category_id="-2100"
object_id="-10300"
category_order="1"
object_order="3"
category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30400"
category_id="-2100"
object_id="-10400"
category_order="1"
object_order="4"
category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30500"
category_id="-2100"
object_id="-11100"
category_order="1"
object_order="1"
category_index="false"
type="folder" />
<ccm_core.ccm_roles role_id="-3100"
name="info_alert_recipient" />
<ccm_core.ccm_roles role_id="-3200"
name="info_author" />
<ccm_core.ccm_roles role_id="-3300"
name="info_editor" />
<ccm_core.ccm_roles role_id="-3400"
name="info_manager" />
<ccm_core.ccm_roles role_id="-3500"
name="info_publisher" />
<ccm_core.ccm_roles role_id="-3600"
name="info_content_reader" />
<ccm_core.task_assignments task_assignment_id="-910"
task_id="-100100"
role_id="-3200" />
<ccm_core.task_assignments task_assignment_id="-920"
task_id="-100100"
role_id="-3300" />
<ccm_core.task_assignments task_assignment_id="-930"
task_id="-110100"
role_id="-3200" />
<ccm_cms.content_section_roles role_id="-3100"
section_id="-1100" />
<ccm_cms.content_section_roles role_id="-3200"
section_id="-1100" />
<ccm_cms.content_section_roles role_id="-3300"
section_id="-1100" />
<ccm_cms.content_section_roles role_id="-3400"
section_id="-1100" />
<ccm_cms.content_section_roles role_id="-3500"
section_id="-1100" />
<ccm_cms.content_section_roles role_id="-3600"
section_id="-1100" />
<ccm_core.permissions permission_id="-4110"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4120"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4130"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4140"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4150"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4210"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4220"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4230"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4240"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4250"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4260"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4270"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4310"
granted_privilege="administer_roles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4320"
granted_privilege="administer_workflow"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4330"
granted_privilege="administer_lifecyles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4340"
granted_privilege="administer_categories"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4350"
granted_privilege="administer_content_types"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4360"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4370"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4380"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4390"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4400"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4410"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4420"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4430"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4510"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4520"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4530"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4540"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4550"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4560"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4570"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4580"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
<ccm_core.permissions permission_id="-4610"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3600"
creation_date="2016-07-15"/>
</dataset>

View File

@ -1,6 +1,85 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<dataset> <dataset>
<ccm_core.workflows workflow_id="-100" />
<ccm_core.workflows workflow_id="-110" />
<ccm_core.workflow_names workflow_id="-100"
locale="en"
localized_value="Standard workflow" />
<ccm_core.workflow_names workflow_id="-110"
locale="en"
localized_value="Fast workflow" />
<ccm_core.workflow_templates workflow_id="-100" />
<ccm_core.workflow_templates workflow_id="-110" />
<ccm_core.workflow_tasks task_id="-100100"
active="false"
task_state="waiting"
workflow_id="-100" />
<ccm_core.workflow_tasks task_id="-100200"
active="false"
task_state="waiting"
workflow_id="-100" />
<ccm_core.workflow_tasks task_id="-110100"
active="false"
task_state="waiting"
workflow_id="-110" />
<ccm_core.workflow_task_labels task_id="-100100"
localized_value="Task 1.1"
locale="en" />
<ccm_core.workflow_task_labels task_id="-100200"
localized_value="Task 1.2"
locale="en" />
<ccm_core.workflow_task_labels task_id="-110100"
localized_value="Task 2.1"
locale="en" />
<ccm_core.workflow_user_tasks task_id="-100100"
duration_minutes="0"
locked="false" />
<ccm_core.workflow_user_tasks task_id="-100200"
duration_minutes="0"
locked="false" />
<ccm_core.workflow_user_tasks task_id="-110100"
duration_minutes="0"
locked="false" />
<ccm_cms.lifecyle_definitions lifecycle_definition_id="-200" />
<ccm_cms.lifecyle_definitions lifecycle_definition_id="-210" />
<ccm_cms.lifecycle_definition_labels object_id="-200"
localized_value="Default lifecycle"
locale="en" />
<ccm_cms.lifecycle_definition_labels object_id="-210"
localized_value="Alternate lifecycle"
locale="en" />
<ccm_cms.lifecycle_phase_definitions phase_definition_id="-200100"
lifecycle_definition_id="-200"
default_delay="0"
default_duration="0" />
<ccm_cms.lifecycle_phase_definitions phase_definition_id="-200200"
lifecycle_definition_id="-200"
default_delay="0"
default_duration="0" />
<ccm_cms.lifecycle_phase_definitions phase_definition_id="-210100"
lifecycle_definition_id="-210"
default_delay="0"
default_duration="0" />
<ccm_cms.lifecycle_phase_definition_labels object_id="-200100"
localized_value="Phase 1"
locale="en" />
<ccm_cms.lifecycle_phase_definition_labels object_id="-200200"
localized_value="Phase 2"
locale="en" />
<ccm_cms.lifecycle_phase_definition_labels object_id="-210100"
localized_value="The only phase"
locale="en" />
<ccm_core.ccm_objects object_id="-1100" <ccm_core.ccm_objects object_id="-1100"
display_name="info" display_name="info"
uuid="963bcae7-3aeb-4b62-891c-e16c4defa1f2" /> uuid="963bcae7-3aeb-4b62-891c-e16c4defa1f2" />
@ -10,6 +89,24 @@
<ccm_core.ccm_objects object_id="-2200" <ccm_core.ccm_objects object_id="-2200"
display_name="info_assets" display_name="info_assets"
uuid="b163f73c-9ac2-44d7-a037-de621f5ca828" /> uuid="b163f73c-9ac2-44d7-a037-de621f5ca828" />
<ccm_core.ccm_objects object_id="-10100"
display_name="article1"
uuid="aed4b402-1180-46c6-b42d-7245f4dca248" />
<ccm_core.ccm_objects object_id="-10300"
display_name="article3"
uuid="f4b38abb-234b-4354-bc92-e36c068a1ebd" />
<ccm_core.ccm_objects object_id="-10200"
display_name="article2"
uuid="acae860f-2ffa-450d-b486-054292f0dae6" />
<ccm_core.ccm_objects object_id="-10400"
display_name="news1"
uuid="d9ea527d-c6e3-4bdd-962d-c0a1a80c6c72" />
<ccm_core.ccm_objects object_id="-20100"
display_name="org.librecms.contenttypes.Article"
uuid="2c8ec2fb-319d-4d44-9698-697c08b2b941" />
<ccm_core.ccm_objects object_id="-20200"
display_name="org.librecms.contenttypes.News"
uuid="47740f22-f89f-4ec3-90cf-d62859e53c7e" />
<ccm_core.categories object_id="-2100" <ccm_core.categories object_id="-2100"
unique_id="82014239-9c06-486d-ae8c-4ae47f52a699" unique_id="82014239-9c06-486d-ae8c-4ae47f52a699"
@ -25,7 +122,7 @@
visible="true" visible="true"
abstract_category="false" abstract_category="false"
category_order="1" /> category_order="1" />
<ccm_core.category_titles object_id="-2100" <ccm_core.category_titles object_id="-2100"
locale="en" locale="en"
localized_value="info_root" /> localized_value="info_root" />
@ -48,8 +145,134 @@
root_documents_folder_id="-2100" root_documents_folder_id="-2100"
root_assets_folder_id="-2200" /> root_assets_folder_id="-2200" />
<ccm_cms.content_section_workflow_templates
content_section_id="-1100"
workflow_template_id="-100" />
<ccm_cms.content_section_workflow_templates
content_section_id="-1100"
workflow_template_id="-110" />
<ccm_cms.content_section_lifecycle_definitions
content_section_id="-1100"
lifecycle_definition_id="-200" />
<ccm_cms.content_section_lifecycle_definitions
content_section_id="-1100"
lifecycle_definition_id="-210" />
<ccm_cms.content_types object_id="-20100"
content_item_class="org.librecms.contenttypes.Article"
content_section_id="-1100"
default_workflow="-100"
default_lifecycle_id="-200" />
<ccm_cms.content_types object_id="-20200"
content_item_class="org.librecms.contenttypes.News"
content_section_id="-1100"
default_workflow="-100"
default_lifecycle_id="-200" />
<ccm_cms.content_items object_id="-10100"
version="DRAFT"
content_type_id="-20100" />
<ccm_cms.content_items object_id="-10200"
version="DRAFT"
content_type_id="-20100" />
<ccm_cms.content_items object_id="-10300"
version="DRAFT"
content_type_id="-20100" />
<ccm_cms.content_items object_id="-10400"
version="DRAFT"
content_type_id="-20200" />
<ccm_cms.content_item_names object_id="-10100"
locale="en"
localized_value="article1" />
<ccm_cms.content_item_names object_id="-10200"
locale="en"
localized_value="article2" />
<ccm_cms.content_item_names object_id="-10300"
locale="en"
localized_value="article3" />
<ccm_cms.content_item_names object_id="-10400"
locale="en"
localized_value="news1" />
<ccm_cms.content_item_titles object_id="-10100"
locale="en"
localized_value="Article 1" />
<ccm_cms.content_item_titles object_id="-10200"
locale="en"
localized_value="Article 2" />
<ccm_cms.content_item_titles object_id="-10300"
locale="en"
localized_value="Article 3" />
<ccm_cms.content_item_titles object_id="-10400"
locale="en"
localized_value="News 1" />
<ccm_cms.content_type_labels object_id="-20100"
locale="en"
localized_value="Article" />
<ccm_cms.content_type_labels object_id="-20200"
locale="en"
localized_value="News" />
<ccm_cms.articles object_id="-10100" />
<ccm_cms.articles object_id="-10200" />
<ccm_cms.articles object_id="-10300" />
<ccm_cms.article_texts
object_id="-10100"
locale="en"
localized_value="Quisque varius turpis et nibh rhoncus consequat. In sapien metus, fermentum quis." />
<ccm_cms.article_texts
object_id="-10200"
locale="en"
localized_value="Duis quis tincidunt elit. In pharetra justo sit amet ipsum dictum, at." />
<ccm_cms.article_texts
object_id="-10300"
locale="en"
localized_value="Etiam euismod lacus laoreet sodales ultricies. Pellentesque non elit vitae purus sagittis." />
<ccm_cms.news object_id="-10400"
news_date="2016-08-08"
homepage="false" />
<ccm_cms.news_texts
object_id="-10400"
locale="en"
localized_value="Curabitur vel sapien eu eros gravida bibendum vitae." />
<ccm_core.categorizations categorization_id="-30100"
category_id="-2100"
object_id="-10100"
category_order="1"
object_order="1"
category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30200"
category_id="-2100"
object_id="-10200"
category_order="1"
object_order="2"
category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30300"
category_id="-2100"
object_id="-10300"
category_order="1"
object_order="3"
category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30400"
category_id="-2100"
object_id="-10400"
category_order="1"
object_order="4"
category_index="false"
type="folder" />
<ccm_core.ccm_roles role_id="-3100" <ccm_core.ccm_roles role_id="-3100"
name="info_alert_recipient" /> name="info_alert_recipient" />
<ccm_core.ccm_roles role_id="-3200" <ccm_core.ccm_roles role_id="-3200"
name="info_author" /> name="info_author" />
<ccm_core.ccm_roles role_id="-3300" <ccm_core.ccm_roles role_id="-3300"
@ -61,6 +284,16 @@
<ccm_core.ccm_roles role_id="-3600" <ccm_core.ccm_roles role_id="-3600"
name="info_content_reader" /> name="info_content_reader" />
<ccm_core.task_assignments task_assignment_id="-910"
task_id="-100100"
role_id="-3200" />
<ccm_core.task_assignments task_assignment_id="-920"
task_id="-100100"
role_id="-3300" />
<ccm_core.task_assignments task_assignment_id="-930"
task_id="-110100"
role_id="-3200" />
<ccm_cms.content_section_roles role_id="-3100" <ccm_cms.content_section_roles role_id="-3100"
section_id="-1100" /> section_id="-1100" />
<ccm_cms.content_section_roles role_id="-3200" <ccm_cms.content_section_roles role_id="-3200"

View File

@ -14,22 +14,54 @@ DELETE FROM ccm_cms.content_items;
DELETE FROM ccm_cms.content_section_lifecycle_definitions; DELETE FROM ccm_cms.content_section_lifecycle_definitions;
DELETE FROM ccm_cms.lifecycle_definition_labels;
DELETE FROM ccm_cms.lifecycle_definition_descriptions;
DELETE FROM ccm_cms.lifecyle_definitions;
DELETE FROM ccm_cms.content_section_workflow_templates;
DELETE FROM ccm_core.workflow_templates;
DELETE FROM ccm_cms.content_type_labels; DELETE FROM ccm_cms.content_type_labels;
DELETE FROM ccm_cms.content_type_descriptions; DELETE FROM ccm_cms.content_type_descriptions;
DELETE FROM ccm_cms.content_types; DELETE FROM ccm_cms.content_types;
DELETE FROM ccm_cms.workflow_task_types;
DELETE FROM ccm_cms.workflow_tasks;
DELETE FROM ccm_core.workflow_descriptions;
DELETE FROM ccm_core.workflow_names;
DELETE FROM ccm_core.workflow_task_dependencies;
DELETE FROM ccm_core.workflow_task_labels;
DELETE FROM ccm_core.task_assignments;
DELETE FROM ccm_core.workflow_user_tasks;
DELETE FROM ccm_core.workflow_tasks;
DELETE FROM ccm_core.workflow_tasks_descriptions;
DELETE FROM ccm_cms.content_section_workflow_templates;
DELETE FROM ccm_core.workflow_templates;
DELETE FROM ccm_core.workflows;
DELETE FROM ccm_cms.lifecycle_phase_definition_labels;
DELETE FROM ccm_cms.lifecycle_phase_definition_descriptions;
DELETE FROM ccm_cms.lifecycle_definition_labels;
DELETE FROM ccm_cms.lifecycle_definition_descriptions;
DELETE FROM ccm_cms.lifecyle_phases;
DELETE FROM ccm_cms.lifecycles;
DELETE FROM ccm_cms.lifecycle_phase_definitions;
DELETE FROM ccm_cms.lifecyle_definitions;
DELETE FROM ccm_cms.content_section_roles; DELETE FROM ccm_cms.content_section_roles;
DELETE FROM ccm_cms.content_sections; DELETE FROM ccm_cms.content_sections;

View File

@ -14,12 +14,6 @@ DELETE FROM ccm_cms.content_items;
DELETE FROM ccm_cms.content_section_lifecycle_definitions; DELETE FROM ccm_cms.content_section_lifecycle_definitions;
DELETE FROM ccm_cms.lifecycle_definition_labels;
DELETE FROM ccm_cms.lifecycle_definition_descriptions;
DELETE FROM ccm_cms.lifecyle_definitions;
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.workflow_templates;
@ -30,6 +24,12 @@ DELETE FROM ccm_cms.content_type_descriptions;
DELETE FROM ccm_cms.content_types; DELETE FROM ccm_cms.content_types;
DELETE FROM ccm_cms.lifecycle_definition_labels;
DELETE FROM ccm_cms.lifecycle_definition_descriptions;
DELETE FROM ccm_cms.lifecyle_definitions;
DELETE FROM ccm_cms.content_section_roles; DELETE FROM ccm_cms.content_section_roles;
DELETE FROM ccm_cms.content_sections; DELETE FROM ccm_cms.content_sections;

View File

@ -5,7 +5,7 @@
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"> version="2.5">
<display-name>CcmCoreTest</display-name> <display-name>CcmCmsTest</display-name>
<filter> <filter>
<filter-name>ShiroFilter</filter-name> <filter-name>ShiroFilter</filter-name>

View File

@ -19,6 +19,7 @@
package org.libreccm.workflow; package org.libreccm.workflow;
import org.libreccm.core.CoreConstants; import org.libreccm.core.CoreConstants;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.RequiresPrivilege; import org.libreccm.security.RequiresPrivilege;
import org.libreccm.security.Role; import org.libreccm.security.Role;
@ -70,13 +71,24 @@ public class WorkflowManager {
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
public Workflow createWorkflow(final WorkflowTemplate template) { public Workflow createWorkflow(final WorkflowTemplate template) {
final Workflow workflow = new Workflow(); final Workflow workflow = new Workflow();
final LocalizedString name = new LocalizedString();
template.getName().getValues().forEach(
(locale, str) -> name.addValue(locale, str));
workflow.setName(name);
final LocalizedString description = new LocalizedString();
template.getDescription().getValues().forEach(
(locale, str) -> description.addValue(locale, str));
workflow.setDescription(description);
final Map<Long, Task> tasks = new HashMap<>(); final Map<Long, Task> tasks = new HashMap<>();
template.getTasks().forEach(taskTemplate -> createTask(taskTemplate, template.getTasks().forEach(taskTemplate -> createTask(taskTemplate,
tasks)); tasks));
template.getTasks().forEach(taskTemplate -> fixTaskDependencies( template.getTasks().forEach(taskTemplate -> fixTaskDependencies(
taskTemplate, tasks.get(taskTemplate.getTaskId()), tasks)); taskTemplate, tasks.get(taskTemplate.getTaskId()), tasks));
tasks.values().forEach(task -> taskRepo.save(task)); tasks.values().forEach(task -> taskRepo.save(task));
workflowRepo.save(workflow); workflowRepo.save(workflow);
@ -105,15 +117,31 @@ public class WorkflowManager {
if ("taskId".equals(propertyDesc.getName()) if ("taskId".equals(propertyDesc.getName())
|| "workflow".equals(propertyDesc.getName()) || "workflow".equals(propertyDesc.getName())
|| "dependentTasks".equals(propertyDesc.getName()) || "dependentTasks".equals(propertyDesc.getName())
|| "dependsOn".equals(propertyDesc.getName())) { || "dependsOn".equals(propertyDesc.getName())
|| "assignments".equals(propertyDesc.getName())
|| "class".equals(propertyDesc.getName())) {
continue; continue;
} }
final Method readMethod = propertyDesc.getReadMethod(); final Method readMethod = propertyDesc.getReadMethod();
final Method writeMethod = propertyDesc.getWriteMethod(); final Method writeMethod = propertyDesc.getWriteMethod();
if (writeMethod == null) {
continue;
}
final Object value = readMethod.invoke(template); final Object value = readMethod.invoke(template);
writeMethod.invoke(task, value); if (value instanceof LocalizedString) {
final LocalizedString localized = (LocalizedString) value;
final LocalizedString copy = new LocalizedString();
localized.getValues().forEach(
(locale, str) -> copy.addValue(locale, str));
writeMethod.invoke(task, copy);
} else {
writeMethod.invoke(task, value);
}
} catch (IllegalAccessException | } catch (IllegalAccessException |
IllegalArgumentException | IllegalArgumentException |
InvocationTargetException ex) { InvocationTargetException ex) {

View File

@ -178,6 +178,13 @@ public class CategoryManagerTest {
System.out.println("Dataset loaded successfully."); System.out.println("Dataset loaded successfully.");
} }
@Test
@InSequence(20)
public void checkShiro() {
assertThat(shiro.getSecurityManager(), is(not(nullValue())));
assertThat(shiro.getSystemUser(), is(not(nullValue())));
}
@Test @Test
@UsingDataSet( @UsingDataSet(
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml") "datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")