CCM NG: Several bug fixes for queries etc.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4290 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-09-09 08:09:46 +00:00
parent 448199806e
commit 437cda2db2
12 changed files with 300 additions and 69 deletions

View File

@ -26,7 +26,6 @@ import org.librecms.contentsection.ContentSection;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
/** /**
* <p> * <p>

View File

@ -66,50 +66,62 @@ import static org.librecms.CmsConstants.*;
@NamedQueries({ @NamedQueries({
@NamedQuery( @NamedQuery(
name = "ContentItem.findByType", name = "ContentItem.findByType",
query = "SELECT i FROM ContentItem i WHERE TYPE(I) = :type"), query = "SELECT i FROM ContentItem i WHERE TYPE(i) = :type"),
@NamedQuery( @NamedQuery(
name = "ContentItem.findByFolder", name = "ContentItem.findByFolder",
query = "SELECT c.categorizedObject FROM Categorization c " query = "SELECT i FROM ContentItem i "
+ "JOIN i.categories c "
+ "WHERE c.category = :folder " + "WHERE c.category = :folder "
+ "AND TYPE(c.categorizedObject) IN ContentItem"), + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "'"),
@NamedQuery( @NamedQuery(
name = "ContentItem.countItemsInFolder", name = "ContentItem.countItemsInFolder",
query = "SELECT COUNT(c) FROM Categorization c " query = "SELECT count(i) FROM ContentItem i "
+ "JOIN i.categories c "
+ "WHERE c.category = :folder " + "WHERE c.category = :folder "
+ "AND TYPE(c.categorizedObject) IN ContentItem"), + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "'"),
@NamedQuery( @NamedQuery(
name = "ContentItem.countByNameInFolder", name = "ContentItem.countByNameInFolder",
query = "SELECT count(c) FROM Categorization c " query = "SELECT COUNT(i) FROM ContentItem i "
+ "JOIN i.categories c "
+ "WHERE c.category = :folder " + "WHERE c.category = :folder "
+ "AND c.categorizedObject.displayName = :name"), + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
+ "AND i.displayName = :name"),
@NamedQuery( @NamedQuery(
name = "ContentItem.filterByNameAndFolder", name = "ContentItem.filterByFolderAndName",
query = "SELECT c.categorizedObject FROM Categorization c " query = "SELECT i FROM ContentItem i "
+ "JOIN i.categories c "
+ "WHERE c.category = :folder " + "WHERE c.category = :folder "
+ "AND TYPE(c.categorizedObject) IN (ContentItem)" + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
+ "AND (LOWER(c.categorizedObject.displayName) LIKE CONCAT(LOWER(:name), '%') "), + "AND LOWER(i.displayName) LIKE CONCAT(LOWER(:name), '%')"),
@NamedQuery( @NamedQuery(
name = "ContentItem.countFilterByNameAndFolder", name = "ContentItem.countFilterByFolderAndName",
query = "SELECT count(c) FROM Categorization c " query = "SELECT COUNT(i) FROM ContentItem i "
+ "JOIN i.categories c "
+ "WHERE c.category = :folder " + "WHERE c.category = :folder "
+ "AND TYPE(c.categorizedObject) IN (ContentItem)" + "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
+ "AND LOWER(c.categorizedObject.displayName) LIKE CONCAT(LOWER(:name), '%s') "), + "AND LOWER(i.displayName) LIKE CONCAT(LOWER(:name), '%')"
// query = "SELECT COUNT(c) FROM Categorization c "
// + "JOIN c.categorizedObject o "
// + "WHERE c.category = :folder "
// + "AND TYPE(o) IN (ContentItem) "
// + "AND LOWER(o.displayName) LIKE CONCAT(LOWER(:name), '%s') "
),
@NamedQuery( @NamedQuery(
name = "ContentItem.hasLiveVersion", name = "ContentItem.hasLiveVersion",
query = "SELECT (CASE WHEN COUNT(i) > 0 THEN true ELSE false END) " query = "SELECT (CASE WHEN COUNT(i) > 0 THEN true ELSE false END) "
+ "FROM ContentItem i " + "FROM ContentItem i "
+ "WHERE i.uuid = :uuid " + "WHERE i.uuid = ':uuid' "
+ "AND i.version = \"LIVE\""), + "AND i.version = 'LIVE'"),
@NamedQuery( @NamedQuery(
name = "ContentItem.findDraftVersion", name = "ContentItem.findDraftVersion",
query = "SELECT i FROM ContentItem i " query = "SELECT i FROM ContentItem i "
+ "WHERE i.uuid = :uuid " + "WHERE i.uuid = ':uuid' "
+ "AND i.version = \"DRAFT\""), + "AND i.version = 'DRAFT'"),
@NamedQuery( @NamedQuery(
name = "ContentItem.findLiveVersion", name = "ContentItem.findLiveVersion",
query = "SELECT i FROM ContentItem i " query = "SELECT i FROM ContentItem i "
+ "WHERE i.uuid = :uuid " + "WHERE i.uuid = ':uuid' "
+ "AND i.version = \"LIVE\"") + "AND i.version = 'LIVE'")
}) })
public class ContentItem extends CcmObject implements Serializable, public class ContentItem extends CcmObject implements Serializable,

View File

@ -25,6 +25,7 @@ import org.libreccm.core.CcmObjectRepository;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
@ -213,7 +214,7 @@ public class ContentItemRepository
public List<ContentItem> filterByFolderAndName(final Category folder, public List<ContentItem> filterByFolderAndName(final Category folder,
final String name) { final String name) {
final TypedQuery<ContentItem> query = getEntityManager() final TypedQuery<ContentItem> query = getEntityManager()
.createNamedQuery("ContentItem.filterByNameAndFolder", .createNamedQuery("ContentItem.filterByFolderAndName",
ContentItem.class); ContentItem.class);
query.setParameter("folder", folder); query.setParameter("folder", folder);
query.setParameter("name", name); query.setParameter("name", name);
@ -233,7 +234,7 @@ public class ContentItemRepository
public long countFilterByFolderAndName(final Category folder, public long countFilterByFolderAndName(final Category folder,
final String name) { final String name) {
final TypedQuery<Long> query = getEntityManager() final TypedQuery<Long> query = getEntityManager()
.createNamedQuery("ContentItem.countFilterByNameAndFolder", .createNamedQuery("ContentItem.countFilterByFolderAndName",
Long.class); Long.class);
query.setParameter("folder", folder); query.setParameter("folder", folder);
query.setParameter("name", name); query.setParameter("name", name);

View File

@ -126,6 +126,7 @@ public class ContentSection extends CcmApplication implements Serializable {
@OneToMany @OneToMany
@JoinTable( @JoinTable(
name = "CONTENT_SECTION_LIFECYCLE_DEFINITIONS", name = "CONTENT_SECTION_LIFECYCLE_DEFINITIONS",
schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "CONTENT_SECTION_ID") @JoinColumn(name = "CONTENT_SECTION_ID")
}, },
@ -138,6 +139,7 @@ public class ContentSection extends CcmApplication implements Serializable {
@OneToMany @OneToMany
@JoinTable( @JoinTable(
name = "CONTENT_SECTION_WORKFLOW_TEMPLATES", name = "CONTENT_SECTION_WORKFLOW_TEMPLATES",
schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "CONTENT_SECTION_ID") @JoinColumn(name = "CONTENT_SECTION_ID")
}, },

View File

@ -1,35 +1,35 @@
create table CONTENT_SECTION_LIFECYCLE_DEFINITIONS ( create table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS (
CONTENT_SECTION_ID bigint not null, CONTENT_SECTION_ID bigint not null,
LIFECYCLE_DEFINITION_ID bigint not null LIFECYCLE_DEFINITION_ID bigint not null
); );
create table CONTENT_SECTION_WORKFLOW_TEMPLATES ( create table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES (
CONTENT_SECTION_ID bigint not null, CONTENT_SECTION_ID bigint not null,
WORKFLOW_TEMPLATE_ID bigint not null WORKFLOW_TEMPLATE_ID bigint not null
); );
alter table CONTENT_SECTION_LIFECYCLE_DEFINITIONS alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint UK_dhbp1f81iaw6sl7tg36xh439e unique (LIFECYCLE_DEFINITION_ID); add constraint UK_dhbp1f81iaw6sl7tg36xh439e unique (LIFECYCLE_DEFINITION_ID);
alter table CONTENT_SECTION_WORKFLOW_TEMPLATES alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID); add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
alter table CONTENT_SECTION_LIFECYCLE_DEFINITIONS alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint FKqnsnk1eju8vrbm7x0wr5od4ll add constraint FKqnsnk1eju8vrbm7x0wr5od4ll
foreign key (LIFECYCLE_DEFINITION_ID) foreign key (LIFECYCLE_DEFINITION_ID)
references CCM_CMS.LIFECYLE_DEFINITIONS; references CCM_CMS.LIFECYLE_DEFINITIONS;
alter table CONTENT_SECTION_LIFECYCLE_DEFINITIONS alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint FK7daejlunqsnhgky4b92n019a9 add constraint FK7daejlunqsnhgky4b92n019a9
foreign key (CONTENT_SECTION_ID) foreign key (CONTENT_SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS; references CCM_CMS.CONTENT_SECTIONS;
alter table CONTENT_SECTION_WORKFLOW_TEMPLATES alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FKrx08cdjm9tutrp5lvfhgslw48 add constraint FKrx08cdjm9tutrp5lvfhgslw48
foreign key (WORKFLOW_TEMPLATE_ID) foreign key (WORKFLOW_TEMPLATE_ID)
references CCM_CORE.WORKFLOW_TEMPLATES; references CCM_CORE.WORKFLOW_TEMPLATES;
alter table CONTENT_SECTION_WORKFLOW_TEMPLATES alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FK6kuejkcl9hcbkr8q6bdlatt8q add constraint FK6kuejkcl9hcbkr8q6bdlatt8q
foreign key (CONTENT_SECTION_ID) foreign key (CONTENT_SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS; references CCM_CMS.CONTENT_SECTIONS;

View File

@ -1,35 +1,35 @@
create table CONTENT_SECTION_LIFECYCLE_DEFINITIONS ( create table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS (
CONTENT_SECTION_ID int8 not null, CONTENT_SECTION_ID int8 not null,
LIFECYCLE_DEFINITION_ID int8 not null LIFECYCLE_DEFINITION_ID int8 not null
); );
create table CONTENT_SECTION_WORKFLOW_TEMPLATES ( create table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES (
CONTENT_SECTION_ID int8 not null, CONTENT_SECTION_ID int8 not null,
WORKFLOW_TEMPLATE_ID int8 not null WORKFLOW_TEMPLATE_ID int8 not null
); );
alter table CONTENT_SECTION_LIFECYCLE_DEFINITIONS alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint UK_dhbp1f81iaw6sl7tg36xh439e unique (LIFECYCLE_DEFINITION_ID); add constraint UK_dhbp1f81iaw6sl7tg36xh439e unique (LIFECYCLE_DEFINITION_ID);
alter table CONTENT_SECTION_WORKFLOW_TEMPLATES alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID); add constraint UK_goj42ghwu4tf1akfb2r6ensns unique (WORKFLOW_TEMPLATE_ID);
alter table CONTENT_SECTION_LIFECYCLE_DEFINITIONS alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint FKqnsnk1eju8vrbm7x0wr5od4ll add constraint FKqnsnk1eju8vrbm7x0wr5od4ll
foreign key (LIFECYCLE_DEFINITION_ID) foreign key (LIFECYCLE_DEFINITION_ID)
references CCM_CMS.LIFECYLE_DEFINITIONS; references CCM_CMS.LIFECYLE_DEFINITIONS;
alter table CONTENT_SECTION_LIFECYCLE_DEFINITIONS alter table CCM_CMS.CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint FK7daejlunqsnhgky4b92n019a9 add constraint FK7daejlunqsnhgky4b92n019a9
foreign key (CONTENT_SECTION_ID) foreign key (CONTENT_SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS; references CCM_CMS.CONTENT_SECTIONS;
alter table CONTENT_SECTION_WORKFLOW_TEMPLATES alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FKrx08cdjm9tutrp5lvfhgslw48 add constraint FKrx08cdjm9tutrp5lvfhgslw48
foreign key (WORKFLOW_TEMPLATE_ID) foreign key (WORKFLOW_TEMPLATE_ID)
references CCM_CORE.WORKFLOW_TEMPLATES; references CCM_CORE.WORKFLOW_TEMPLATES;
alter table CONTENT_SECTION_WORKFLOW_TEMPLATES alter table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES
add constraint FK6kuejkcl9hcbkr8q6bdlatt8q add constraint FK6kuejkcl9hcbkr8q6bdlatt8q
foreign key (CONTENT_SECTION_ID) foreign key (CONTENT_SECTION_ID)
references CCM_CMS.CONTENT_SECTIONS; references CCM_CMS.CONTENT_SECTIONS;

View File

@ -127,7 +127,7 @@ public class ContentItemRepositoryTest {
return ShrinkWrap return ShrinkWrap
.create(WebArchive.class, .create(WebArchive.class,
"LibreCCM-org.libreccm.cms.contentsection.ContentItemRepositoryTest.war") "LibreCCM-org.librecms.contentsection.ContentItemRepositoryTest.war")
.addPackage(org.libreccm.auditing.CcmRevision.class.getPackage()) .addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class .addPackage(org.libreccm.categorization.Categorization.class
.getPackage()) .getPackage())
@ -157,6 +157,7 @@ public class ContentItemRepositoryTest {
com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class) com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class)
.addClass( .addClass(
com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class) com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class)
.addClass(com.arsdigita.cms.dispatcher.ItemResolver.class)
.addPackage(com.arsdigita.util.Lockable.class.getPackage()) .addPackage(com.arsdigita.util.Lockable.class.getPackage())
.addPackage(com.arsdigita.web.BaseServlet.class.getPackage()) .addPackage(com.arsdigita.web.BaseServlet.class.getPackage())
.addPackage(org.librecms.Cms.class.getPackage()) .addPackage(org.librecms.Cms.class.getPackage())
@ -213,7 +214,6 @@ public class ContentItemRepositoryTest {
assertThat(articleAsNews.isPresent(), is(false)); assertThat(articleAsNews.isPresent(), is(false));
} }
@Test @Test
@InSequence(200) @InSequence(200)
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
@ -267,11 +267,86 @@ public class ContentItemRepositoryTest {
public void findByFolder() { public void findByFolder() {
final Category folder = categoryRepo.findById(-2100L); final Category folder = categoryRepo.findById(-2100L);
assertThat(folder.getObjects().size(), is(4));
final List<ContentItem> items = itemRepo.findByFolder(folder); final List<ContentItem> items = itemRepo.findByFolder(folder);
assertThat(items, is(not(nullValue()))); assertThat(items, is(not(nullValue())));
assertThat(items.size(), is(4)); assertThat(items.size(), is(4));
}
@Test
@InSequence(410)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentItemRepositoryTest/data.xml")
public void countItemsInFolder() {
final Category folder = categoryRepo.findById(-2100L);
assertThat(itemRepo.countItemsInFolder(folder), is(4L));
}
@Test
@InSequence(500)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentItemRepositoryTest/data.xml")
public void countByNameInFolder() {
final Category folder = categoryRepo.findById(-2100L);
assertThat(itemRepo.countByNameInFolder(folder, "article1"), is(1L));
assertThat(itemRepo.countByNameInFolder(folder, "article2"), is(1L));
assertThat(itemRepo.countByNameInFolder(folder, "article3"), is(1L));
assertThat(itemRepo.countByNameInFolder(folder, "article4"), is(0L));
assertThat(itemRepo.countByNameInFolder(folder, "article"), is(0L));
assertThat(itemRepo.countByNameInFolder(folder, "news1"), is(1L));
}
@Test
@InSequence(500)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentItemRepositoryTest/data.xml")
public void filterByFolderAndName() {
final Category folder = categoryRepo.findById(-2100L);
final List<ContentItem> articles = itemRepo.filterByFolderAndName(
folder, "article");
final List<ContentItem> news = itemRepo.filterByFolderAndName(folder,
"news");
assertThat(articles.size(), is(3));
assertThat(news.size(), is(1));
assertThat(articles.get(0).getDisplayName(), is(equalTo("article1")));
assertThat(articles.get(1).getDisplayName(), is(equalTo("article2")));
assertThat(articles.get(2).getDisplayName(), is(equalTo("article3")));
assertThat(news.get(0).getDisplayName(), is(equalTo("news1")));
}
@Test
@InSequence(510)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentItemRepositoryTest/data.xml")
public void countFilterByFolderAndName() {
final Category folder = categoryRepo.findById(-2100L);
assertThat(itemRepo.countFilterByFolderAndName(folder, "article"),
is(3L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "art"),
is(3L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article1"),
is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article2"),
is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article3"),
is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "news"),
is(1L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "article10"),
is(0L));
assertThat(itemRepo.countFilterByFolderAndName(folder, "foo"),
is(0L));
} }
} }

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)
); );
@ -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)
@ -1705,6 +1725,16 @@ create sequence hibernate_sequence start with 1 increment by 1;
foreign key (CONTENT_TYPE_ID) foreign key (CONTENT_TYPE_ID)
references CCM_CMS.CONTENT_TYPES; references CCM_CMS.CONTENT_TYPES;
alter table CCM_CMS.CONTENT_ITEMS
add constraint FKfh1nm46qpw6xcwkmgaqw2iu3h
foreign key (LIFECYCLE_ID)
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
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
@ -1750,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)
@ -2689,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

@ -170,7 +170,7 @@ CREATE SCHEMA ccm_cms;
create table CCM_CMS.BINARY_ASSETS ( create table CCM_CMS.BINARY_ASSETS (
ASSET_DATA oid, ASSET_DATA oid,
FILENAME varchar(512) not null, FILENAME varchar(512) not null,
MIME_TYPE bytea not null, MIME_TYPE varchar(512) not null,
DATA_SIZE int8, DATA_SIZE int8,
ASSET_ID int8 not null, ASSET_ID int8 not null,
primary key (ASSET_ID) primary key (ASSET_ID)
@ -181,7 +181,7 @@ CREATE SCHEMA ccm_cms;
REV int4 not null, REV int4 not null,
ASSET_DATA oid, ASSET_DATA oid,
FILENAME varchar(512), FILENAME varchar(512),
MIME_TYPE bytea, MIME_TYPE varchar(512),
DATA_SIZE int8, DATA_SIZE int8,
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 int8 not null, OBJECT_ID int8 not null,
CONTENT_TYPE_ID int8, CONTENT_TYPE_ID int8,
LIFECYCLE_ID int8,
WORKFLOW_ID int8,
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 int8, CONTENT_TYPE_ID int8,
LIFECYCLE_ID int8,
WORKFLOW_ID int8,
primary key (OBJECT_ID, REV) primary key (OBJECT_ID, REV)
); );
@ -876,10 +880,10 @@ CREATE SCHEMA ccm_cms;
create table CCM_CORE.CATEGORIZATIONS ( create table CCM_CORE.CATEGORIZATIONS (
CATEGORIZATION_ID int8 not null, CATEGORIZATION_ID int8 not null,
TYPE varchar(255),
CATEGORY_ORDER int8, CATEGORY_ORDER int8,
CATEGORY_INDEX boolean, CATEGORY_INDEX boolean,
OBJECT_ORDER int8, OBJECT_ORDER int8,
TYPE varchar(255),
OBJECT_ID int8, OBJECT_ID int8,
CATEGORY_ID int8, CATEGORY_ID int8,
primary key (CATEGORIZATION_ID) primary key (CATEGORIZATION_ID)
@ -1331,11 +1335,11 @@ CREATE SCHEMA ccm_cms;
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_LONG int8,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_BOOLEAN boolean, SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024), SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_LONG int8,
SETTING_VALUE_DOUBLE float8, SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_BIG_DECIMAL numeric(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 1 increment 1; create sequence hibernate_sequence start 1 increment 1;
create table CONTENT_SECTION_LIFECYCLE_DEFINITIONS (
CONTENT_SECTION_ID int8 not null,
LIFECYCLE_DEFINITION_ID int8 not null
);
create table CCM_CMS.CONTENT_SECTION_WORKFLOW_TEMPLATES (
CONTENT_SECTION_ID int8 not null,
WORKFLOW_TEMPLATE_ID int8 not null
);
alter table 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)
@ -1705,6 +1725,16 @@ create sequence hibernate_sequence start 1 increment 1;
foreign key (CONTENT_TYPE_ID) foreign key (CONTENT_TYPE_ID)
references CCM_CMS.CONTENT_TYPES; references CCM_CMS.CONTENT_TYPES;
alter table CCM_CMS.CONTENT_ITEMS
add constraint FKfh1nm46qpw6xcwkmgaqw2iu3h
foreign key (LIFECYCLE_ID)
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
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
@ -1750,6 +1780,21 @@ create sequence hibernate_sequence start 1 increment 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)
@ -2689,3 +2734,23 @@ create sequence hibernate_sequence start 1 increment 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 CONTENT_SECTION_LIFECYCLE_DEFINITIONS
add constraint FKqnsnk1eju8vrbm7x0wr5od4ll
foreign key (LIFECYCLE_DEFINITION_ID)
references CCM_CMS.LIFECYLE_DEFINITIONS;
alter table 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

@ -13,12 +13,12 @@
<ccm_core.ccm_objects object_id="-10100" <ccm_core.ccm_objects object_id="-10100"
display_name="article1" display_name="article1"
uuid="aed4b402-1180-46c6-b42d-7245f4dca248" /> uuid="aed4b402-1180-46c6-b42d-7245f4dca248" />
<ccm_core.ccm_objects object_id="-10200"
display_name="article2"
uuid="acae860f-2ffa-450d-b486-054292f0dae6" />
<ccm_core.ccm_objects object_id="-10300" <ccm_core.ccm_objects object_id="-10300"
display_name="article3" display_name="article3"
uuid="f4b38abb-234b-4354-bc92-e36c068a1ebd" /> 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" <ccm_core.ccm_objects object_id="-10400"
display_name="news1" display_name="news1"
uuid="d9ea527d-c6e3-4bdd-962d-c0a1a80c6c72" /> uuid="d9ea527d-c6e3-4bdd-962d-c0a1a80c6c72" />
@ -150,25 +150,29 @@
object_id="-10100" object_id="-10100"
category_order="1" category_order="1"
object_order="1" object_order="1"
category_index="false" /> category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30200" <ccm_core.categorizations categorization_id="-30200"
category_id="-2100" category_id="-2100"
object_id="-10200" object_id="-10200"
category_order="1" category_order="1"
object_order="2" object_order="2"
category_index="false" /> category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30300" <ccm_core.categorizations categorization_id="-30300"
category_id="-2100" category_id="-2100"
object_id="-10300" object_id="-10300"
category_order="1" category_order="1"
object_order="3" object_order="3"
category_index="false" /> category_index="false"
type="folder" />
<ccm_core.categorizations categorization_id="-30400" <ccm_core.categorizations categorization_id="-30400"
category_id="-2100" category_id="-2100"
object_id="-10400" object_id="-10400"
category_order="1" category_order="1"
object_order="4" object_order="4"
category_index="false" /> 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" />

View File

@ -12,12 +12,16 @@ DELETE FROM ccm_cms.content_item_titles;
DELETE FROM ccm_cms.content_items; DELETE FROM ccm_cms.content_items;
DELETE FROM ccm_cms.content_section_lifecycle_definitions;
DELETE FROM ccm_cms.lifecycle_definition_labels; DELETE FROM ccm_cms.lifecycle_definition_labels;
DELETE FROM ccm_cms.lifecycle_definition_descriptions; DELETE FROM ccm_cms.lifecycle_definition_descriptions;
DELETE FROM ccm_cms.lifecyle_definitions; DELETE FROM ccm_cms.lifecyle_definitions;
DELETE FROM ccm_cms.content_section_workflow_templates;
DELETE FROM ccm_core.workflow_templates; DELETE FROM ccm_core.workflow_templates;
DELETE FROM ccm_cms.content_type_labels; DELETE FROM ccm_cms.content_type_labels;

View File

@ -12,12 +12,16 @@ DELETE FROM ccm_cms.content_item_titles;
DELETE FROM ccm_cms.content_items; DELETE FROM ccm_cms.content_items;
DELETE FROM ccm_cms.content_section_lifecycle_definitions;
DELETE FROM ccm_cms.lifecycle_definition_labels; DELETE FROM ccm_cms.lifecycle_definition_labels;
DELETE FROM ccm_cms.lifecycle_definition_descriptions; DELETE FROM ccm_cms.lifecycle_definition_descriptions;
DELETE FROM ccm_cms.lifecyle_definitions; DELETE FROM ccm_cms.lifecyle_definitions;
DELETE FROM ccm_cms.content_section_workflow_templates;
DELETE FROM ccm_core.workflow_templates; DELETE FROM ccm_core.workflow_templates;
DELETE FROM ccm_cms.content_type_labels; DELETE FROM ccm_cms.content_type_labels;