diff --git a/ccm-cms/pom.xml b/ccm-cms/pom.xml index 999a5ebdb..b286bf727 100644 --- a/ccm-cms/pom.xml +++ b/ccm-cms/pom.xml @@ -15,6 +15,13 @@ yyyy-MM-dd'T'HH:mm:ss'Z'Z + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + org.librecms ccm-cms @@ -195,7 +202,9 @@ org.libreccm + org.librecms + ${basedir}/src/main/resources/META-INF/persistence-ddl.xml true diff --git a/ccm-cms/src/main/java/org/librecms/Cms.java b/ccm-cms/src/main/java/org/librecms/Cms.java index 0e5952000..ecaab22a7 100644 --- a/ccm-cms/src/main/java/org/librecms/Cms.java +++ b/ccm-cms/src/main/java/org/librecms/Cms.java @@ -12,7 +12,10 @@ import org.libreccm.modules.ShutdownEvent; import org.libreccm.modules.UnInstallEvent; @Module(packageName = "org.libreccm.cms", - requiredModules = {@RequiredModule(module = org.libreccm.core.CcmCore.class)}) + requiredModules = { + @RequiredModule(module = org.libreccm.core.CcmCore.class) + } +) public class Cms implements CcmModule { @Override @@ -23,7 +26,7 @@ public class Cms implements CcmModule { @Override public void init(final InitEvent event) { //ToDo Add initialisation logic necessary for your module - } + } @Override public void shutdown(final ShutdownEvent event) { @@ -35,5 +38,4 @@ public class Cms implements CcmModule { //ToDo Remove module data } - } diff --git a/ccm-cms/src/main/java/org/librecms/assets/Asset.java b/ccm-cms/src/main/java/org/librecms/assets/Asset.java new file mode 100644 index 000000000..282e33e4c --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/assets/Asset.java @@ -0,0 +1,153 @@ +/* + * 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.librecms.assets; + +import org.hibernate.envers.Audited; +import org.libreccm.core.Identifiable; +import org.libreccm.l10n.LocalizedString; + +import java.io.Serializable; +import java.util.Objects; + +import javax.persistence.AssociationOverride; +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.Table; + +import static org.librecms.CmsConstants.*; + +/** + * + * @author Jens Pelzetter + */ +@Entity +@Table(schema = DB_SCHEMA, name = "ASSETS") +@Audited +public class Asset implements Identifiable, Serializable { + + private static final long serialVersionUID = -3499741368562653529L; + + @Column(name = "ASSET_ID") + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long assetId; + + @Column(name = "UUID", unique = true) + private String uuid; + + @Embedded + @AssociationOverride( + name = "values", + joinTable = @JoinTable(name = "ASSET_TITLES", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "ASSET_ID") + } + ) + ) + private LocalizedString title; + + public long getAssetId() { + return assetId; + } + + protected void setAssetId(final long assetId) { + this.assetId = assetId; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(final String uuid) { + this.uuid = uuid; + } + + public LocalizedString getTitle() { + return title; + } + + public void setTitle(final LocalizedString title) { + this.title = title; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 97 * hash + (int) (assetId ^ (assetId >>> 32)); + hash = 97 * hash + Objects.hashCode(uuid); + hash = 97 * hash + Objects.hashCode(title); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof Asset)) { + return false; + } + final Asset other = (Asset) obj; + if (!other.canEqual(this)) { + return false; + } + + if (assetId != other.getAssetId()) { + return false; + } + if (!Objects.equals(uuid, other.getUuid())) { + return false; + } + return Objects.equals(title, other.getTitle()); + } + + public boolean canEqual(final Object obj) { + return obj instanceof Asset; + } + + @Override + public final String toString() { + return toString(""); + } + + public String toString(final String data) { + return String.format( + "%s{ " + + "assetIdd = %d, " + + "uuid = %s, " + + "title = {}%s" + + " }", + super.toString(), + assetId, + uuid, + Objects.toString(title), + data); + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/assets/ReusableAsset.java b/ccm-cms/src/main/java/org/librecms/assets/ReusableAsset.java new file mode 100644 index 000000000..9658bcaaf --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/assets/ReusableAsset.java @@ -0,0 +1,99 @@ +/* + * 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.librecms.assets; + +import org.hibernate.envers.Audited; +import org.libreccm.core.CcmObject; + +import java.io.Serializable; +import java.util.Objects; + +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import static org.librecms.CmsConstants.*; + +/** + * + * @author Jens Pelzetter + * @param + */ +@Entity +@Table(schema = DB_SCHEMA, name = "REUSABLE_ASSETS") +@Audited +public class ReusableAsset extends CcmObject + implements Serializable { + + private static final long serialVersionUID = 1341326042963088198L; + + @OneToOne(targetEntity = Asset.class) + @JoinColumn(name = "ASSET_ID") + private T asset; + + public T getAsset() { + return asset; + } + + protected void setAsset(final T asset) { + this.asset = asset; + } + + @Override + public int hashCode() { + int hash = super.hashCode(); + hash = 11 * hash + Objects.hashCode(asset); + return hash; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ReusableAsset)) { + return false; + } + final ReusableAsset other = (ReusableAsset) obj; + if (!other.canEqual(obj)) { + return false; + } + + return Objects.equals(asset, other.getAsset()); + } + + @Override + public boolean canEqual(final Object obj) { + return obj instanceof ReusableAsset; + } + + @Override + public String toString(final String data) { + return super.toString(String.format( + ", asset = { %s }%s", + Objects.toString(asset), + data + )); + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java new file mode 100644 index 000000000..b2a9a4750 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java @@ -0,0 +1,320 @@ +/* + * 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.librecms.attachments; + +import org.hibernate.envers.Audited; +import org.libreccm.core.Identifiable; +import org.libreccm.l10n.LocalizedString; +import org.librecms.assets.Asset; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Objects; + +import javax.persistence.AssociationOverride; +import javax.persistence.Column; +import javax.persistence.Embedded; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +import static org.librecms.CmsConstants.*; + +/** + * + * @author Jens Pelzetter + * @param + */ +@Entity +@Table(schema = DB_SCHEMA, name = "attachment_lists") +@Audited +public class AttachmentList implements Identifiable, + List>, + Serializable { + + private static final long serialVersionUID = -7750330135750750047L; + + @Column(name = "LIST_ID") + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long listId; + + @Column(name = "UUID") + private String uuid; + + @Embedded + @AssociationOverride( + name = "values", + joinTable = @JoinTable(name = "ATTACHMENT_LIST_CAPTIONS", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "LIST_ID") + } + ) + ) + private LocalizedString caption; + + @Column(name = "ASSET_TYPE", length = 1024) + private String assetType; + + @OneToMany(targetEntity = ItemAttachment.class) + @JoinColumn(name = "LIST_ID") + private List> attachments; + + public long getListId() { + return listId; + } + + protected void setListId(final long listId) { + this.listId = listId; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(final String uuid) { + this.uuid = uuid; + } + + public LocalizedString getCaption() { + return caption; + } + + public void setCaption(final LocalizedString caption) { + this.caption = caption; + } + + public String getAssetType() { + return assetType; + } + + public void setAssetType(final String assetType) { + this.assetType = assetType; + } + + public List> getAttachments() { + return Collections.unmodifiableList(attachments); + } + + public void setAttachments(List> attachments) { + this.attachments = new ArrayList<>(attachments); + } + + @Override + public int size() { + return attachments.size(); + } + + @Override + public boolean isEmpty() { + return attachments.isEmpty(); + } + + @Override + public boolean contains(final Object obj) { + return attachments.contains(obj); + } + + @Override + public Iterator> iterator() { + return attachments.iterator(); + } + + @Override + public Object[] toArray() { + return attachments.toArray(); + } + + @Override + public T[] toArray(final T[] array) { + return attachments.toArray(array); + } + + @Override + public boolean add(final ItemAttachment attachment) { + return attachments.add(attachment); + } + + @Override + public boolean remove(final Object obj) { + return attachments.remove(obj); + } + + @Override + public boolean containsAll(final Collection collection) { + return attachments.containsAll(collection); + } + + @Override + public boolean addAll( + final Collection> collection) { + + return attachments.addAll(collection); + } + + @Override + public boolean addAll( + final int index, + final Collection> collection) { + + return attachments.addAll(index, collection); + } + + @Override + public boolean removeAll(final Collection collection) { + return attachments.removeAll(collection); + } + + @Override + public boolean retainAll(final Collection collection) { + return attachments.retainAll(collection); + } + + @Override + public void clear() { + attachments.clear(); + } + + @Override + public ItemAttachment get(final int index) { + return attachments.get(index); + } + + @Override + public ItemAttachment set(final int index, + final ItemAttachment element) { + return attachments.set(index, element); + } + + @Override + public void add(final int index, final ItemAttachment element) { + attachments.add(index, element); + } + + @Override + public ItemAttachment remove(final int index) { + return attachments.remove(index); + } + + @Override + public int indexOf(final Object obj) { + return attachments.indexOf(obj); + } + + @Override + public int lastIndexOf(final Object obj) { + return attachments.lastIndexOf(obj); + } + + @Override + public ListIterator> listIterator() { + return attachments.listIterator(); + } + + @Override + public ListIterator> listIterator(final int index) { + return attachments.listIterator(index); + } + + @Override + public List> subList(final int fromIndex, + final int toIndex) { + return attachments.subList(fromIndex, toIndex); + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (int) (listId ^ (listId >>> 32)); + hash = 97 * hash + Objects.hashCode(uuid); + hash = 97 * hash + Objects.hashCode(caption); + hash = 97 * hash + Objects.hashCode(assetType); + hash = 97 * hash + Objects.hashCode(attachments); + return hash; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof AttachmentList)) { + return false; + } + final AttachmentList other = (AttachmentList) obj; + if (!other.canEqual(this)) { + return false; + } + if (listId != other.getListId()) { + return false; + } + if (!Objects.equals(uuid, other.getUuid())) { + return false; + } + if (!Objects.equals(caption, other.getCaption())) { + return false; + } + if (!Objects.equals(assetType, other.getAssetType())) { + return false; + } + return Objects.equals(attachments, other.getAttachments()); + } + + public boolean canEqual(final Object obj) { + return obj instanceof AttachmentList; + } + + @Override + public final String toString() { + return toString(""); + } + + public String toString(final String data) { + return String.format("%s{ " + + "listId = %d, " + + "uuid = %s, " + + "caption = { %s }, " + + "assetType = %s, " + + "attachments = { %s }%s" + + " }", + super.toString(), + listId, + uuid, + Objects.toString(caption), + assetType, + Objects.toString(attachments), + data); + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/attachments/ItemAttachment.java b/ccm-cms/src/main/java/org/librecms/attachments/ItemAttachment.java new file mode 100644 index 000000000..03b036b72 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/attachments/ItemAttachment.java @@ -0,0 +1,158 @@ +/* + * 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.librecms.attachments; + +import org.hibernate.envers.Audited; +import org.libreccm.core.Identifiable; +import org.librecms.assets.Asset; + +import java.io.Serializable; +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import static org.librecms.CmsConstants.*; + +/** + * + * @author Jens Pelzetter + * @param + */ +@Entity +@Table(schema = DB_SCHEMA, name = "ATTACHMENTS") +@Audited +public class ItemAttachment implements Identifiable, + Serializable { + + private static final long serialVersionUID = -9005379413315191984L; + + @Column(name = "ATTACHMENT_ID") + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long attachmentId; + + @Column(name = "uuid") + private String uuid; + + @OneToOne(targetEntity = Asset.class) + @JoinColumn(name = "ASSET_ID") + private T asset; + + @Column(name = "SORT_KEY") + private long sortKey; + + public long getAttachmentId() { + return attachmentId; + } + + public void setAttachmentId(final long attachmentId) { + this.attachmentId = attachmentId; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(final String uuid) { + this.uuid = uuid; + } + + public T getAsset() { + return asset; + } + + public void setAsset(final T asset) { + this.asset = asset; + } + + public long getSortKey() { + return sortKey; + } + + public void setSortKey(final long sortKey) { + this.sortKey = sortKey; + } + + @Override + public int hashCode() { + int hash = 3; + hash + = 71 * hash + (int) (attachmentId ^ (attachmentId >>> 32)); + hash = 71 * hash + Objects.hashCode(asset); + hash = 71 * hash + (int) (sortKey ^ (sortKey >>> 32)); + return hash; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ItemAttachment)) { + return false; + } + final ItemAttachment other = (ItemAttachment) obj; + if (!other.canEqual(this)) { + return false; + } + if (attachmentId != other.getAttachmentId()) { + return false; + } + if (sortKey != other.getSortKey()) { + return false; + } + return Objects.equals(asset, other.getAsset()); + } + + public boolean canEqual(final Object obj) { + return obj instanceof ItemAttachment; + } + + @Override + public final String toString() { + return toString(""); + } + + public String toString(final String data) { + return String.format("%s{ " + + "attachmentId = %d, " + + "uuid = %s, " + + "asset = { %s }, " + + "sortKey = %d%s" + + " }", + super.toString(), + attachmentId, + uuid, + Objects.toString(asset), + sortKey, + data); + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ContentItem.java b/ccm-cms/src/main/java/org/librecms/contentsection/ContentItem.java index a49e644ad..0e29c7c2e 100644 --- a/ccm-cms/src/main/java/org/librecms/contentsection/ContentItem.java +++ b/ccm-cms/src/main/java/org/librecms/contentsection/ContentItem.java @@ -19,14 +19,18 @@ package org.librecms.contentsection; import org.hibernate.envers.Audited; +import org.hibernate.envers.RelationTargetAuditMode; import static org.librecms.CmsConstants.*; import org.libreccm.core.CcmObject; import org.libreccm.l10n.LocalizedString; +import org.librecms.attachments.AttachmentList; import java.io.Serializable; +import java.util.Collections; import java.util.Date; +import java.util.List; import java.util.Objects; import javax.persistence.AssociationOverride; @@ -37,6 +41,7 @@ import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; +import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; @@ -49,7 +54,7 @@ import javax.persistence.TemporalType; */ @Entity @Audited -@Table(name = "content_items", schema = DB_SCHEMA) +@Table(name = "CONTENT_ITEMS", schema = DB_SCHEMA) public class ContentItem extends CcmObject implements Serializable { private static final long serialVersionUID = 5897287630227129653L; @@ -62,18 +67,21 @@ public class ContentItem extends CcmObject implements Serializable { */ @Embedded @AssociationOverride( - name = "VALUES", - joinTable = @JoinTable(name = "CONTENT_ITEM_NAMES", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "OBJECT_ID")} - )) + name = "values", + joinTable = @JoinTable(name = "CONTENT_ITEM_NAMES", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "OBJECT_ID") + } + ) + ) private LocalizedString name; /** * The content type associated with the content item. */ @OneToOne + @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) private ContentType contentType; /** @@ -81,12 +89,14 @@ public class ContentItem extends CcmObject implements Serializable { */ @Embedded @AssociationOverride( - name = "VALUES", - joinTable = @JoinTable(name = "CONTENT_ITEM_TITLES", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "OBJECT_ID")} - )) + name = "values", + joinTable = @JoinTable(name = "CONTENT_ITEM_TITLES", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "OBJECT_ID") + } + ) + ) private LocalizedString title; /** @@ -94,12 +104,12 @@ public class ContentItem extends CcmObject implements Serializable { */ @Embedded @AssociationOverride( - name = "VALUES", - joinTable = @JoinTable(name = "CONTENT_ITEM_DESCRIPTIONS", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "OBJECT_ID")} - )) + name = "values", + joinTable = @JoinTable(name = "CONTENT_ITEM_DESCRIPTIONS", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "OBJECT_ID")} + )) private LocalizedString description; /** @@ -118,9 +128,13 @@ public class ContentItem extends CcmObject implements Serializable { * String with the IDs (separated by slashes) of the ancestors of the * content item (aka the path of the content item). */ - @Column(name = "ancestors", length = 1024) + @Column(name = "ANCESTORS", length = 1024) private String ancestors; + @OneToMany + @JoinColumn(name = "CONTENT_ITEM_ID") + private List> attachments; + public LocalizedString getName() { return name; } @@ -162,11 +176,19 @@ public class ContentItem extends CcmObject implements Serializable { } public Date getLaunchDate() { - return new Date(launchDate.getTime()); + if (launchDate == null) { + return null; + } else { + return new Date(launchDate.getTime()); + } } public void setLaunchDate(final Date launchDate) { - this.launchDate = new Date(launchDate.getTime()); + if (launchDate == null) { + this.launchDate = null; + } else { + this.launchDate = new Date(launchDate.getTime()); + } } public String getAncestors() { @@ -177,6 +199,14 @@ public class ContentItem extends CcmObject implements Serializable { this.ancestors = ancestors; } + public List> getAttachments() { + return Collections.unmodifiableList(attachments); + } + + protected void setAttachments(final List> attachments) { + this.attachments = attachments; + } + @Override public int hashCode() { int hash = super.hashCode(); @@ -236,16 +266,19 @@ public class ContentItem extends CcmObject implements Serializable { @Override public String toString(final String data) { - return String.format(", name = {}, " - + "contentType = {}, " - + "title = {}, " - + "version = %s," - + "launchDate = %s%s", - Objects.toString(name), - Objects.toString(contentType), - Objects.toString(description), - Objects.toString(version), - Objects.toString(launchDate)); + return super.toString(String.format(", name = {}, " + + "contentType = {}, " + + "title = {}, " + + "description = {}," + + "version = %s," + + "launchDate = %s%s", + Objects.toString(name), + Objects.toString(contentType), + Objects.toString(title), + Objects.toString(description), + Objects.toString(version), + Objects.toString(launchDate), + data)); } } diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ContentSection.java b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSection.java index b6957f043..5fda55666 100644 --- a/ccm-cms/src/main/java/org/librecms/contentsection/ContentSection.java +++ b/ccm-cms/src/main/java/org/librecms/contentsection/ContentSection.java @@ -18,16 +18,20 @@ */ package org.librecms.contentsection; +import org.libreccm.categorization.Category; + import static org.librecms.CmsConstants.*; import org.libreccm.security.Role; import org.libreccm.web.CcmApplication; import java.io.Serializable; +import java.util.Locale; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.JoinColumn; import javax.persistence.OneToOne; import javax.persistence.Table; @@ -36,36 +40,44 @@ import javax.persistence.Table; * @author Jens Pelzetter */ @Entity -@Table(name = "content_sections", schema = DB_SCHEMA) +@Table(name = "CONTENT_SECTIONS", schema = DB_SCHEMA) public class ContentSection extends CcmApplication implements Serializable { private static final long serialVersionUID = -671718122153931727L; - @Column(name = "label", length = 512) + @Column(name = "LABEL", length = 512) private String label; - @Column(name = "page_resolver_class", length = 1024) + @OneToOne + @JoinColumn(name = "ROOT_DOCUMENTS_FOLDER_ID") + private Category rootDocumentsFolder; + + @OneToOne + @JoinColumn(name = "ROOT_ASSETS_FOLDER_ID") + private Category rootAssetsFolder; + + @Column(name = "PAGE_RESOLVER_CLASS", length = 1024) private String pageResolverClass; - @Column(name = "item_resolver_class", length = 1024) + @Column(name = "ITEM_RESOLVER_CLASS", length = 1024) private String itemResolverClass; - @Column(name = "template_resolver_class", length = 1024) + @Column(name = "TEMPLATE_RESOLVER_CLASS", length = 1024) private String templateResolverClass; - @Column(name = "xml_generator_class", length = 1024) + @Column(name = "XML_GENERATOR_CLASS", length = 1024) private String xmlGeneratorClass; @OneToOne - private Role staffGroup; + @JoinColumn(name = "STAFF_ROLE_ID") + private Role staffRole; @OneToOne - private Role viewersGroup; + @JoinColumn(name = "VIEWERS_ROLE_ID") + private Role viewersRole; - @Column(name = "default_locale", length = 10) - private String defaultLocale; - - + @Column(name = "DEFAULT_LOCALE") + private Locale defaultLocale; public String getLabel() { return label; @@ -75,6 +87,22 @@ public class ContentSection extends CcmApplication implements Serializable { this.label = label; } + public Category getRootDocumentsFolder() { + return rootDocumentsFolder; + } + + protected void setRootDocumentFolder(final Category rootDocumentsFolder) { + this.rootDocumentsFolder = rootDocumentsFolder; + } + + public Category getRootAssetsFolder() { + return rootAssetsFolder; + } + + protected void setRootAssetsFolder(final Category rootAssetsFolder) { + this.rootAssetsFolder = rootAssetsFolder; + } + public String getPageResolverClass() { return pageResolverClass; } @@ -107,27 +135,27 @@ public class ContentSection extends CcmApplication implements Serializable { this.xmlGeneratorClass = xmlGeneratorClass; } - public Role getStaffGroup() { - return staffGroup; + public Role getStaffRole() { + return staffRole; } - public void setStaffGroup(final Role staffGroup) { - this.staffGroup = staffGroup; + public void setStaffRole(final Role staffRole) { + this.staffRole = staffRole; } - public Role getViewersGroup() { - return viewersGroup; + public Role getViewersRole() { + return viewersRole; } - public void setViewersGroup(final Role viewersGroup) { - this.viewersGroup = viewersGroup; + public void setViewersRole(final Role viewersRole) { + this.viewersRole = viewersRole; } - public String getDefaultLocale() { + public Locale getDefaultLocale() { return defaultLocale; } - public void setDefaultLocale(final String defaultLocale) { + public void setDefaultLocale(final Locale defaultLocale) { this.defaultLocale = defaultLocale; } @@ -135,6 +163,8 @@ public class ContentSection extends CcmApplication implements Serializable { public int hashCode() { int hash = super.hashCode(); hash = 47 * hash + Objects.hashCode(label); + hash = 47 * hash + Objects.hashCode(rootDocumentsFolder); + hash = 47 * hash + Objects.hashCode(rootAssetsFolder); hash = 47 * hash + Objects.hashCode(pageResolverClass); hash = 47 * hash + Objects.hashCode(itemResolverClass); hash = 47 * hash + Objects.hashCode(templateResolverClass); @@ -165,6 +195,12 @@ public class ContentSection extends CcmApplication implements Serializable { if (!Objects.equals(label, other.getLabel())) { return false; } + if (!Objects.equals(rootDocumentsFolder, other.getRootDocumentsFolder())) { + return false; + } + if (!Objects.equals(rootAssetsFolder, other.getRootAssetsFolder())) { + return false; + } if (!Objects.equals(pageResolverClass, other.getPageResolverClass())) { return false; } @@ -188,19 +224,24 @@ public class ContentSection extends CcmApplication implements Serializable { @Override public String toString(final String data) { - return super.toString(String.format(", label = \"%s\", " - + "pageResolverClass = \"%s\", " - + "itemResolverClass = \"%s\", " - + "templateResolverClass = \"%s\", " - + "xmlGeneratorClass = \"%s\", " - + "defaultLocale = \"%s\"%s", - label, - pageResolverClass, - itemResolverClass, - templateResolverClass, - xmlGeneratorClass, - defaultLocale, - data)); + return super.toString(String.format( + ", label = \"%s\", " + + "rootDocumentsFolder = \"%s\", " + + "rootAssetsFolder = \"%s\", " + + "pageResolverClass = \"%s\", " + + "itemResolverClass = \"%s\", " + + "templateResolverClass = \"%s\", " + + "xmlGeneratorClass = \"%s\", " + + "defaultLocale = \"%s\"%s", + label, + Objects.toString(rootDocumentsFolder), + Objects.toString(rootAssetsFolder), + pageResolverClass, + itemResolverClass, + templateResolverClass, + xmlGeneratorClass, + Objects.toString(defaultLocale), + data)); } } diff --git a/ccm-cms/src/main/java/org/librecms/contentsection/ContentType.java b/ccm-cms/src/main/java/org/librecms/contentsection/ContentType.java index 7977ed1fd..b57dbdaee 100644 --- a/ccm-cms/src/main/java/org/librecms/contentsection/ContentType.java +++ b/ccm-cms/src/main/java/org/librecms/contentsection/ContentType.java @@ -41,12 +41,12 @@ import javax.persistence.Table; * @author Jens Pelzetter */ @Entity -@Table(name = "content_types", schema = DB_SCHEMA) +@Table(name = "CONTENT_TYPES", schema = DB_SCHEMA) public class ContentType extends CcmObject implements Serializable { private static final long serialVersionUID = -2708659750560382851L; - @Column(name = "content_item_class", length = 1024) + @Column(name = "CONTENT_ITEM_CLASS", length = 1024) private String contentItemClass; @Embedded @@ -69,10 +69,10 @@ public class ContentType extends CcmObject implements Serializable { )) private LocalizedString description; - @Column(name = "ancestors", length = 1024) + @Column(name = "ANCESTORS", length = 1024) private String ancestors; - @Column(name = "descendants", length = 1024) + @Column(name = "DESCENDANTS", length = 1024) private String descendants; @Enumerated(EnumType.STRING) diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/GenericArticle.java b/ccm-cms/src/main/java/org/librecms/contenttypes/GenericArticle.java index 58391f568..197f158df 100644 --- a/ccm-cms/src/main/java/org/librecms/contenttypes/GenericArticle.java +++ b/ccm-cms/src/main/java/org/librecms/contenttypes/GenericArticle.java @@ -42,7 +42,7 @@ import org.libreccm.l10n.LocalizedString; */ @Entity @Audited -@Table(name = "articles", schema = DB_SCHEMA) +@Table(name = "ARTICLES", schema = DB_SCHEMA) public class GenericArticle extends ContentItem implements Serializable { private static final long serialVersionUID = -6737443527969703121L; diff --git a/ccm-cms/src/main/resources/META-INF/persistence-ddl.xml b/ccm-cms/src/main/resources/META-INF/persistence-ddl.xml new file mode 100644 index 000000000..a98d422e3 --- /dev/null +++ b/ccm-cms/src/main/resources/META-INF/persistence-ddl.xml @@ -0,0 +1,42 @@ + + + + + + + + + org.hibernate.jpa.HibernatePersistenceProvider + + java:/comp/env/jdbc/libreccm/db + + + + + + + + + + + + + + + diff --git a/ccm-cms/src/main/resources/db/migrations/org/librecms/cms/h2/V7_0_0_0__create_tables.sql b/ccm-cms/src/main/resources/db/migrations/org/librecms/cms/h2/V7_0_0_0__create_tables.sql new file mode 100644 index 000000000..633d702da --- /dev/null +++ b/ccm-cms/src/main/resources/db/migrations/org/librecms/cms/h2/V7_0_0_0__create_tables.sql @@ -0,0 +1,1567 @@ + + create table CCM_CMS.ARTICLES ( + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.ARTICLES_AUD ( + OBJECT_ID bigint not null, + REV integer not null, + primary key (OBJECT_ID, REV) + ); + + create table CCM_CMS.ASSET_TITLES ( + ASSET_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (ASSET_ID, LOCALE) + ); + + create table CCM_CMS.ASSET_TITLES_AUD ( + REV integer not null, + ASSET_ID bigint not null, + LOCALIZED_VALUE clob not null, + LOCALE varchar(255) not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, ASSET_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.ASSETS ( + ASSET_ID bigint not null, + UUID varchar(255), + primary key (ASSET_ID) + ); + + create table CCM_CMS.ASSETS_AUD ( + ASSET_ID bigint not null, + REV integer not null, + REVTYPE tinyint, + REVEND integer, + UUID varchar(255), + primary key (ASSET_ID, REV) + ); + + create table CCM_CMS.ATTACHMENT_LIST_CAPTIONS ( + LIST_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (LIST_ID, LOCALE) + ); + + create table CCM_CMS.ATTACHMENT_LIST_CAPTIONS_AUD ( + REV integer not null, + LIST_ID bigint not null, + LOCALIZED_VALUE clob not null, + LOCALE varchar(255) not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, LIST_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.attachment_lists ( + LIST_ID bigint not null, + ASSET_TYPE varchar(1024), + UUID varchar(255), + CONTENT_ITEM_ID bigint, + primary key (LIST_ID) + ); + + create table CCM_CMS.attachment_lists_AUD ( + LIST_ID bigint not null, + REV integer not null, + REVTYPE tinyint, + REVEND integer, + ASSET_TYPE varchar(1024), + UUID varchar(255), + primary key (LIST_ID, REV) + ); + + create table CCM_CMS.AttachmentList_ItemAttachment_AUD ( + REV integer not null, + LIST_ID bigint not null, + ATTACHMENT_ID bigint not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, LIST_ID, ATTACHMENT_ID) + ); + + create table CCM_CMS.ATTACHMENTS ( + ATTACHMENT_ID bigint not null, + SORT_KEY bigint, + uuid varchar(255), + ASSET_ID bigint, + LIST_ID bigint, + primary key (ATTACHMENT_ID) + ); + + create table CCM_CMS.ATTACHMENTS_AUD ( + ATTACHMENT_ID bigint not null, + REV integer not null, + REVTYPE tinyint, + REVEND integer, + SORT_KEY bigint, + uuid varchar(255), + ASSET_ID bigint, + primary key (ATTACHMENT_ID, REV) + ); + + create table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS_AUD ( + REV integer not null, + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob not null, + LOCALE varchar(255) not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_NAMES ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_NAMES_AUD ( + REV integer not null, + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob not null, + LOCALE varchar(255) not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_TITLES ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_TITLES_AUD ( + REV integer not null, + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob not null, + LOCALE varchar(255) not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEMS ( + ANCESTORS varchar(1024), + launchDate date, + version varchar(255), + OBJECT_ID bigint not null, + contentType_OBJECT_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.CONTENT_ITEMS_AUD ( + OBJECT_ID bigint not null, + REV integer not null, + ANCESTORS varchar(1024), + launchDate date, + version varchar(255), + contentType_OBJECT_ID bigint, + primary key (OBJECT_ID, REV) + ); + + create table CCM_CMS.CONTENT_SECTIONS ( + DEFAULT_LOCALE varchar(255), + ITEM_RESOLVER_CLASS varchar(1024), + LABEL varchar(512), + PAGE_RESOLVER_CLASS varchar(1024), + TEMPLATE_RESOLVER_CLASS varchar(1024), + XML_GENERATOR_CLASS varchar(1024), + OBJECT_ID bigint not null, + ROOT_ASSETS_FOLDER_ID bigint, + ROOT_DOCUMENTS_FOLDER_ID bigint, + STAFF_ROLE_ID bigint, + VIEWERS_ROLE_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.CONTENT_TYPES ( + ANCESTORS varchar(1024), + CONTENT_ITEM_CLASS varchar(1024), + DESCENDANTS varchar(1024), + mode varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.ContentItem_AttachmentList_AUD ( + REV integer not null, + CONTENT_ITEM_ID bigint not null, + LIST_ID bigint not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, CONTENT_ITEM_ID, LIST_ID) + ); + + create table CCM_CMS.REUSABLE_ASSETS ( + OBJECT_ID bigint not null, + ASSET_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.REUSABLE_ASSETS_AUD ( + OBJECT_ID bigint not null, + REV integer not null, + ASSET_ID bigint, + primary key (OBJECT_ID, REV) + ); + + alter table CCM_CMS.ASSETS + add constraint UK_9l2v1u9beyemgjwqx7isbumwh unique (UUID); + + create table CCM_CORE.APPLICATIONS ( + APPLICATION_TYPE varchar(1024) not null, + PRIMARY_URL varchar(1024) not null, + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.ATTACHMENTS ( + ATTACHMENT_ID bigint not null, + ATTACHMENT_DATA blob, + DESCRIPTION varchar(255), + MIME_TYPE varchar(255), + TITLE varchar(255), + MESSAGE_ID bigint, + primary key (ATTACHMENT_ID) + ); + + create table CCM_CORE.CATEGORIES ( + ABSTRACT_CATEGORY boolean, + CATEGORY_ORDER bigint, + ENABLED boolean, + NAME varchar(255) not null, + UNIQUE_ID varchar(255), + VISIBLE boolean, + OBJECT_ID bigint not null, + PARENT_CATEGORY_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.CATEGORIZATIONS ( + CATEGORIZATION_ID bigint not null, + CATEGORY_ORDER bigint, + CATEGORY_INDEX boolean, + OBJECT_ORDER bigint, + OBJECT_ID bigint, + CATEGORY_ID bigint, + primary key (CATEGORIZATION_ID) + ); + + create table CCM_CORE.CATEGORY_DESCRIPTIONS ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.CATEGORY_DOMAINS ( + DOMAIN_KEY varchar(255) not null, + RELEASED timestamp, + URI varchar(1024), + VERSION varchar(255), + OBJECT_ID bigint not null, + ROOT_CATEGORY_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.CATEGORY_TITLES ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.CCM_OBJECTS ( + OBJECT_ID bigint not null, + DISPLAY_NAME varchar(255), + UUID varchar(255), + primary key (OBJECT_ID) + ); + + create table CCM_CORE.CCM_OBJECTS_AUD ( + OBJECT_ID bigint not null, + REV integer not null, + REVTYPE tinyint, + REVEND integer, + DISPLAY_NAME varchar(255), + primary key (OBJECT_ID, REV) + ); + + create table CCM_CORE.CCM_REVISIONS ( + id integer not null, + timestamp bigint not null, + USER_NAME varchar(255), + primary key (id) + ); + + create table CCM_CORE.CCM_ROLES ( + ROLE_ID bigint not null, + NAME varchar(512) not null, + primary key (ROLE_ID) + ); + + create table CCM_CORE.DIGESTS ( + FREQUENCY integer, + HEADER varchar(4096) not null, + NEXT_RUN timestamp, + DIGEST_SEPARATOR varchar(128) not null, + SIGNATURE varchar(4096) not null, + SUBJECT varchar(255) not null, + OBJECT_ID bigint not null, + FROM_PARTY_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.DOMAIN_DESCRIPTIONS ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.DOMAIN_OWNERSHIPS ( + OWNERSHIP_ID bigint not null, + CONTEXT varchar(255), + DOMAIN_ORDER bigint, + OWNER_ORDER bigint, + domain_OBJECT_ID bigint not null, + owner_OBJECT_ID bigint not null, + primary key (OWNERSHIP_ID) + ); + + create table CCM_CORE.DOMAIN_TITLES ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS ( + COMPONENT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (COMPONENT_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_COMPONENTS ( + ACTIVE boolean, + ADMIN_NAME varchar(255), + ATTRIBUTE_STRING varchar(255), + COMPONENT_ORDER bigint, + SELECTED boolean, + OBJECT_ID bigint not null, + parentComponent_OBJECT_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_CONFIRM_EMAIL_LISTENER ( + BODY clob, + FROM_EMAIL varchar(255), + SUBJECT varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_CONFIRM_REDIRECT_LISTENERS ( + URL varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_DATA_DRIVEN_SELECTS ( + MULTIPLE boolean, + QUERY varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_DATA_QUERIES ( + QUERY_ID varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS ( + DATA_QUERY_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (DATA_QUERY_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES ( + DATA_QUERY_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (DATA_QUERY_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_FORMSECTIONS ( + FORMSECTION_ACTION varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_LISTENERS ( + ATTRIBUTE_STRING varchar(255), + CLASS_NAME varchar(255), + OBJECT_ID bigint not null, + widget_OBJECT_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_METAOBJECTS ( + CLASS_NAME varchar(255), + PRETTY_NAME varchar(255), + PRETTY_PLURAL varchar(255), + PROPERTIES_FORM varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_OBJECT_TYPES ( + APP_NAME varchar(255), + CLASS_NAME varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_OPTION_LABELS ( + OPTION_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OPTION_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_OPTIONS ( + PARAMETER_VALUE varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS ( + PROCESS_LISTENER_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (PROCESS_LISTENER_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES ( + PROCESS_LISTENER_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (PROCESS_LISTENER_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS ( + LISTENER_CLASS varchar(255), + PROCESS_LISTENER_ORDER bigint, + OBJECT_ID bigint not null, + formSection_OBJECT_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_REMOTE_SERVER_POST_LISTENER ( + REMOTE_URL varchar(2048), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_SIMPLE_EMAIL_LISTENERS ( + RECIPIENT varchar(255), + SUBJECT varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_TEMPLATE_EMAIL_LISTENERS ( + BODY clob, + RECIPIENT varchar(255), + SUBJECT varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_WIDGET_LABELS ( + OBJECT_ID bigint not null, + widget_OBJECT_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_WIDGETS ( + DEFAULT_VALUE varchar(255), + PARAMETER_MODEL varchar(255), + PARAMETER_NAME varchar(255), + OBJECT_ID bigint not null, + label_OBJECT_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_XML_EMAIL_LISTENERS ( + RECIPIENT varchar(255), + SUBJECT varchar(255), + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.GROUP_MEMBERSHIPS ( + MEMBERSHIP_ID bigint not null, + GROUP_ID bigint, + MEMBER_ID bigint, + primary key (MEMBERSHIP_ID) + ); + + create table CCM_CORE.GROUPS ( + PARTY_ID bigint not null, + primary key (PARTY_ID) + ); + + create table CCM_CORE.HOSTS ( + HOST_ID bigint not null, + SERVER_NAME varchar(512), + SERVER_PORT bigint, + primary key (HOST_ID) + ); + + create table CCM_CORE.INITS ( + INITIALIZER_ID bigint not null, + CLASS_NAME varchar(255), + REQUIRED_BY_ID bigint, + primary key (INITIALIZER_ID) + ); + + create table CCM_CORE.INSTALLED_MODULES ( + MODULE_ID integer not null, + MODULE_CLASS_NAME varchar(2048), + STATUS varchar(255), + primary key (MODULE_ID) + ); + + create table CCM_CORE.LUCENE_DOCUMENTS ( + DOCUMENT_ID bigint not null, + CONTENT clob, + CONTENT_SECTION varchar(512), + COUNTRY varchar(8), + CREATED timestamp, + DIRTY bigint, + DOCUMENT_LANGUAGE varchar(8), + LAST_MODIFIED timestamp, + SUMMARY varchar(4096), + DOCUMENT_TIMESTAMP timestamp, + TITLE varchar(4096), + TYPE varchar(255), + TYPE_SPECIFIC_INFO varchar(512), + CREATED_BY_PARTY_ID bigint, + LAST_MODIFIED_BY bigint, + primary key (DOCUMENT_ID) + ); + + create table CCM_CORE.LUCENE_INDEXES ( + INDEX_ID bigint not null, + LUCENE_INDEX_ID bigint, + HOST_ID bigint, + primary key (INDEX_ID) + ); + + create table CCM_CORE.MESSAGES ( + BODY varchar(255), + BODY_MIME_TYPE varchar(255), + SENT timestamp, + SUBJECT varchar(255), + OBJECT_ID bigint not null, + IN_REPLY_TO_ID bigint, + SENDER_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.NOTIFICATIONS ( + EXPAND_GROUP boolean, + EXPUNGE boolean, + EXPUNGE_MESSAGE boolean, + FULFILL_DATE timestamp, + HEADER varchar(4096), + MAX_RETRIES bigint, + REQUEST_DATE timestamp, + SIGNATURE varchar(4096), + STATUS varchar(32), + OBJECT_ID bigint not null, + DIGEST_ID bigint, + MESSAGE_ID bigint, + RECEIVER_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.ONE_TIME_AUTH_TOKENS ( + TOKEN_ID bigint not null, + PURPOSE varchar(255), + TOKEN varchar(255), + VALID_UNTIL timestamp, + USER_ID bigint, + primary key (TOKEN_ID) + ); + + create table CCM_CORE.PARTIES ( + PARTY_ID bigint not null, + NAME varchar(256) not null, + primary key (PARTY_ID) + ); + + create table CCM_CORE.PERMISSIONS ( + PERMISSION_ID bigint not null, + CREATION_DATE timestamp, + CREATION_IP varchar(255), + granted_privilege varchar(255), + CREATION_USER_ID bigint, + GRANTEE_ID bigint, + OBJECT_ID bigint, + primary key (PERMISSION_ID) + ); + + create table CCM_CORE.PORTALS ( + TEMPLATE boolean, + OBJECT_ID bigint not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.PORTLETS ( + CELL_NUMBER bigint, + SORT_KEY bigint, + OBJECT_ID bigint not null, + PORTAL_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.QUEUE_ITEMS ( + QUEUE_ITEM_ID bigint not null, + HEADER varchar(4096), + RECEIVER_ADDRESS varchar(512), + RETRY_COUNT bigint, + SIGNATURE varchar(4096), + SUCCESSFUL_SENDED boolean, + MESSAGE_ID bigint, + RECEIVER_ID bigint, + primary key (QUEUE_ITEM_ID) + ); + + create table CCM_CORE.RESOURCE_DESCRIPTIONS ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.RESOURCE_TITLES ( + OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS ( + RESOURCE_TYPE_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (RESOURCE_TYPE_ID, LOCALE) + ); + + create table CCM_CORE.RESOURCE_TYPES ( + RESOURCE_TYPE_ID bigint not null, + SINGLETON boolean, + TITLE varchar(254) not null, + EMBEDDED_VIEW boolean, + FULL_PAGE_VIEW boolean, + WORKSPACE_APP boolean, + primary key (RESOURCE_TYPE_ID) + ); + + create table CCM_CORE.RESOURCES ( + CREATED timestamp, + OBJECT_ID bigint not null, + parent_OBJECT_ID bigint, + resourceType_RESOURCE_TYPE_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.ROLE_MEMBERSHIPS ( + MEMBERSHIP_ID bigint not null, + MEMBER_ID bigint, + ROLE_ID bigint, + primary key (MEMBERSHIP_ID) + ); + + create table CCM_CORE.SETTINGS ( + DTYPE varchar(31) not null, + SETTING_ID bigint not null, + CONFIGURATION_CLASS varchar(512) not null, + NAME varchar(512) not null, + SETTING_VALUE_BOOLEAN boolean, + SETTING_VALUE_STRING varchar(1024), + SETTING_VALUE_BIG_DECIMAL decimal(19,2), + SETTING_VALUE_LONG bigint, + SETTING_VALUE_DOUBLE double, + primary key (SETTING_ID) + ); + + create table CCM_CORE.SETTINGS_ENUM_VALUES ( + ENUM_ID bigint not null, + value varchar(255) + ); + + create table CCM_CORE.SETTINGS_L10N_STR_VALUES ( + ENTRY_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (ENTRY_ID, LOCALE) + ); + + create table CCM_CORE.SETTINGS_STRING_LIST ( + LIST_ID bigint not null, + value varchar(255) + ); + + create table CCM_CORE.TASK_ASSIGNMENTS ( + TASK_ASSIGNMENT_ID bigint not null, + ROLE_ID bigint, + TASK_ID bigint, + primary key (TASK_ASSIGNMENT_ID) + ); + + create table CCM_CORE.THREADS ( + OBJECT_ID bigint not null, + ROOT_ID bigint, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.USER_EMAIL_ADDRESSES ( + USER_ID bigint not null, + EMAIL_ADDRESS varchar(512) not null, + BOUNCING boolean, + VERIFIED boolean + ); + + create table CCM_CORE.USERS ( + BANNED boolean, + FAMILY_NAME varchar(512), + GIVEN_NAME varchar(512), + PASSWORD varchar(2048), + PASSWORD_RESET_REQUIRED boolean, + EMAIL_ADDRESS varchar(512) not null, + BOUNCING boolean, + VERIFIED boolean, + PARTY_ID bigint not null, + primary key (PARTY_ID) + ); + + create table CCM_CORE.WORKFLOW_DESCRIPTIONS ( + WORKFLOW_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (WORKFLOW_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_NAMES ( + WORKFLOW_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (WORKFLOW_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( + TASK_ID bigint not null, + COMMENT clob + ); + + create table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES ( + DEPENDS_ON_TASK_ID bigint not null, + DEPENDENT_TASK_ID bigint not null + ); + + create table CCM_CORE.WORKFLOW_TASK_LABELS ( + TASK_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_TASKS ( + TASK_ID bigint not null, + ACTIVE boolean, + TASK_STATE varchar(512), + WORKFLOW_ID bigint, + primary key (TASK_ID) + ); + + create table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS ( + TASK_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_USER_TASKS ( + TASK_ID bigint not null, + ACTIVE boolean, + TASK_STATE varchar(512), + WORKFLOW_ID bigint, + DUE_DATE timestamp, + DURATION_MINUTES bigint, + LOCKED boolean, + START_DATE timestamp, + LOCKING_USER_ID bigint, + NOTIFICATION_SENDER bigint, + primary key (TASK_ID) + ); + + create table CCM_CORE.WORKFLOWS ( + WORKFLOW_ID bigint not null, + primary key (WORKFLOW_ID) + ); + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY); + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint UK_i1xqotjvml7i6ro2jq22fxf5g unique (URI); + + alter table CCM_CORE.CCM_OBJECTS + add constraint UK_1cm71jlagvyvcnkqvxqyit3wx unique (UUID); + + alter table CCM_CORE.HOSTS + add constraint UK9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT); + + alter table CCM_CORE.INSTALLED_MODULES + add constraint UK_11imwgfojyi4hpr18uw9g3jvx unique (MODULE_CLASS_NAME); + + alter table CCM_CORE.SETTINGS + add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); +create sequence hibernate_sequence start with 1 increment by 1; + + create table ContentType_values ( + ContentType_OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (ContentType_OBJECT_ID, LOCALE) + ); + + create table GenericArticle_values ( + GenericArticle_OBJECT_ID bigint not null, + LOCALIZED_VALUE clob, + LOCALE varchar(255) not null, + primary key (GenericArticle_OBJECT_ID, LOCALE) + ); + + create table GenericArticle_values_AUD ( + REV integer not null, + GenericArticle_OBJECT_ID bigint not null, + LOCALIZED_VALUE clob not null, + LOCALE varchar(255) not null, + REVTYPE tinyint, + REVEND integer, + primary key (REV, GenericArticle_OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + alter table CCM_CMS.ARTICLES + add constraint FK2pwvn9v2t2pikcw5hn2oq13q + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.ARTICLES_AUD + add constraint FKnevu4il5fu4vy2f5twh50kstr + foreign key (OBJECT_ID, REV) + references CCM_CMS.CONTENT_ITEMS_AUD; + + alter table CCM_CMS.ASSET_TITLES + add constraint FKj61sy509dv63u246wlau5f9pa + foreign key (ASSET_ID) + references CCM_CMS.ASSETS; + + alter table CCM_CMS.ASSET_TITLES_AUD + add constraint FK6yuimrre2oowjo0diw6b00nhe + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ASSET_TITLES_AUD + add constraint FKcaockxi21ve0irh06vegc77uu + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ASSETS_AUD + add constraint FK4m4op9s9h5qhndcsssbu55gr2 + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ASSETS_AUD + add constraint FK586j3p95nw2oa6yd06xdw0o5u + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENT_LIST_CAPTIONS + add constraint FKdtsxi1x0psj4rsfc15tea5ku5 + foreign key (LIST_ID) + references CCM_CMS.attachment_lists; + + alter table CCM_CMS.ATTACHMENT_LIST_CAPTIONS_AUD + add constraint FK727detagt51wmejywhteq4jfs + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENT_LIST_CAPTIONS_AUD + add constraint FK7589vpkxegxs8y3wqjx37tig3 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.attachment_lists + add constraint FKdjvwy4y3m6jd6c2ipkgsbwwc3 + foreign key (CONTENT_ITEM_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.attachment_lists_AUD + add constraint FK83ylk9d0wib4k3l9ob4bx2rgo + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.attachment_lists_AUD + add constraint FKrshwuqc6cnb4bnybqsmavsxh3 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.AttachmentList_ItemAttachment_AUD + add constraint FKduowjilu7dqfs2oja88tr5oim + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.AttachmentList_ItemAttachment_AUD + add constraint FKdtm7qp3n6cojbm9b916plsgtx + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENTS + add constraint FKmn0bm137vwr61iy5nb59cjm22 + foreign key (ASSET_ID) + references CCM_CMS.ASSETS; + + alter table CCM_CMS.ATTACHMENTS + add constraint FK1rmlsdulpurab4nq89o5go9oa + foreign key (LIST_ID) + references CCM_CMS.attachment_lists; + + alter table CCM_CMS.ATTACHMENTS_AUD + add constraint FKl19663g6todb5d1e9lok7fl9e + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENTS_AUD + add constraint FK4n28sostn1hc8bf43qsp1pyuf + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS + add constraint FK6mt4tjnenr79o52wcj99tpeu4 + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS_AUD + add constraint FK12yrysxv4fxa73ker40e883av + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS_AUD + add constraint FK4pxuq0pf2hrtireo902t21ocx + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_NAMES + add constraint FKijrfangf9s3lyncmod651xyg8 + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.CONTENT_ITEM_NAMES_AUD + add constraint FKq631ee5ollx5xkliowcrt8wkj + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_NAMES_AUD + add constraint FKbjaycalit9pa2u7ae5dwjgtky + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_TITLES + add constraint FKbvf67lou4ep94pgi6tur6o2gf + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.CONTENT_ITEM_TITLES_AUD + add constraint FKfbno0rxshoi57y8aehwv3o42j + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_TITLES_AUD + add constraint FK4c3exifj1ghwg6htglynlo094 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEMS + add constraint FKi1ce005bvnavqy8xlyim60yav + foreign key (contentType_OBJECT_ID) + references CCM_CMS.CONTENT_TYPES; + + alter table CCM_CMS.CONTENT_ITEMS + add constraint FK1fr2q5y1wpmrufruja5ivfpuf + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CMS.CONTENT_ITEMS_AUD + add constraint FKsfhj0qok0ksjplvgcaditqekl + foreign key (OBJECT_ID, REV) + references CCM_CORE.CCM_OBJECTS_AUD; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FKajweudfxaf7g2ydr2hcgqwcib + foreign key (ROOT_ASSETS_FOLDER_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FK6g7kw4b6diqa0nks45ilp0vhs + foreign key (ROOT_DOCUMENTS_FOLDER_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FKqb579yjmmqbergn0qv68a4rqb + foreign key (STAFF_ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FKjntqpyi3g4bx97ive5x8aipyi + foreign key (VIEWERS_ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FK72jh0axiiru87i61mppvaiv96 + foreign key (OBJECT_ID) + references CCM_CORE.APPLICATIONS; + + alter table CCM_CMS.CONTENT_TYPES + add constraint FK96vwsbqfbdg33ujeeawajr0v4 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CMS.ContentItem_AttachmentList_AUD + add constraint FK4notdhn18abev1asay7cmyy84 + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ContentItem_AttachmentList_AUD + add constraint FK16sw895gdgghrymbirrgrvxsa + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.REUSABLE_ASSETS + add constraint FKngdq6f077q6ndqn9o3jc6k14a + foreign key (ASSET_ID) + references CCM_CMS.ASSETS; + + alter table CCM_CMS.REUSABLE_ASSETS + add constraint FKhvf4mfltp8abbr5u0qgjm2jk2 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CMS.REUSABLE_ASSETS_AUD + add constraint FKgyc5gd3cffox4wvjoir6i4gxt + foreign key (OBJECT_ID, REV) + references CCM_CORE.CCM_OBJECTS_AUD; + + alter table CCM_CORE.APPLICATIONS + add constraint FKatcp9ij6mbkx0nfeig1o6n3lm + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.ATTACHMENTS + add constraint FK8ju9hm9baceridp803nislkwb + foreign key (MESSAGE_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.CATEGORIES + add constraint FKrj3marx99nheur4fqanm0ylur + foreign key (PARENT_CATEGORY_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORIES + add constraint FKpm291swli2musd0204phta652 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.CATEGORIZATIONS + add constraint FKejp0ubk034nfq60v1po6srkke + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.CATEGORIZATIONS + add constraint FKoyeipswl876wa6mqwbx0uy83h + foreign key (CATEGORY_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORY_DESCRIPTIONS + add constraint FKhiwjlmh5vkbu3v3vng1la1qum + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint FKf25vi73cji01w8fgo6ow1dgg + foreign key (ROOT_CATEGORY_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint FK58xpmnvciohkom1c16oua4xha + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.CATEGORY_TITLES + add constraint FKka9bt9f5br0kji5bcjxcmf6ch + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CCM_OBJECTS_AUD + add constraint FKr00eauutiyvocno8ckx6h9nw6 + foreign key (REV) + 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 + add constraint FKc53g09agnye3w1v4euy3e0gsi + foreign key (FROM_PARTY_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.DIGESTS + add constraint FK845r9ep6xu6nbt1mvxulwybym + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.DOMAIN_DESCRIPTIONS + add constraint FKn4i2dxgn8cqysa62dds6eih6a + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORY_DOMAINS; + + alter table CCM_CORE.DOMAIN_OWNERSHIPS + add constraint FK47nsasr7jrdwlky5gx0u6e9py + foreign key (domain_OBJECT_ID) + references CCM_CORE.CATEGORY_DOMAINS; + + alter table CCM_CORE.DOMAIN_OWNERSHIPS + add constraint FK3u4hq6yqau4m419b1xva3xpwq + foreign key (owner_OBJECT_ID) + references CCM_CORE.APPLICATIONS; + + alter table CCM_CORE.DOMAIN_TITLES + add constraint FK5p526dsdwn94els6lp5w0hdn4 + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORY_DOMAINS; + + alter table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS + add constraint FKfh0k9lj3pf4amfc9bbbss0tr1 + foreign key (COMPONENT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_COMPONENTS + add constraint FKpcpmvyiix023b4g5n4q8nkfca + foreign key (parentComponent_OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_COMPONENTS + add constraint FKt0e0uv00pp1rwhyaltrytghnm + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_CONFIRM_EMAIL_LISTENER + add constraint FK48khrbud3xhi2gvsvnlttd8tg + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_CONFIRM_REDIRECT_LISTENERS + add constraint FKbyjjt2ufendvje2obtge2l7et + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_DATA_DRIVEN_SELECTS + add constraint FK8oriyta1957u7dvbrqk717944 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGETS; + + alter table CCM_CORE.FORMBUILDER_DATA_QUERIES + add constraint FKhhaxpeddbtmrnjr5o0fopju3a + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS + add constraint FKsmduu1opoiulkeo2gc8v7lsbn + foreign key (DATA_QUERY_ID) + references CCM_CORE.FORMBUILDER_DATA_QUERIES; + + alter table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES + add constraint FKju1x82inrw3kguyjuxoetn6gn + foreign key (DATA_QUERY_ID) + references CCM_CORE.FORMBUILDER_DATA_QUERIES; + + alter table CCM_CORE.FORMBUILDER_FORMSECTIONS + add constraint FKnfhsgxp4lvigq2pm33pn4afac + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_LISTENERS + add constraint FK33ilyirwoux28yowafgd5xx0o + foreign key (widget_OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGETS; + + alter table CCM_CORE.FORMBUILDER_LISTENERS + add constraint FKlqm76746nq5yrt8ganm474uu0 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_METAOBJECTS + add constraint FKf963v6u9mw8pwjmasrw51w8dx + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_OBJECT_TYPES + add constraint FKkv337e83rsecf0h3qy8bu7l9w + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_OPTION_LABELS + add constraint FKatlsylsvln6yse55eof6wwkj6 + foreign key (OPTION_ID) + references CCM_CORE.FORMBUILDER_OPTIONS; + + alter table CCM_CORE.FORMBUILDER_OPTIONS + add constraint FKhe5q71wby9g4i56sotc501h11 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS + add constraint FKcv3iu04gxjk9c0pn6tl8rqqv3 + foreign key (PROCESS_LISTENER_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES + add constraint FK8rnyb1m6ij3b9hhmhr7klgd4p + foreign key (PROCESS_LISTENER_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS + add constraint FK7uiaeax8qafm82e5k729ms5ku + foreign key (formSection_OBJECT_ID) + references CCM_CORE.FORMBUILDER_FORMSECTIONS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS + add constraint FKbdnloo884qk6gn36jwiqv5rlp + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_REMOTE_SERVER_POST_LISTENER + add constraint FKpajvu9m6fj1enm67a9gcb5ii9 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_SIMPLE_EMAIL_LISTENERS + add constraint FKsn82ktlq0c9ikijyv8k2bfv4f + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_TEMPLATE_EMAIL_LISTENERS + add constraint FK8kjyu72btjsuaaqh4bvd8npns + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS + add constraint FKb1q9bfshcrkwlj7r8w5jb4y8l + foreign key (widget_OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGETS; + + alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS + add constraint FKm1huo6ghk9l5o8buku9v8y6q7 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_WIDGETS + add constraint FKs7qq6vxblhmq0rlf87re65jdp + foreign key (label_OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGET_LABELS; + + alter table CCM_CORE.FORMBUILDER_WIDGETS + add constraint FK1wosr4ujbfckdc50u5fgmrhrk + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_XML_EMAIL_LISTENERS + add constraint FKjie9co03m7ow4ihig5rk7l8oj + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.GROUP_MEMBERSHIPS + add constraint FKq4qnny8ri3eo7eqh4olxco8nk + foreign key (GROUP_ID) + references CCM_CORE.GROUPS; + + alter table CCM_CORE.GROUP_MEMBERSHIPS + add constraint FKc8u86ivkhvoiw6ju8b2p365he + foreign key (MEMBER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.GROUPS + add constraint FK4f61mlqxw0ct6s7wwpi9m0735 + foreign key (PARTY_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.INITS + add constraint FK3nvvxk10nmq9nfuko8yklqdgc + foreign key (REQUIRED_BY_ID) + references CCM_CORE.INITS; + + alter table CCM_CORE.LUCENE_DOCUMENTS + add constraint FK942kl4yff8rdiwr0pjk2a9g8 + foreign key (CREATED_BY_PARTY_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.LUCENE_DOCUMENTS + add constraint FKc5rs6afx4p9fidabfqsxr5ble + foreign key (LAST_MODIFIED_BY) + references CCM_CORE.USERS; + + alter table CCM_CORE.LUCENE_INDEXES + add constraint FK6gu0yrlviqk07dtb3r02iw43f + foreign key (HOST_ID) + references CCM_CORE.HOSTS; + + alter table CCM_CORE.MESSAGES + add constraint FKph10aehmg9f20pn2w4buki97q + foreign key (IN_REPLY_TO_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.MESSAGES + add constraint FKjufsx3c3h538fj35h8hgfnb1p + foreign key (SENDER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.MESSAGES + add constraint FK6w20ao7scwecd9mfwpun2ddqx + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FKqk70c1x1dklhty9ju5t4wukd9 + foreign key (DIGEST_ID) + references CCM_CORE.DIGESTS; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FKtt4fjr2p75og79jxxgd8q8mr + foreign key (MESSAGE_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FK2vlnma0ox43j0clx8ead08n5s + foreign key (RECEIVER_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FKf423hhiaw1bexpxeh1pnas7qt + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.ONE_TIME_AUTH_TOKENS + add constraint FKtplfuphkiorfkttaewb4wmfjc + foreign key (USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.PERMISSIONS + add constraint FKj9di7pawxgtouxmu2k44bj5c4 + foreign key (CREATION_USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.PERMISSIONS + add constraint FKikx3x0kn9fito23g50v6xbr9f + foreign key (GRANTEE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.PERMISSIONS + add constraint FKkamckexjnffnt8lay9nqeawhm + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.PORTALS + add constraint FK5a2hdrbw03mmgr74vj5nxlpvk + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.PORTLETS + add constraint FK9gr5xjt3rx4uhtw7vl6adruol + foreign key (PORTAL_ID) + references CCM_CORE.PORTALS; + + alter table CCM_CORE.PORTLETS + add constraint FKjmx9uebt0gwxkw3xv34niy35f + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.QUEUE_ITEMS + add constraint FKtgkwfruv9kjdybf46l02da088 + foreign key (MESSAGE_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.QUEUE_ITEMS + add constraint FKs9aq1hyxstwmvx7fmfifp4x7r + foreign key (RECEIVER_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.RESOURCE_DESCRIPTIONS + add constraint FKk9arvj5u21rv23ce3cav4opqx + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.RESOURCE_TITLES + add constraint FKto4p6n2wklljyf7tmuxtmyfe0 + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS + add constraint FKckpihjtv23iahbg3imnpbsr2 + foreign key (RESOURCE_TYPE_ID) + references CCM_CORE.RESOURCE_TYPES; + + alter table CCM_CORE.RESOURCES + add constraint FKbo7ibfgodicn9flv2gfo11g5a + foreign key (parent_OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.RESOURCES + add constraint FK262fbwetpjx3k4uuvw24wsiv + foreign key (resourceType_RESOURCE_TYPE_ID) + references CCM_CORE.RESOURCE_TYPES; + + alter table CCM_CORE.RESOURCES + add constraint FKbjdf8pm4frth8r06ev2qjm88f + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.ROLE_MEMBERSHIPS + add constraint FK9m88ywi7rcin7b7jrgh53emrq + foreign key (MEMBER_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.ROLE_MEMBERSHIPS + add constraint FKcsyogv5m2rgsrmtgnhgkjhfw7 + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.SETTINGS_ENUM_VALUES + add constraint FK8mw4p92s0h3h8bmo8saowu32i + foreign key (ENUM_ID) + references CCM_CORE.SETTINGS; + + alter table CCM_CORE.SETTINGS_L10N_STR_VALUES + add constraint FK5knjq7cisej0qfx5dw1y93rou + foreign key (ENTRY_ID) + references CCM_CORE.SETTINGS; + + alter table CCM_CORE.SETTINGS_STRING_LIST + add constraint FKqeclqa5sf1g53vxs857tpwrus + foreign key (LIST_ID) + references CCM_CORE.SETTINGS; + + alter table CCM_CORE.TASK_ASSIGNMENTS + add constraint FKe29uwmvxdmol1fjob3auej4qv + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.TASK_ASSIGNMENTS + add constraint FKc1vovbjg9mp5yegx2fdoutx7u + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_USER_TASKS; + + alter table CCM_CORE.THREADS + add constraint FKsx08mpwvwnw97uwdgjs76q39g + foreign key (ROOT_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.THREADS + add constraint FKp97b1sy1kop07rtapeh5l9fb2 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.USER_EMAIL_ADDRESSES + add constraint FKr900l79erul95seyyccf04ufc + foreign key (USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.USERS + add constraint FKosh928q71aonu6l1kurb417r + foreign key (PARTY_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.WORKFLOW_DESCRIPTIONS + add constraint FKgx7upkqky82dpxvbs95imfl9l + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table CCM_CORE.WORKFLOW_NAMES + add constraint FKkxedy9p48avfk45r0bn4uc09i + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table CCM_CORE.WORKFLOW_TASKS + add constraint FK1693cbc36e4d8gucg8q7sc57e + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table CCM_CORE.WORKFLOW_USER_TASKS + add constraint FKf09depwj5rgso2dair07vnu33 + foreign key (LOCKING_USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_USER_TASKS + add constraint FK6evo9y34awhdfcyl8gv78qb7f + foreign key (NOTIFICATION_SENDER) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_USER_TASKS + add constraint FK_bg60xxg9kerqsxyphbfxulg8y + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table ContentType_values + add constraint FK1xrt2eg0gib7xiy65evato7wi + foreign key (ContentType_OBJECT_ID) + references CCM_CMS.CONTENT_TYPES; + + alter table GenericArticle_values + add constraint FK104jagl41apaxmj52tn0c9hl + foreign key (GenericArticle_OBJECT_ID) + references CCM_CMS.ARTICLES; + + alter table GenericArticle_values_AUD + add constraint FKsxpv88pqmp913gegakv7crgbx + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table GenericArticle_values_AUD + add constraint FKpk72t5b9rbjeufkv18e3raku2 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; diff --git a/ccm-cms/src/main/resources/db/migrations/org/librecms/cms/pgsql/V7_0_0_0__create_tables.sql b/ccm-cms/src/main/resources/db/migrations/org/librecms/cms/pgsql/V7_0_0_0__create_tables.sql new file mode 100644 index 000000000..bafeec601 --- /dev/null +++ b/ccm-cms/src/main/resources/db/migrations/org/librecms/cms/pgsql/V7_0_0_0__create_tables.sql @@ -0,0 +1,1567 @@ + + create table CCM_CMS.ARTICLES ( + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.ARTICLES_AUD ( + OBJECT_ID int8 not null, + REV int4 not null, + primary key (OBJECT_ID, REV) + ); + + create table CCM_CMS.ASSET_TITLES ( + ASSET_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (ASSET_ID, LOCALE) + ); + + create table CCM_CMS.ASSET_TITLES_AUD ( + REV int4 not null, + ASSET_ID int8 not null, + LOCALIZED_VALUE text not null, + LOCALE varchar(255) not null, + REVTYPE int2, + REVEND int4, + primary key (REV, ASSET_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.ASSETS ( + ASSET_ID int8 not null, + UUID varchar(255), + primary key (ASSET_ID) + ); + + create table CCM_CMS.ASSETS_AUD ( + ASSET_ID int8 not null, + REV int4 not null, + REVTYPE int2, + REVEND int4, + UUID varchar(255), + primary key (ASSET_ID, REV) + ); + + create table CCM_CMS.ATTACHMENT_LIST_CAPTIONS ( + LIST_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (LIST_ID, LOCALE) + ); + + create table CCM_CMS.ATTACHMENT_LIST_CAPTIONS_AUD ( + REV int4 not null, + LIST_ID int8 not null, + LOCALIZED_VALUE text not null, + LOCALE varchar(255) not null, + REVTYPE int2, + REVEND int4, + primary key (REV, LIST_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.attachment_lists ( + LIST_ID int8 not null, + ASSET_TYPE varchar(1024), + UUID varchar(255), + CONTENT_ITEM_ID int8, + primary key (LIST_ID) + ); + + create table CCM_CMS.attachment_lists_AUD ( + LIST_ID int8 not null, + REV int4 not null, + REVTYPE int2, + REVEND int4, + ASSET_TYPE varchar(1024), + UUID varchar(255), + primary key (LIST_ID, REV) + ); + + create table CCM_CMS.AttachmentList_ItemAttachment_AUD ( + REV int4 not null, + LIST_ID int8 not null, + ATTACHMENT_ID int8 not null, + REVTYPE int2, + REVEND int4, + primary key (REV, LIST_ID, ATTACHMENT_ID) + ); + + create table CCM_CMS.ATTACHMENTS ( + ATTACHMENT_ID int8 not null, + SORT_KEY int8, + uuid varchar(255), + ASSET_ID int8, + LIST_ID int8, + primary key (ATTACHMENT_ID) + ); + + create table CCM_CMS.ATTACHMENTS_AUD ( + ATTACHMENT_ID int8 not null, + REV int4 not null, + REVTYPE int2, + REVEND int4, + SORT_KEY int8, + uuid varchar(255), + ASSET_ID int8, + primary key (ATTACHMENT_ID, REV) + ); + + create table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS_AUD ( + REV int4 not null, + OBJECT_ID int8 not null, + LOCALIZED_VALUE text not null, + LOCALE varchar(255) not null, + REVTYPE int2, + REVEND int4, + primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_NAMES ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_NAMES_AUD ( + REV int4 not null, + OBJECT_ID int8 not null, + LOCALIZED_VALUE text not null, + LOCALE varchar(255) not null, + REVTYPE int2, + REVEND int4, + primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_TITLES ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEM_TITLES_AUD ( + REV int4 not null, + OBJECT_ID int8 not null, + LOCALIZED_VALUE text not null, + LOCALE varchar(255) not null, + REVTYPE int2, + REVEND int4, + primary key (REV, OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + create table CCM_CMS.CONTENT_ITEMS ( + ANCESTORS varchar(1024), + launchDate date, + version varchar(255), + OBJECT_ID int8 not null, + contentType_OBJECT_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.CONTENT_ITEMS_AUD ( + OBJECT_ID int8 not null, + REV int4 not null, + ANCESTORS varchar(1024), + launchDate date, + version varchar(255), + contentType_OBJECT_ID int8, + primary key (OBJECT_ID, REV) + ); + + create table CCM_CMS.CONTENT_SECTIONS ( + DEFAULT_LOCALE varchar(255), + ITEM_RESOLVER_CLASS varchar(1024), + LABEL varchar(512), + PAGE_RESOLVER_CLASS varchar(1024), + TEMPLATE_RESOLVER_CLASS varchar(1024), + XML_GENERATOR_CLASS varchar(1024), + OBJECT_ID int8 not null, + ROOT_ASSETS_FOLDER_ID int8, + ROOT_DOCUMENTS_FOLDER_ID int8, + STAFF_ROLE_ID int8, + VIEWERS_ROLE_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.CONTENT_TYPES ( + ANCESTORS varchar(1024), + CONTENT_ITEM_CLASS varchar(1024), + DESCENDANTS varchar(1024), + mode varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.ContentItem_AttachmentList_AUD ( + REV int4 not null, + CONTENT_ITEM_ID int8 not null, + LIST_ID int8 not null, + REVTYPE int2, + REVEND int4, + primary key (REV, CONTENT_ITEM_ID, LIST_ID) + ); + + create table CCM_CMS.REUSABLE_ASSETS ( + OBJECT_ID int8 not null, + ASSET_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CMS.REUSABLE_ASSETS_AUD ( + OBJECT_ID int8 not null, + REV int4 not null, + ASSET_ID int8, + primary key (OBJECT_ID, REV) + ); + + alter table CCM_CMS.ASSETS + add constraint UK_9l2v1u9beyemgjwqx7isbumwh unique (UUID); + + create table CCM_CORE.APPLICATIONS ( + APPLICATION_TYPE varchar(1024) not null, + PRIMARY_URL varchar(1024) not null, + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.ATTACHMENTS ( + ATTACHMENT_ID int8 not null, + ATTACHMENT_DATA oid, + DESCRIPTION varchar(255), + MIME_TYPE varchar(255), + TITLE varchar(255), + MESSAGE_ID int8, + primary key (ATTACHMENT_ID) + ); + + create table CCM_CORE.CATEGORIES ( + ABSTRACT_CATEGORY boolean, + CATEGORY_ORDER int8, + ENABLED boolean, + NAME varchar(255) not null, + UNIQUE_ID varchar(255), + VISIBLE boolean, + OBJECT_ID int8 not null, + PARENT_CATEGORY_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.CATEGORIZATIONS ( + CATEGORIZATION_ID int8 not null, + CATEGORY_ORDER int8, + CATEGORY_INDEX boolean, + OBJECT_ORDER int8, + OBJECT_ID int8, + CATEGORY_ID int8, + primary key (CATEGORIZATION_ID) + ); + + create table CCM_CORE.CATEGORY_DESCRIPTIONS ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.CATEGORY_DOMAINS ( + DOMAIN_KEY varchar(255) not null, + RELEASED timestamp, + URI varchar(1024), + VERSION varchar(255), + OBJECT_ID int8 not null, + ROOT_CATEGORY_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.CATEGORY_TITLES ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.CCM_OBJECTS ( + OBJECT_ID int8 not null, + DISPLAY_NAME varchar(255), + UUID varchar(255), + primary key (OBJECT_ID) + ); + + create table CCM_CORE.CCM_OBJECTS_AUD ( + OBJECT_ID int8 not null, + REV int4 not null, + REVTYPE int2, + REVEND int4, + DISPLAY_NAME varchar(255), + primary key (OBJECT_ID, REV) + ); + + create table CCM_CORE.CCM_REVISIONS ( + id int4 not null, + timestamp int8 not null, + USER_NAME varchar(255), + primary key (id) + ); + + create table CCM_CORE.CCM_ROLES ( + ROLE_ID int8 not null, + NAME varchar(512) not null, + primary key (ROLE_ID) + ); + + create table CCM_CORE.DIGESTS ( + FREQUENCY int4, + HEADER varchar(4096) not null, + NEXT_RUN timestamp, + DIGEST_SEPARATOR varchar(128) not null, + SIGNATURE varchar(4096) not null, + SUBJECT varchar(255) not null, + OBJECT_ID int8 not null, + FROM_PARTY_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.DOMAIN_DESCRIPTIONS ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.DOMAIN_OWNERSHIPS ( + OWNERSHIP_ID int8 not null, + CONTEXT varchar(255), + DOMAIN_ORDER int8, + OWNER_ORDER int8, + domain_OBJECT_ID int8 not null, + owner_OBJECT_ID int8 not null, + primary key (OWNERSHIP_ID) + ); + + create table CCM_CORE.DOMAIN_TITLES ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS ( + COMPONENT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (COMPONENT_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_COMPONENTS ( + ACTIVE boolean, + ADMIN_NAME varchar(255), + ATTRIBUTE_STRING varchar(255), + COMPONENT_ORDER int8, + SELECTED boolean, + OBJECT_ID int8 not null, + parentComponent_OBJECT_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_CONFIRM_EMAIL_LISTENER ( + BODY text, + FROM_EMAIL varchar(255), + SUBJECT varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_CONFIRM_REDIRECT_LISTENERS ( + URL varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_DATA_DRIVEN_SELECTS ( + MULTIPLE boolean, + QUERY varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_DATA_QUERIES ( + QUERY_ID varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS ( + DATA_QUERY_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (DATA_QUERY_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES ( + DATA_QUERY_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (DATA_QUERY_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_FORMSECTIONS ( + FORMSECTION_ACTION varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_LISTENERS ( + ATTRIBUTE_STRING varchar(255), + CLASS_NAME varchar(255), + OBJECT_ID int8 not null, + widget_OBJECT_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_METAOBJECTS ( + CLASS_NAME varchar(255), + PRETTY_NAME varchar(255), + PRETTY_PLURAL varchar(255), + PROPERTIES_FORM varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_OBJECT_TYPES ( + APP_NAME varchar(255), + CLASS_NAME varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_OPTION_LABELS ( + OPTION_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OPTION_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_OPTIONS ( + PARAMETER_VALUE varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS ( + PROCESS_LISTENER_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (PROCESS_LISTENER_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES ( + PROCESS_LISTENER_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (PROCESS_LISTENER_ID, LOCALE) + ); + + create table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS ( + LISTENER_CLASS varchar(255), + PROCESS_LISTENER_ORDER int8, + OBJECT_ID int8 not null, + formSection_OBJECT_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_REMOTE_SERVER_POST_LISTENER ( + REMOTE_URL varchar(2048), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_SIMPLE_EMAIL_LISTENERS ( + RECIPIENT varchar(255), + SUBJECT varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_TEMPLATE_EMAIL_LISTENERS ( + BODY text, + RECIPIENT varchar(255), + SUBJECT varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_WIDGET_LABELS ( + OBJECT_ID int8 not null, + widget_OBJECT_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_WIDGETS ( + DEFAULT_VALUE varchar(255), + PARAMETER_MODEL varchar(255), + PARAMETER_NAME varchar(255), + OBJECT_ID int8 not null, + label_OBJECT_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.FORMBUILDER_XML_EMAIL_LISTENERS ( + RECIPIENT varchar(255), + SUBJECT varchar(255), + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.GROUP_MEMBERSHIPS ( + MEMBERSHIP_ID int8 not null, + GROUP_ID int8, + MEMBER_ID int8, + primary key (MEMBERSHIP_ID) + ); + + create table CCM_CORE.GROUPS ( + PARTY_ID int8 not null, + primary key (PARTY_ID) + ); + + create table CCM_CORE.HOSTS ( + HOST_ID int8 not null, + SERVER_NAME varchar(512), + SERVER_PORT int8, + primary key (HOST_ID) + ); + + create table CCM_CORE.INITS ( + INITIALIZER_ID int8 not null, + CLASS_NAME varchar(255), + REQUIRED_BY_ID int8, + primary key (INITIALIZER_ID) + ); + + create table CCM_CORE.INSTALLED_MODULES ( + MODULE_ID int4 not null, + MODULE_CLASS_NAME varchar(2048), + STATUS varchar(255), + primary key (MODULE_ID) + ); + + create table CCM_CORE.LUCENE_DOCUMENTS ( + DOCUMENT_ID int8 not null, + CONTENT text, + CONTENT_SECTION varchar(512), + COUNTRY varchar(8), + CREATED timestamp, + DIRTY int8, + DOCUMENT_LANGUAGE varchar(8), + LAST_MODIFIED timestamp, + SUMMARY varchar(4096), + DOCUMENT_TIMESTAMP timestamp, + TITLE varchar(4096), + TYPE varchar(255), + TYPE_SPECIFIC_INFO varchar(512), + CREATED_BY_PARTY_ID int8, + LAST_MODIFIED_BY int8, + primary key (DOCUMENT_ID) + ); + + create table CCM_CORE.LUCENE_INDEXES ( + INDEX_ID int8 not null, + LUCENE_INDEX_ID int8, + HOST_ID int8, + primary key (INDEX_ID) + ); + + create table CCM_CORE.MESSAGES ( + BODY varchar(255), + BODY_MIME_TYPE varchar(255), + SENT timestamp, + SUBJECT varchar(255), + OBJECT_ID int8 not null, + IN_REPLY_TO_ID int8, + SENDER_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.NOTIFICATIONS ( + EXPAND_GROUP boolean, + EXPUNGE boolean, + EXPUNGE_MESSAGE boolean, + FULFILL_DATE timestamp, + HEADER varchar(4096), + MAX_RETRIES int8, + REQUEST_DATE timestamp, + SIGNATURE varchar(4096), + STATUS varchar(32), + OBJECT_ID int8 not null, + DIGEST_ID int8, + MESSAGE_ID int8, + RECEIVER_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.ONE_TIME_AUTH_TOKENS ( + TOKEN_ID int8 not null, + PURPOSE varchar(255), + TOKEN varchar(255), + VALID_UNTIL timestamp, + USER_ID int8, + primary key (TOKEN_ID) + ); + + create table CCM_CORE.PARTIES ( + PARTY_ID int8 not null, + NAME varchar(256) not null, + primary key (PARTY_ID) + ); + + create table CCM_CORE.PERMISSIONS ( + PERMISSION_ID int8 not null, + CREATION_DATE timestamp, + CREATION_IP varchar(255), + granted_privilege varchar(255), + CREATION_USER_ID int8, + GRANTEE_ID int8, + OBJECT_ID int8, + primary key (PERMISSION_ID) + ); + + create table CCM_CORE.PORTALS ( + TEMPLATE boolean, + OBJECT_ID int8 not null, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.PORTLETS ( + CELL_NUMBER int8, + SORT_KEY int8, + OBJECT_ID int8 not null, + PORTAL_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.QUEUE_ITEMS ( + QUEUE_ITEM_ID int8 not null, + HEADER varchar(4096), + RECEIVER_ADDRESS varchar(512), + RETRY_COUNT int8, + SIGNATURE varchar(4096), + SUCCESSFUL_SENDED boolean, + MESSAGE_ID int8, + RECEIVER_ID int8, + primary key (QUEUE_ITEM_ID) + ); + + create table CCM_CORE.RESOURCE_DESCRIPTIONS ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.RESOURCE_TITLES ( + OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (OBJECT_ID, LOCALE) + ); + + create table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS ( + RESOURCE_TYPE_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (RESOURCE_TYPE_ID, LOCALE) + ); + + create table CCM_CORE.RESOURCE_TYPES ( + RESOURCE_TYPE_ID int8 not null, + SINGLETON boolean, + TITLE varchar(254) not null, + EMBEDDED_VIEW boolean, + FULL_PAGE_VIEW boolean, + WORKSPACE_APP boolean, + primary key (RESOURCE_TYPE_ID) + ); + + create table CCM_CORE.RESOURCES ( + CREATED timestamp, + OBJECT_ID int8 not null, + parent_OBJECT_ID int8, + resourceType_RESOURCE_TYPE_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.ROLE_MEMBERSHIPS ( + MEMBERSHIP_ID int8 not null, + MEMBER_ID int8, + ROLE_ID int8, + primary key (MEMBERSHIP_ID) + ); + + create table CCM_CORE.SETTINGS ( + DTYPE varchar(31) not null, + SETTING_ID int8 not null, + CONFIGURATION_CLASS varchar(512) not null, + NAME varchar(512) not null, + SETTING_VALUE_BOOLEAN boolean, + SETTING_VALUE_STRING varchar(1024), + SETTING_VALUE_BIG_DECIMAL numeric(19, 2), + SETTING_VALUE_LONG int8, + SETTING_VALUE_DOUBLE float8, + primary key (SETTING_ID) + ); + + create table CCM_CORE.SETTINGS_ENUM_VALUES ( + ENUM_ID int8 not null, + value varchar(255) + ); + + create table CCM_CORE.SETTINGS_L10N_STR_VALUES ( + ENTRY_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (ENTRY_ID, LOCALE) + ); + + create table CCM_CORE.SETTINGS_STRING_LIST ( + LIST_ID int8 not null, + value varchar(255) + ); + + create table CCM_CORE.TASK_ASSIGNMENTS ( + TASK_ASSIGNMENT_ID int8 not null, + ROLE_ID int8, + TASK_ID int8, + primary key (TASK_ASSIGNMENT_ID) + ); + + create table CCM_CORE.THREADS ( + OBJECT_ID int8 not null, + ROOT_ID int8, + primary key (OBJECT_ID) + ); + + create table CCM_CORE.USER_EMAIL_ADDRESSES ( + USER_ID int8 not null, + EMAIL_ADDRESS varchar(512) not null, + BOUNCING boolean, + VERIFIED boolean + ); + + create table CCM_CORE.USERS ( + BANNED boolean, + FAMILY_NAME varchar(512), + GIVEN_NAME varchar(512), + PASSWORD varchar(2048), + PASSWORD_RESET_REQUIRED boolean, + EMAIL_ADDRESS varchar(512) not null, + BOUNCING boolean, + VERIFIED boolean, + PARTY_ID int8 not null, + primary key (PARTY_ID) + ); + + create table CCM_CORE.WORKFLOW_DESCRIPTIONS ( + WORKFLOW_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (WORKFLOW_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_NAMES ( + WORKFLOW_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (WORKFLOW_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_TASK_COMMENTS ( + TASK_ID int8 not null, + COMMENT text + ); + + create table CCM_CORE.WORKFLOW_TASK_DEPENDENCIES ( + DEPENDS_ON_TASK_ID int8 not null, + DEPENDENT_TASK_ID int8 not null + ); + + create table CCM_CORE.WORKFLOW_TASK_LABELS ( + TASK_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_TASKS ( + TASK_ID int8 not null, + ACTIVE boolean, + TASK_STATE varchar(512), + WORKFLOW_ID int8, + primary key (TASK_ID) + ); + + create table CCM_CORE.WORKFLOW_TASKS_DESCRIPTIONS ( + TASK_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (TASK_ID, LOCALE) + ); + + create table CCM_CORE.WORKFLOW_USER_TASKS ( + TASK_ID int8 not null, + ACTIVE boolean, + TASK_STATE varchar(512), + WORKFLOW_ID int8, + DUE_DATE timestamp, + DURATION_MINUTES int8, + LOCKED boolean, + START_DATE timestamp, + LOCKING_USER_ID int8, + NOTIFICATION_SENDER int8, + primary key (TASK_ID) + ); + + create table CCM_CORE.WORKFLOWS ( + WORKFLOW_ID int8 not null, + primary key (WORKFLOW_ID) + ); + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint UK_mb1riernf8a88u3mwl0bgfj8y unique (DOMAIN_KEY); + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint UK_i1xqotjvml7i6ro2jq22fxf5g unique (URI); + + alter table CCM_CORE.CCM_OBJECTS + add constraint UK_1cm71jlagvyvcnkqvxqyit3wx unique (UUID); + + alter table CCM_CORE.HOSTS + add constraint UK9ramlv6uxwt13v0wj7q0tucsx unique (SERVER_NAME, SERVER_PORT); + + alter table CCM_CORE.INSTALLED_MODULES + add constraint UK_11imwgfojyi4hpr18uw9g3jvx unique (MODULE_CLASS_NAME); + + alter table CCM_CORE.SETTINGS + add constraint UK5whinfxdaepqs09e5ia9y71uk unique (CONFIGURATION_CLASS, NAME); +create sequence hibernate_sequence start 1 increment 1; + + create table ContentType_values ( + ContentType_OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (ContentType_OBJECT_ID, LOCALE) + ); + + create table GenericArticle_values ( + GenericArticle_OBJECT_ID int8 not null, + LOCALIZED_VALUE text, + LOCALE varchar(255) not null, + primary key (GenericArticle_OBJECT_ID, LOCALE) + ); + + create table GenericArticle_values_AUD ( + REV int4 not null, + GenericArticle_OBJECT_ID int8 not null, + LOCALIZED_VALUE text not null, + LOCALE varchar(255) not null, + REVTYPE int2, + REVEND int4, + primary key (REV, GenericArticle_OBJECT_ID, LOCALIZED_VALUE, LOCALE) + ); + + alter table CCM_CMS.ARTICLES + add constraint FK2pwvn9v2t2pikcw5hn2oq13q + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.ARTICLES_AUD + add constraint FKnevu4il5fu4vy2f5twh50kstr + foreign key (OBJECT_ID, REV) + references CCM_CMS.CONTENT_ITEMS_AUD; + + alter table CCM_CMS.ASSET_TITLES + add constraint FKj61sy509dv63u246wlau5f9pa + foreign key (ASSET_ID) + references CCM_CMS.ASSETS; + + alter table CCM_CMS.ASSET_TITLES_AUD + add constraint FK6yuimrre2oowjo0diw6b00nhe + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ASSET_TITLES_AUD + add constraint FKcaockxi21ve0irh06vegc77uu + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ASSETS_AUD + add constraint FK4m4op9s9h5qhndcsssbu55gr2 + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ASSETS_AUD + add constraint FK586j3p95nw2oa6yd06xdw0o5u + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENT_LIST_CAPTIONS + add constraint FKdtsxi1x0psj4rsfc15tea5ku5 + foreign key (LIST_ID) + references CCM_CMS.attachment_lists; + + alter table CCM_CMS.ATTACHMENT_LIST_CAPTIONS_AUD + add constraint FK727detagt51wmejywhteq4jfs + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENT_LIST_CAPTIONS_AUD + add constraint FK7589vpkxegxs8y3wqjx37tig3 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.attachment_lists + add constraint FKdjvwy4y3m6jd6c2ipkgsbwwc3 + foreign key (CONTENT_ITEM_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.attachment_lists_AUD + add constraint FK83ylk9d0wib4k3l9ob4bx2rgo + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.attachment_lists_AUD + add constraint FKrshwuqc6cnb4bnybqsmavsxh3 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.AttachmentList_ItemAttachment_AUD + add constraint FKduowjilu7dqfs2oja88tr5oim + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.AttachmentList_ItemAttachment_AUD + add constraint FKdtm7qp3n6cojbm9b916plsgtx + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENTS + add constraint FKmn0bm137vwr61iy5nb59cjm22 + foreign key (ASSET_ID) + references CCM_CMS.ASSETS; + + alter table CCM_CMS.ATTACHMENTS + add constraint FK1rmlsdulpurab4nq89o5go9oa + foreign key (LIST_ID) + references CCM_CMS.attachment_lists; + + alter table CCM_CMS.ATTACHMENTS_AUD + add constraint FKl19663g6todb5d1e9lok7fl9e + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ATTACHMENTS_AUD + add constraint FK4n28sostn1hc8bf43qsp1pyuf + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS + add constraint FK6mt4tjnenr79o52wcj99tpeu4 + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS_AUD + add constraint FK12yrysxv4fxa73ker40e883av + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_DESCRIPTIONS_AUD + add constraint FK4pxuq0pf2hrtireo902t21ocx + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_NAMES + add constraint FKijrfangf9s3lyncmod651xyg8 + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.CONTENT_ITEM_NAMES_AUD + add constraint FKq631ee5ollx5xkliowcrt8wkj + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_NAMES_AUD + add constraint FKbjaycalit9pa2u7ae5dwjgtky + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_TITLES + add constraint FKbvf67lou4ep94pgi6tur6o2gf + foreign key (OBJECT_ID) + references CCM_CMS.CONTENT_ITEMS; + + alter table CCM_CMS.CONTENT_ITEM_TITLES_AUD + add constraint FKfbno0rxshoi57y8aehwv3o42j + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEM_TITLES_AUD + add constraint FK4c3exifj1ghwg6htglynlo094 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.CONTENT_ITEMS + add constraint FKi1ce005bvnavqy8xlyim60yav + foreign key (contentType_OBJECT_ID) + references CCM_CMS.CONTENT_TYPES; + + alter table CCM_CMS.CONTENT_ITEMS + add constraint FK1fr2q5y1wpmrufruja5ivfpuf + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CMS.CONTENT_ITEMS_AUD + add constraint FKsfhj0qok0ksjplvgcaditqekl + foreign key (OBJECT_ID, REV) + references CCM_CORE.CCM_OBJECTS_AUD; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FKajweudfxaf7g2ydr2hcgqwcib + foreign key (ROOT_ASSETS_FOLDER_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FK6g7kw4b6diqa0nks45ilp0vhs + foreign key (ROOT_DOCUMENTS_FOLDER_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FKqb579yjmmqbergn0qv68a4rqb + foreign key (STAFF_ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FKjntqpyi3g4bx97ive5x8aipyi + foreign key (VIEWERS_ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CMS.CONTENT_SECTIONS + add constraint FK72jh0axiiru87i61mppvaiv96 + foreign key (OBJECT_ID) + references CCM_CORE.APPLICATIONS; + + alter table CCM_CMS.CONTENT_TYPES + add constraint FK96vwsbqfbdg33ujeeawajr0v4 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CMS.ContentItem_AttachmentList_AUD + add constraint FK4notdhn18abev1asay7cmyy84 + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.ContentItem_AttachmentList_AUD + add constraint FK16sw895gdgghrymbirrgrvxsa + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; + + alter table CCM_CMS.REUSABLE_ASSETS + add constraint FKngdq6f077q6ndqn9o3jc6k14a + foreign key (ASSET_ID) + references CCM_CMS.ASSETS; + + alter table CCM_CMS.REUSABLE_ASSETS + add constraint FKhvf4mfltp8abbr5u0qgjm2jk2 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CMS.REUSABLE_ASSETS_AUD + add constraint FKgyc5gd3cffox4wvjoir6i4gxt + foreign key (OBJECT_ID, REV) + references CCM_CORE.CCM_OBJECTS_AUD; + + alter table CCM_CORE.APPLICATIONS + add constraint FKatcp9ij6mbkx0nfeig1o6n3lm + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.ATTACHMENTS + add constraint FK8ju9hm9baceridp803nislkwb + foreign key (MESSAGE_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.CATEGORIES + add constraint FKrj3marx99nheur4fqanm0ylur + foreign key (PARENT_CATEGORY_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORIES + add constraint FKpm291swli2musd0204phta652 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.CATEGORIZATIONS + add constraint FKejp0ubk034nfq60v1po6srkke + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.CATEGORIZATIONS + add constraint FKoyeipswl876wa6mqwbx0uy83h + foreign key (CATEGORY_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORY_DESCRIPTIONS + add constraint FKhiwjlmh5vkbu3v3vng1la1qum + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint FKf25vi73cji01w8fgo6ow1dgg + foreign key (ROOT_CATEGORY_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CATEGORY_DOMAINS + add constraint FK58xpmnvciohkom1c16oua4xha + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.CATEGORY_TITLES + add constraint FKka9bt9f5br0kji5bcjxcmf6ch + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORIES; + + alter table CCM_CORE.CCM_OBJECTS_AUD + add constraint FKr00eauutiyvocno8ckx6h9nw6 + foreign key (REV) + 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 + add constraint FKc53g09agnye3w1v4euy3e0gsi + foreign key (FROM_PARTY_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.DIGESTS + add constraint FK845r9ep6xu6nbt1mvxulwybym + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.DOMAIN_DESCRIPTIONS + add constraint FKn4i2dxgn8cqysa62dds6eih6a + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORY_DOMAINS; + + alter table CCM_CORE.DOMAIN_OWNERSHIPS + add constraint FK47nsasr7jrdwlky5gx0u6e9py + foreign key (domain_OBJECT_ID) + references CCM_CORE.CATEGORY_DOMAINS; + + alter table CCM_CORE.DOMAIN_OWNERSHIPS + add constraint FK3u4hq6yqau4m419b1xva3xpwq + foreign key (owner_OBJECT_ID) + references CCM_CORE.APPLICATIONS; + + alter table CCM_CORE.DOMAIN_TITLES + add constraint FK5p526dsdwn94els6lp5w0hdn4 + foreign key (OBJECT_ID) + references CCM_CORE.CATEGORY_DOMAINS; + + alter table CCM_CORE.FORMBUILDER_COMPONENT_DESCRIPTIONS + add constraint FKfh0k9lj3pf4amfc9bbbss0tr1 + foreign key (COMPONENT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_COMPONENTS + add constraint FKpcpmvyiix023b4g5n4q8nkfca + foreign key (parentComponent_OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_COMPONENTS + add constraint FKt0e0uv00pp1rwhyaltrytghnm + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_CONFIRM_EMAIL_LISTENER + add constraint FK48khrbud3xhi2gvsvnlttd8tg + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_CONFIRM_REDIRECT_LISTENERS + add constraint FKbyjjt2ufendvje2obtge2l7et + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_DATA_DRIVEN_SELECTS + add constraint FK8oriyta1957u7dvbrqk717944 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGETS; + + alter table CCM_CORE.FORMBUILDER_DATA_QUERIES + add constraint FKhhaxpeddbtmrnjr5o0fopju3a + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_DATA_QUERY_DESCRIPTIONS + add constraint FKsmduu1opoiulkeo2gc8v7lsbn + foreign key (DATA_QUERY_ID) + references CCM_CORE.FORMBUILDER_DATA_QUERIES; + + alter table CCM_CORE.FORMBUILDER_DATA_QUERY_NAMES + add constraint FKju1x82inrw3kguyjuxoetn6gn + foreign key (DATA_QUERY_ID) + references CCM_CORE.FORMBUILDER_DATA_QUERIES; + + alter table CCM_CORE.FORMBUILDER_FORMSECTIONS + add constraint FKnfhsgxp4lvigq2pm33pn4afac + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_LISTENERS + add constraint FK33ilyirwoux28yowafgd5xx0o + foreign key (widget_OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGETS; + + alter table CCM_CORE.FORMBUILDER_LISTENERS + add constraint FKlqm76746nq5yrt8ganm474uu0 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_METAOBJECTS + add constraint FKf963v6u9mw8pwjmasrw51w8dx + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_OBJECT_TYPES + add constraint FKkv337e83rsecf0h3qy8bu7l9w + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_OPTION_LABELS + add constraint FKatlsylsvln6yse55eof6wwkj6 + foreign key (OPTION_ID) + references CCM_CORE.FORMBUILDER_OPTIONS; + + alter table CCM_CORE.FORMBUILDER_OPTIONS + add constraint FKhe5q71wby9g4i56sotc501h11 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_DESCRIPTIONS + add constraint FKcv3iu04gxjk9c0pn6tl8rqqv3 + foreign key (PROCESS_LISTENER_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENER_NAMES + add constraint FK8rnyb1m6ij3b9hhmhr7klgd4p + foreign key (PROCESS_LISTENER_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS + add constraint FK7uiaeax8qafm82e5k729ms5ku + foreign key (formSection_OBJECT_ID) + references CCM_CORE.FORMBUILDER_FORMSECTIONS; + + alter table CCM_CORE.FORMBUILDER_PROCESS_LISTENERS + add constraint FKbdnloo884qk6gn36jwiqv5rlp + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.FORMBUILDER_REMOTE_SERVER_POST_LISTENER + add constraint FKpajvu9m6fj1enm67a9gcb5ii9 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_SIMPLE_EMAIL_LISTENERS + add constraint FKsn82ktlq0c9ikijyv8k2bfv4f + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_TEMPLATE_EMAIL_LISTENERS + add constraint FK8kjyu72btjsuaaqh4bvd8npns + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS + add constraint FKb1q9bfshcrkwlj7r8w5jb4y8l + foreign key (widget_OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGETS; + + alter table CCM_CORE.FORMBUILDER_WIDGET_LABELS + add constraint FKm1huo6ghk9l5o8buku9v8y6q7 + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_WIDGETS + add constraint FKs7qq6vxblhmq0rlf87re65jdp + foreign key (label_OBJECT_ID) + references CCM_CORE.FORMBUILDER_WIDGET_LABELS; + + alter table CCM_CORE.FORMBUILDER_WIDGETS + add constraint FK1wosr4ujbfckdc50u5fgmrhrk + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_COMPONENTS; + + alter table CCM_CORE.FORMBUILDER_XML_EMAIL_LISTENERS + add constraint FKjie9co03m7ow4ihig5rk7l8oj + foreign key (OBJECT_ID) + references CCM_CORE.FORMBUILDER_PROCESS_LISTENERS; + + alter table CCM_CORE.GROUP_MEMBERSHIPS + add constraint FKq4qnny8ri3eo7eqh4olxco8nk + foreign key (GROUP_ID) + references CCM_CORE.GROUPS; + + alter table CCM_CORE.GROUP_MEMBERSHIPS + add constraint FKc8u86ivkhvoiw6ju8b2p365he + foreign key (MEMBER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.GROUPS + add constraint FK4f61mlqxw0ct6s7wwpi9m0735 + foreign key (PARTY_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.INITS + add constraint FK3nvvxk10nmq9nfuko8yklqdgc + foreign key (REQUIRED_BY_ID) + references CCM_CORE.INITS; + + alter table CCM_CORE.LUCENE_DOCUMENTS + add constraint FK942kl4yff8rdiwr0pjk2a9g8 + foreign key (CREATED_BY_PARTY_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.LUCENE_DOCUMENTS + add constraint FKc5rs6afx4p9fidabfqsxr5ble + foreign key (LAST_MODIFIED_BY) + references CCM_CORE.USERS; + + alter table CCM_CORE.LUCENE_INDEXES + add constraint FK6gu0yrlviqk07dtb3r02iw43f + foreign key (HOST_ID) + references CCM_CORE.HOSTS; + + alter table CCM_CORE.MESSAGES + add constraint FKph10aehmg9f20pn2w4buki97q + foreign key (IN_REPLY_TO_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.MESSAGES + add constraint FKjufsx3c3h538fj35h8hgfnb1p + foreign key (SENDER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.MESSAGES + add constraint FK6w20ao7scwecd9mfwpun2ddqx + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FKqk70c1x1dklhty9ju5t4wukd9 + foreign key (DIGEST_ID) + references CCM_CORE.DIGESTS; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FKtt4fjr2p75og79jxxgd8q8mr + foreign key (MESSAGE_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FK2vlnma0ox43j0clx8ead08n5s + foreign key (RECEIVER_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.NOTIFICATIONS + add constraint FKf423hhiaw1bexpxeh1pnas7qt + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.ONE_TIME_AUTH_TOKENS + add constraint FKtplfuphkiorfkttaewb4wmfjc + foreign key (USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.PERMISSIONS + add constraint FKj9di7pawxgtouxmu2k44bj5c4 + foreign key (CREATION_USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.PERMISSIONS + add constraint FKikx3x0kn9fito23g50v6xbr9f + foreign key (GRANTEE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.PERMISSIONS + add constraint FKkamckexjnffnt8lay9nqeawhm + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.PORTALS + add constraint FK5a2hdrbw03mmgr74vj5nxlpvk + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.PORTLETS + add constraint FK9gr5xjt3rx4uhtw7vl6adruol + foreign key (PORTAL_ID) + references CCM_CORE.PORTALS; + + alter table CCM_CORE.PORTLETS + add constraint FKjmx9uebt0gwxkw3xv34niy35f + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.QUEUE_ITEMS + add constraint FKtgkwfruv9kjdybf46l02da088 + foreign key (MESSAGE_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.QUEUE_ITEMS + add constraint FKs9aq1hyxstwmvx7fmfifp4x7r + foreign key (RECEIVER_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.RESOURCE_DESCRIPTIONS + add constraint FKk9arvj5u21rv23ce3cav4opqx + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.RESOURCE_TITLES + add constraint FKto4p6n2wklljyf7tmuxtmyfe0 + foreign key (OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.RESOURCE_TYPE_DESCRIPTIONS + add constraint FKckpihjtv23iahbg3imnpbsr2 + foreign key (RESOURCE_TYPE_ID) + references CCM_CORE.RESOURCE_TYPES; + + alter table CCM_CORE.RESOURCES + add constraint FKbo7ibfgodicn9flv2gfo11g5a + foreign key (parent_OBJECT_ID) + references CCM_CORE.RESOURCES; + + alter table CCM_CORE.RESOURCES + add constraint FK262fbwetpjx3k4uuvw24wsiv + foreign key (resourceType_RESOURCE_TYPE_ID) + references CCM_CORE.RESOURCE_TYPES; + + alter table CCM_CORE.RESOURCES + add constraint FKbjdf8pm4frth8r06ev2qjm88f + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.ROLE_MEMBERSHIPS + add constraint FK9m88ywi7rcin7b7jrgh53emrq + foreign key (MEMBER_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.ROLE_MEMBERSHIPS + add constraint FKcsyogv5m2rgsrmtgnhgkjhfw7 + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.SETTINGS_ENUM_VALUES + add constraint FK8mw4p92s0h3h8bmo8saowu32i + foreign key (ENUM_ID) + references CCM_CORE.SETTINGS; + + alter table CCM_CORE.SETTINGS_L10N_STR_VALUES + add constraint FK5knjq7cisej0qfx5dw1y93rou + foreign key (ENTRY_ID) + references CCM_CORE.SETTINGS; + + alter table CCM_CORE.SETTINGS_STRING_LIST + add constraint FKqeclqa5sf1g53vxs857tpwrus + foreign key (LIST_ID) + references CCM_CORE.SETTINGS; + + alter table CCM_CORE.TASK_ASSIGNMENTS + add constraint FKe29uwmvxdmol1fjob3auej4qv + foreign key (ROLE_ID) + references CCM_CORE.CCM_ROLES; + + alter table CCM_CORE.TASK_ASSIGNMENTS + add constraint FKc1vovbjg9mp5yegx2fdoutx7u + foreign key (TASK_ID) + references CCM_CORE.WORKFLOW_USER_TASKS; + + alter table CCM_CORE.THREADS + add constraint FKsx08mpwvwnw97uwdgjs76q39g + foreign key (ROOT_ID) + references CCM_CORE.MESSAGES; + + alter table CCM_CORE.THREADS + add constraint FKp97b1sy1kop07rtapeh5l9fb2 + foreign key (OBJECT_ID) + references CCM_CORE.CCM_OBJECTS; + + alter table CCM_CORE.USER_EMAIL_ADDRESSES + add constraint FKr900l79erul95seyyccf04ufc + foreign key (USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.USERS + add constraint FKosh928q71aonu6l1kurb417r + foreign key (PARTY_ID) + references CCM_CORE.PARTIES; + + alter table CCM_CORE.WORKFLOW_DESCRIPTIONS + add constraint FKgx7upkqky82dpxvbs95imfl9l + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table CCM_CORE.WORKFLOW_NAMES + add constraint FKkxedy9p48avfk45r0bn4uc09i + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table CCM_CORE.WORKFLOW_TASKS + add constraint FK1693cbc36e4d8gucg8q7sc57e + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table CCM_CORE.WORKFLOW_USER_TASKS + add constraint FKf09depwj5rgso2dair07vnu33 + foreign key (LOCKING_USER_ID) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_USER_TASKS + add constraint FK6evo9y34awhdfcyl8gv78qb7f + foreign key (NOTIFICATION_SENDER) + references CCM_CORE.USERS; + + alter table CCM_CORE.WORKFLOW_USER_TASKS + add constraint FK_bg60xxg9kerqsxyphbfxulg8y + foreign key (WORKFLOW_ID) + references CCM_CORE.WORKFLOWS; + + alter table ContentType_values + add constraint FK1xrt2eg0gib7xiy65evato7wi + foreign key (ContentType_OBJECT_ID) + references CCM_CMS.CONTENT_TYPES; + + alter table GenericArticle_values + add constraint FK104jagl41apaxmj52tn0c9hl + foreign key (GenericArticle_OBJECT_ID) + references CCM_CMS.ARTICLES; + + alter table GenericArticle_values_AUD + add constraint FKsxpv88pqmp913gegakv7crgbx + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + + alter table GenericArticle_values_AUD + add constraint FKpk72t5b9rbjeufkv18e3raku2 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; diff --git a/ccm-cms/src/test/java/org/librecms/assets/EqualsAndHashCodeTest.java b/ccm-cms/src/test/java/org/librecms/assets/EqualsAndHashCodeTest.java new file mode 100644 index 000000000..9844d561e --- /dev/null +++ b/ccm-cms/src/test/java/org/librecms/assets/EqualsAndHashCodeTest.java @@ -0,0 +1,50 @@ +/* + * 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.librecms.assets; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.libreccm.tests.categories.UnitTest; +import org.libreccm.testutils.EqualsVerifier; + +import java.util.Arrays; +import java.util.Collection; + + +/** + * + * @author Jens Pelzetter + */ +@RunWith(Parameterized.class) +@org.junit.experimental.categories.Category(UnitTest.class) +public class EqualsAndHashCodeTest extends EqualsVerifier { + + @Parameterized.Parameters(name = "{0}") + public static Collection> data() { + return Arrays.asList(new Class[]{ + Asset.class, + ReusableAsset.class + }); + } + + public EqualsAndHashCodeTest(final Class clazz) { + super(clazz); + } + +} diff --git a/ccm-cms/src/test/java/org/librecms/attachments/EqualsAndHashCodeTest.java b/ccm-cms/src/test/java/org/librecms/attachments/EqualsAndHashCodeTest.java new file mode 100644 index 000000000..742a7f0cf --- /dev/null +++ b/ccm-cms/src/test/java/org/librecms/attachments/EqualsAndHashCodeTest.java @@ -0,0 +1,50 @@ +/* + * 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.librecms.attachments; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.libreccm.tests.categories.UnitTest; +import org.libreccm.testutils.EqualsVerifier; + +import java.util.Arrays; +import java.util.Collection; + + +/** + * + * @author Jens Pelzetter + */ +@RunWith(Parameterized.class) +@org.junit.experimental.categories.Category(UnitTest.class) +public class EqualsAndHashCodeTest extends EqualsVerifier { + + @Parameterized.Parameters(name = "{0}") + public static Collection> data() { + return Arrays.asList(new Class[]{ + ItemAttachment.class, + AttachmentList.class + }); + } + + public EqualsAndHashCodeTest(final Class clazz) { + super(clazz); + } + +} diff --git a/ccm-cms/src/test/java/org/librecms/contentsection/EqualsAndHashCodeTest.java b/ccm-cms/src/test/java/org/librecms/contentsection/EqualsAndHashCodeTest.java new file mode 100644 index 000000000..4a8cb5aa0 --- /dev/null +++ b/ccm-cms/src/test/java/org/librecms/contentsection/EqualsAndHashCodeTest.java @@ -0,0 +1,166 @@ +/* + * 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.librecms.contentsection; + +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.libreccm.categorization.Category; +import org.libreccm.categorization.Domain; +import org.libreccm.core.CcmObject; +import org.libreccm.core.Resource; +import org.libreccm.security.Group; +import org.libreccm.security.Role; +import org.libreccm.security.User; +import org.libreccm.tests.categories.UnitTest; +import org.libreccm.testutils.EqualsVerifier; +import org.libreccm.web.CcmApplication; + +import java.util.Arrays; +import java.util.Collection; + +/** + * + * @author Jens Pelzetter + */ +@RunWith(Parameterized.class) +@org.junit.experimental.categories.Category(UnitTest.class) +public class EqualsAndHashCodeTest extends EqualsVerifier { + + @Parameterized.Parameters(name = "{0}") + public static Collection> data() { + return Arrays.asList(new Class[]{ + ContentItem.class, + ContentSection.class, + ContentType.class + }); + } + + public EqualsAndHashCodeTest(final Class clazz) { + super(clazz); + } + + @Override + protected void addPrefabValues( + final nl.jqno.equalsverifier.EqualsVerifier verifier) { + + final ContentItem item1 = new ContentItem(); + item1.setObjectId(-1100); + item1.setDisplayName("Object 1"); + + final ContentItem item2 = new ContentItem(); + item2.setObjectId(-1200); + item2.setDisplayName("Object 2"); + + final ContentSection section1 = new ContentSection(); + section1.setObjectId(-2100); + section1.setDisplayName("Section 1"); + + final ContentSection section2 = new ContentSection(); + section2.setObjectId(-2200); + section2.setDisplayName("Section 2"); + + final CcmObject object1 = new CcmObject(); + object1.setObjectId(-3100); + object1.setDisplayName("Object 1"); + + final CcmObject object2 = new CcmObject(); + object2.setObjectId(-3200); + object2.setDisplayName("Object 2"); + + final Category category1 = new Category(); + category1.setObjectId(-4100); + category1.setDisplayName("Category 1"); + + final Category category2 = new Category(); + category2.setObjectId(-4200); + category2.setDisplayName("Category 2"); + + final ContentType contentType1 = new ContentType(); + contentType1.setObjectId(-5100); + contentType1.setDisplayName("Content Type 1"); + + final ContentType contentType2 = new ContentType(); + contentType2.setObjectId(-5200); + contentType2.setDisplayName("Content Type 2"); + + final Role role1 = new Role(); + role1.setName("role1"); + + final Role role2 = new Role(); + role2.setName("role2"); + + final User user1 = new TestUser(); + user1.setName("user1"); + + final User user2 = new TestUser(); + user2.setName("user2"); + + final Group group1 = new Group(); + group1.setName("group1"); + + final Group group2 = new Group(); + group2.setName("group2"); + + final CcmApplication application1 = new CcmApplication(); + application1.setDisplayName("Application 1"); + + final CcmApplication application2 = new CcmApplication(); + application2.setDisplayName("Application 2"); + + final Domain domain1 = new Domain(); + domain1.setDisplayName("Domain 1"); + + final Domain domain2 = new Domain(); + domain2.setDisplayName("Domain 2"); + + final Resource resource1 = new Resource(); + resource1.setDisplayName("Resource 1"); + + final Resource resource2 = new Resource(); + resource2.setDisplayName("Resource 2"); + + verifier + .withPrefabValues(ContentItem.class, item1, item2) + .withPrefabValues(ContentSection.class, section1, section2) + .withPrefabValues(CcmObject.class, object1, object2) + .withPrefabValues(Category.class, category1, category2) + .withPrefabValues(ContentType.class, contentType1, contentType2) + .withPrefabValues(Role.class, role1, role2) + .withPrefabValues(User.class, user1, user2) + .withPrefabValues(Group.class, group1, group2) + .withPrefabValues(CcmApplication.class, application1, application2) + .withPrefabValues(Domain.class, domain1, domain2) + .withPrefabValues(Resource.class, resource1, resource2); + } + + /** + * {@link User} has a protected constructor, so have have do this to create + * users for the test... + */ + private class TestUser extends User { + + private static final long serialVersionUID = -9052762220990453621L; + + protected TestUser() { + super(); + } + + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/core/CcmObject.java b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java index cd8f9d507..6f1a46221 100644 --- a/ccm-core/src/main/java/org/libreccm/core/CcmObject.java +++ b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java @@ -18,7 +18,6 @@ */ package org.libreccm.core; -import org.hibernate.annotations.GenericGenerator; import org.libreccm.categorization.Categorization; import org.libreccm.categorization.Category; import org.libreccm.categorization.CategoryManager; @@ -39,6 +38,7 @@ import javax.validation.constraints.NotNull; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; + import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; @@ -48,6 +48,8 @@ import java.util.Objects; import static org.libreccm.core.CoreConstants.CORE_XML_NS; import static org.libreccm.core.CoreConstants.DB_SCHEMA; +import org.hibernate.envers.Audited; + /** * Root class of all entities in LibreCCM which need categorisation and * permission services. @@ -105,6 +107,7 @@ public class CcmObject implements Identifiable, Serializable { * A human readable name identifying this {@code CcmObject} */ @Column(name = "DISPLAY_NAME") + @Audited @XmlElement(name = "display-name", namespace = CORE_XML_NS) private String displayName; @@ -364,11 +367,13 @@ public class CcmObject implements Identifiable, Serializable { return String.format( "%s{ " + "objectId = %d, " + + "uuid = %s, " + "displayName = \"%s\"" + "%s" + " }", super.toString(), objectId, + uuid, displayName, data); } diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_3__add_ccm_objects_aud.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_3__add_ccm_objects_aud.sql new file mode 100644 index 000000000..d1892e918 --- /dev/null +++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_3__add_ccm_objects_aud.sql @@ -0,0 +1,18 @@ +create table CCM_CORE.CCM_OBJECTS_AUD ( + OBJECT_ID bigint not null, + REV integer not null, + REVTYPE tinyint, + REVEND integer, + DISPLAY_NAME varchar(255), + primary key (OBJECT_ID, REV) +); + +alter table CCM_CORE.CCM_OBJECTS_AUD + add constraint FKr00eauutiyvocno8ckx6h9nw6 + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + +alter table CCM_CORE.CCM_OBJECTS_AUD + add constraint FKo5s37ctcdny7tmewjwv7705h5 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS; diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_3__add_ccm_objects_aud.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_3__add_ccm_objects_aud.sql new file mode 100644 index 000000000..82bbb1e38 --- /dev/null +++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_3__add_ccm_objects_aud.sql @@ -0,0 +1,18 @@ +create table CCM_CORE.CCM_OBJECTS_AUD ( + OBJECT_ID int8 not null, + REV int4 not null, + REVTYPE int2, + REVEND int4, + DISPLAY_NAME varchar(255), + primary key (OBJECT_ID, REV) +); + +alter table CCM_CORE.CCM_OBJECTS_AUD + add constraint FKr00eauutiyvocno8ckx6h9nw6 + foreign key (REV) + references CCM_CORE.CCM_REVISIONS; + +alter table CCM_CORE.CCM_OBJECTS_AUD + add constraint FKo5s37ctcdny7tmewjwv7705h5 + foreign key (REVEND) + references CCM_CORE.CCM_REVISIONS;