diff --git a/ccm-cms-types-mparticle/pom.xml b/ccm-cms-types-mparticle/pom.xml
deleted file mode 100644
index 943cd1c06..000000000
--- a/ccm-cms-types-mparticle/pom.xml
+++ /dev/null
@@ -1,338 +0,0 @@
-
-
-
- 4.0.0
-
-
- libreccm-parent
- org.libreccm
- 7.0.0-SNAPSHOT
-
-
-
- UTF-8
- ${maven.build.timestamp}
- yyyy-MM-dd'T'HH:mm:ss'Z'Z
-
-
-
- org.librecms
- ccm-cms-types-mparticle
- 7.0.0-SNAPSHOT
-
- ccm-cms-types-mparticle
-
-
-
- javax
- javaee-api
- jar
- provided
-
-
-
- org.libreccm
- ccm-core
- ${project.parent.version}
- provided
-
-
-
- org.librecms
- ccm-cms
- ${project.parent.version}
- provided
-
-
-
- org.hibernate
- hibernate-entitymanager
- provided
-
-
-
- org.hibernate
- hibernate-envers
- provided
-
-
-
- org.hibernate
- hibernate-validator
- provided
-
-
- org.hibernate
- hibernate-validator-cdi
- provided
-
-
-
-
- junit
- junit
- test
-
-
-
- org.hamcrest
- hamcrest-core
- test
-
-
- org.hamcrest
- hamcrest-library
- test
-
-
-
- org.libreccm
- ccm-testutils
- ${project.parent.version}
- test
-
-
-
- nl.jqno.equalsverifier
- equalsverifier
- test
-
-
-
- org.jboss.arquillian.junit
- arquillian-junit-container
- test
-
-
- org.jboss.arquillian.extension
- arquillian-persistence-dbunit
- test
-
-
- org.jboss.arquillian.extension
- arquillian-transaction-impl-base
- test
-
-
- org.jboss.shrinkwrap.resolver
- shrinkwrap-resolver-impl-maven
- test
-
-
-
- com.h2database
- h2
- test
-
-
-
-
-
- ccm-cms-types-mparticle
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.3
-
- 1.7
- 1.7
- true
- true
- ${project.build.sourceEncoding}
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.18.1
-
- org.libreccm.tests.categories.UnitTest
-
-
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.7.5.201505241946
-
-
- default-prepare-agent
-
- prepare-agent
-
-
-
- default-report
- prepare-package
-
- report
-
-
-
- default-check
-
- check
-
-
-
-
- BUNDLE
-
-
- COMPLEXITY
- COVEREDRATIO
- 0.60
-
-
-
-
-
-
-
-
-
-
- de.jpdigital
- hibernate5-ddl-maven-plugin
-
-
- h2
- oracle10g
- postgresql9
-
-
- org.libreccm
-
- true
-
-
-
-
- gen-ddl
-
- process-classes
-
-
-
-
-
-
-
- src/main/resources
- true
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.10.3
-
- true
- true
-
- http://docs.oracle.com/javase/7/docs/api/
- http://docs.oracle.com/javaee/7/api/
- http://docs.jboss.org/hibernate/orm/4.3/javadocs/
-
- private
- true
- UTF-8
- UTF-8
- UTF-8
- true
- true
- true
- true
- false
- org.jboss.apiviz.APIviz
-
- org.jboss.apiviz
- apiviz
- 1.3.2.GA
-
- true
- -sourceclasspath ${project.build.outputDirectory}
-
-
-
-
- org.apache.maven.plugins
- maven-jxr-plugin
- 2.5
-
-
- org.apache.maven.plugins
- maven-surefire-report-plugin
- 2.18.1
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.7.5.201505241946
-
-
- org.codehaus.mojo
- findbugs-maven-plugin
- 3.0.1
-
-
-
- org.apache.maven.plugins
- maven-pmd-plugin
- 3.4
-
- true
- utf-8
- 1.7
-
- /rulesets/java/basic.xml
- /rulesets/java/braces.xml
- /rulesets/java/clone.xml
- /rulesets/java/codesize.xml
- /rulesets/java/design.xml
- /rulesets/java/empty.xml
- /rulesets/java/finalizers.xml
- /rulesets/java/imports.xml
- /rulesets/java/junit.xml
- /rulesets/java/naming.xml
- /rulesets/java/optimizations.xml
- /rulesets/java/strictexception.xml
- /rulesets/java/strings.xml
- /rulesets/java/sunsecure.xml
- /rulesets/java/typeresolution.xml
- /rulesets/java/unnecessary.xml
- /rulesets/java/unusedcode.xml
-
-
-
-
- org.codehaus.mojo
- javancss-maven-plugin
- 2.1
-
-
- org.apache.maven.plugins
- maven-project-info-reports-plugin
- 2.8
-
-
-
- dependencies
- license
-
-
-
-
- false
-
-
-
-
-
diff --git a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/ArticleSection.java b/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/ArticleSection.java
deleted file mode 100644
index ffee2eb7d..000000000
--- a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/ArticleSection.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (C) 2015 LibreCCM Foundation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-package org.librecms.contenttypes.mparticle;
-
-import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import org.hibernate.envers.Audited;
-import org.hibernate.validator.constraints.NotEmpty;
-import org.libreccm.l10n.LocalizedString;
-import static org.librecms.CmsConstants.DB_SCHEMA;
-
-/**
- * object type to hold sections for multi-part article
- *
- * @author Koalamann
- */
-@Entity
-@Audited
-@Table(name = "DECISIONTREE", schema = DB_SCHEMA) //?
-public class ArticleSection implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Id
- @GeneratedValue
- @Column(name = "ID")
- private Long id;
-
- @Column(name = "TITLE")
- private LocalizedString title;
-
- @NotEmpty
- @Column(name = "RANK")
- private int rank;
-
- @NotEmpty
- @Column(name = "PAGEBREAK")
- private boolean pageBreak;
-
- @Column(name = "TEXT")
- private LocalizedString text;
-
- @Column(name = "IMAGE")
- private LocalizedString image;
-
- @ManyToOne
- private MultiPartArticle mparticle;
-
-
- //Getter and setter:
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public LocalizedString getTitle() {
- return title;
- }
-
- public void setTitle(LocalizedString title) {
- this.title = title;
- }
-
- public int getRank() {
- return rank;
- }
-
- public void setRank(int rank) {
- this.rank = rank;
- }
-
- public boolean isPageBreak() {
- return pageBreak;
- }
-
- public void setPageBreak(boolean pageBreak) {
- this.pageBreak = pageBreak;
- }
-
- public LocalizedString getText() {
- return text;
- }
-
- public void setText(LocalizedString text) {
- this.text = text;
- }
-
-}
diff --git a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticle.java b/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticle.java
deleted file mode 100644
index 744499ea0..000000000
--- a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticle.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2015 LibreCCM Foundation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-package org.librecms.contenttypes.mparticle;
-
-import static org.librecms.contenttypes.mparticle.MultiPartArticleConstants.*;
-
-import org.hibernate.envers.Audited;
-
-import java.io.Serializable;
-import java.util.List;
-import javax.persistence.Column;
-
-import javax.persistence.Entity;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import org.libreccm.l10n.LocalizedString;
-import org.librecms.contentsection.ContentItem;
-
-/*
- * This class represents the content type MultiPartArctivle
- *
- * @author Alexander Konermann
- * @version 17/11/2015
- */
-@Entity
-@Audited
-@Table(name = "${type_name}", schema = DB_SCHEMA)
-public class MultiPartArticle extends ContentItem implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @Column(name = "SUMMARY")
- private LocalizedString summary;
-
- @OneToMany(mappedBy = "article")
- private List articles;
-
- public LocalizedString getSummary() {
- return summary;
- }
-
- public void setSummary(LocalizedString summary) {
- this.summary = summary;
- }
-
- public List getArticles() {
- return articles;
- }
-
- public void setArticles(List articles) {
- this.articles = articles;
- }
-
-}
diff --git a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticleConstants.java b/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticleConstants.java
deleted file mode 100644
index cfa83c83e..000000000
--- a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticleConstants.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2015 LibreCCM Foundation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-package org.librecms.contenttypes.mparticle;
-
-public class MultiPartArticleConstants {
-
- public static final String DB_SCHEMA = "cms_types_mparticle";
-
- private MultiPartArticleConstants() {
- //Nothing
- }
-
-}
diff --git a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticleModule.java b/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticleModule.java
deleted file mode 100644
index 4204ee8e2..000000000
--- a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/MultiPartArticleModule.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2015 LibreCCM Foundation.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301 USA
- */
-package org.librecms.contenttypes.mparticle;
-
-import org.libreccm.modules.CcmModule;
-import org.libreccm.modules.InitEvent;
-import org.libreccm.modules.InstallEvent;
-import org.libreccm.modules.Module;
-import org.libreccm.modules.RequiredModule;
-import org.libreccm.modules.ShutdownEvent;
-import org.libreccm.modules.UnInstallEvent;
-
-@Module(packageName="org.librecms.contenttypes.mparticle",
- requiredModules = {@RequiredModule(module = org.libreccm.core.CcmCore.class)})
-public class MultiPartArticleModule implements CcmModule {
-
- @Override
- public void install(final InstallEvent event) {
- //ToDo Create initial data for the module if neccessary
- }
-
- @Override
- public void init(final InitEvent event) {
- //ToDo Add initialisation logic necessary for your module
- }
-
- @Override
- public void shutdown(final ShutdownEvent event) {
- //ToDo Add shutdown logic if necessary
- }
-
- @Override
- public void uninstall(final UnInstallEvent event) {
- //ToDo Remove module data
- }
-
-
-}
diff --git a/ccm-cms-types-mparticle/src/main/resources/META-INF/services/org.libreccm.modules.CcmModule b/ccm-cms-types-mparticle/src/main/resources/META-INF/services/org.libreccm.modules.CcmModule
deleted file mode 100644
index a5672c8cb..000000000
--- a/ccm-cms-types-mparticle/src/main/resources/META-INF/services/org.libreccm.modules.CcmModule
+++ /dev/null
@@ -1 +0,0 @@
-org.librecms.contenttypes.mparticle.MultiPartArticle
diff --git a/ccm-cms-types-mparticle/src/main/resources/module-info/org.librecms.ccm-cms-types-mparticle.properties b/ccm-cms-types-mparticle/src/main/resources/module-info/org.librecms.ccm-cms-types-mparticle.properties
deleted file mode 100644
index b9f3b36c8..000000000
--- a/ccm-cms-types-mparticle/src/main/resources/module-info/org.librecms.ccm-cms-types-mparticle.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-groupId=${project.groupId}
-artifactId=${project.artifactId}
-version=${project.version}
-build.date=${timestamp}
diff --git a/ccm-cms-types-mparticle/src/test/java/org/librecms/contenttypes/mparticle/AppTest.java b/ccm-cms-types-mparticle/src/test/java/org/librecms/contenttypes/mparticle/AppTest.java
deleted file mode 100644
index 25b511a36..000000000
--- a/ccm-cms-types-mparticle/src/test/java/org/librecms/contenttypes/mparticle/AppTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package $org.libreccm.cms;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Unit test for simple App.
- */
-public class AppTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public AppTest( String testName )
- {
- super( testName );
- }
-
- /**
- * @return the suite of tests being tested
- */
- public static Test suite()
- {
- return new TestSuite( AppTest.class );
- }
-
- /**
- * Rigourous Test :-)
- */
- public void testApp()
- {
- assertTrue( true );
- }
-}
diff --git a/ccm-cms/pom.xml b/ccm-cms/pom.xml
index b286bf727..7c82893cf 100644
--- a/ccm-cms/pom.xml
+++ b/ccm-cms/pom.xml
@@ -15,17 +15,17 @@
yyyy-MM-dd'T'HH:mm:ss'Z'Z
+ org.librecms
+ ccm-cms
+
+ LibreCMS
+
Lesser GPL 2.1
http://www.gnu.org/licenses/old-licenses/lgpl-2.1
-
- org.librecms
- ccm-cms
-
- LibreCMS
diff --git a/ccm-cms/src/main/java/org/librecms/assets/ReusableAsset.java b/ccm-cms/src/main/java/org/librecms/assets/ReusableAsset.java
index 9658bcaaf..e22bca41a 100644
--- a/ccm-cms/src/main/java/org/librecms/assets/ReusableAsset.java
+++ b/ccm-cms/src/main/java/org/librecms/assets/ReusableAsset.java
@@ -71,6 +71,9 @@ public class ReusableAsset extends CcmObject
if (obj == null) {
return false;
}
+ if (!super.equals(obj)) {
+ return false;
+ }
if (!(obj instanceof ReusableAsset)) {
return false;
}
diff --git a/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java
index b2a9a4750..63550e423 100644
--- a/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java
+++ b/ccm-cms/src/main/java/org/librecms/attachments/AttachmentList.java
@@ -52,7 +52,7 @@ import static org.librecms.CmsConstants.*;
* @param
*/
@Entity
-@Table(schema = DB_SCHEMA, name = "attachment_lists")
+@Table(schema = DB_SCHEMA, name = "ATTACHMENT_LISTS")
@Audited
public class AttachmentList implements Identifiable,
List>,
@@ -121,7 +121,11 @@ public class AttachmentList implements Identifiable,
}
public List> getAttachments() {
- return Collections.unmodifiableList(attachments);
+ if (attachments == null) {
+ return null;
+ } else {
+ return Collections.unmodifiableList(attachments);
+ }
}
public void setAttachments(List> attachments) {
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java b/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java
index 5a49f7f00..a64ec2ba5 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/Article.java
@@ -44,7 +44,7 @@ public class Article extends GenericArticle implements Serializable {
@Embedded
@AssociationOverride(
- name = "VALUES",
+ name = "values",
joinTable = @JoinTable(name = "ARTICLE_LEADS",
schema = DB_SCHEMA,
joinColumns = {
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java b/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
index 27a77a6e0..19e78bb62 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/Event.java
@@ -53,7 +53,7 @@ public class Event extends GenericArticle implements Serializable {
*/
@Embedded
@AssociationOverride(
- name = "VALUES",
+ name = "values",
joinTable = @JoinTable(name = "EVENT_LEADS",
schema = DB_SCHEMA,
joinColumns = {
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 03489acbc..606c6c153 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/GenericArticle.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/GenericArticle.java
@@ -50,7 +50,7 @@ public class GenericArticle extends ContentItem implements Serializable {
@Embedded
@AssociationOverride(
- name = "VALUES",
+ name = "values",
joinTable = @JoinTable(name = "ARTICLE_TEXTS",
schema = DB_SCHEMA,
joinColumns = {
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticle.java b/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticle.java
new file mode 100644
index 000000000..1f2206c03
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticle.java
@@ -0,0 +1,144 @@
+/*
+ * 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.contenttypes;
+
+import static org.libreccm.core.CoreConstants.*;
+
+import org.hibernate.envers.Audited;
+import org.libreccm.l10n.LocalizedString;
+import org.librecms.contentsection.ContentItem;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+import javax.persistence.AssociationOverride;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@Entity
+@Audited
+@Table(name = "MULTIPART_ARTICLES", schema = DB_SCHEMA)
+public class MultiPartArticle extends ContentItem implements Serializable {
+
+ private static final long serialVersionUID = -587374085831420868L;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "MPA_SUMMARIES",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString summary;
+
+ @OneToMany
+ @JoinColumn(name = "MULTIPART_ARTICLE_ID")
+ private List sections;
+
+ public MultiPartArticle() {
+ this.sections = new ArrayList<>();
+ }
+
+ public LocalizedString getSummary() {
+ return summary;
+ }
+
+ public void setSummary(final LocalizedString summary) {
+ this.summary = summary;
+ }
+
+ public List getSections() {
+ if (sections == null) {
+ return null;
+ } else {
+ return Collections.unmodifiableList(sections);
+ }
+ }
+
+ protected void setSections(final List sections) {
+ this.sections = new ArrayList<>(sections);
+ }
+
+ public void addSection(final MultiPartArticleSection section) {
+ sections.add(section);
+ }
+
+ public void removeSection(final MultiPartArticleSection section) {
+ sections.remove(section);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = super.hashCode();
+ hash = 59 * hash + Objects.hashCode(summary);
+ hash = 59 * hash + Objects.hashCode(sections);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (super.equals(obj)) {
+ return false;
+ }
+
+ if (!(obj instanceof MultiPartArticle)) {
+ return false;
+ }
+ final MultiPartArticle other = (MultiPartArticle) obj;
+ if (!other.canEqual(obj)) {
+ return false;
+ }
+
+ if (!Objects.equals(summary, other.getSummary())) {
+ return false;
+ }
+ return Objects.equals(sections, other.getSections());
+ }
+
+ @Override
+ public boolean canEqual(final Object obj) {
+ return obj instanceof MultiPartArticle;
+ }
+
+ @Override
+ public String toString(final String data) {
+ return super.toString(String.format(", summary = %s%s",
+ Objects.toString(summary),
+ data));
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticleSection.java b/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticleSection.java
new file mode 100644
index 000000000..e2e78d4dd
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/MultiPartArticleSection.java
@@ -0,0 +1,187 @@
+/*
+ * 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.contenttypes;
+
+import static org.libreccm.core.CoreConstants.*;
+
+import org.hibernate.envers.Audited;
+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;
+
+/**
+ * A section of a MultiPartArticle
+ *
+ * @author Jens Pelzetter
+ */
+@Entity
+@Audited
+@Table(name = "MULTIPART_ARTICLE_SECTIONS")
+public class MultiPartArticleSection implements Serializable {
+
+ private static final long serialVersionUID = 1109186628988745920L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "SECTION_ID")
+ private long sectionId;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "MPA_SECTION_TITLES",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString title;
+
+ @Column(name = "RANK")
+ private int rank;
+
+ @Column(name = "PAGE_BREAK")
+ private boolean pageBreak;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "MPA_SECTION_TEXTS",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString text;
+
+ public long getSectionId() {
+ return sectionId;
+ }
+
+ protected void setSectionId(final long sectionId) {
+ this.sectionId = sectionId;
+ }
+
+ public LocalizedString getTitle() {
+ return title;
+ }
+
+ public void setTitle(final LocalizedString title) {
+ this.title = title;
+ }
+
+ public int getRank() {
+ return rank;
+ }
+
+ public void setRank(final int rank) {
+ this.rank = rank;
+ }
+
+ public boolean isPageBreak() {
+ return pageBreak;
+ }
+
+ public void setPageBreak(final boolean pageBreak) {
+ this.pageBreak = pageBreak;
+ }
+
+ public LocalizedString getText() {
+ return text;
+ }
+
+ public void setText(final LocalizedString text) {
+ this.text = text;
+ }
+
+ //ToDo: Add image property
+
+ @Override
+ public int hashCode() {
+ int hash = 5;
+ hash = 19 * hash + Objects.hashCode(title);
+ hash = 19 * hash + rank;
+ hash = 19 * hash + (pageBreak ? 1 : 0);
+ hash = 19 * hash + Objects.hashCode(text);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof MultiPartArticleSection)) {
+ return false;
+ }
+ final MultiPartArticleSection other = (MultiPartArticleSection) obj;
+ if (rank != other.getRank()) {
+ return false;
+ }
+ if (!other.canEqual(this)) {
+ return false;
+ }
+ if (pageBreak != other.isPageBreak()) {
+ return false;
+ }
+ if (!Objects.equals(title, other.getTitle())) {
+ return false;
+ }
+ return Objects.equals(text, other.getText());
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof MultiPartArticleSection;
+ }
+
+ @Override
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "title = %s, "
+ + "rank = %d,"
+ + "pageBreak = %b, "
+ + "text = %s%d"
+ + " }",
+ super.toString(),
+ title,
+ rank,
+ pageBreak,
+ text,
+ data
+ );
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/contenttypes/News.java b/ccm-cms/src/main/java/org/librecms/contenttypes/News.java
index 1fa6707fe..4fe443e8e 100644
--- a/ccm-cms/src/main/java/org/librecms/contenttypes/News.java
+++ b/ccm-cms/src/main/java/org/librecms/contenttypes/News.java
@@ -52,7 +52,7 @@ public class News extends GenericArticle implements Serializable {
*/
@Embedded
@AssociationOverride(
- name = "VALUES",
+ name = "values",
joinTable = @JoinTable(name = "NEWS_LEADS",
schema = DB_SCHEMA,
joinColumns = {
diff --git a/ccm-cms/src/main/java/org/librecms/lifecycle/Lifecycle.java b/ccm-cms/src/main/java/org/librecms/lifecycle/Lifecycle.java
new file mode 100644
index 000000000..71c576a68
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/lifecycle/Lifecycle.java
@@ -0,0 +1,236 @@
+/*
+ * 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.lifecycle;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+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.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import static org.librecms.CmsConstants.*;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@Entity
+@Table(name = "LIFECYCLES", schema = DB_SCHEMA)
+public class Lifecycle implements Serializable {
+
+ private static final long serialVersionUID = 184357562249530038L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "LIFECYCLE_ID")
+ private long lifecycleId;
+
+ @Column(name = "START_DATE_TIME")
+ @Temporal(TemporalType.DATE)
+ private Date startDateTime;
+
+ @Column(name = "END_DATE_TIME")
+ @Temporal(TemporalType.DATE)
+ private Date endDateTime;
+
+ @Column(name = "LISTENER", length = 1024)
+ private String listener;
+
+ @Column(name = "STARTED")
+ private boolean started;
+
+ @Column(name = "FINISHED")
+ private boolean finished;
+
+ @OneToOne
+ @JoinColumn(name = "DEFINITION_ID")
+ private LifecycleDefinition definition;
+
+ @OneToMany(mappedBy = "LIFECYCLE")
+ @JoinColumn(name = "LIFECYCLE_ID")
+ private List phases;
+
+ public Lifecycle() {
+ phases = new ArrayList<>();
+ }
+
+ public long getLifecycleId() {
+ return lifecycleId;
+ }
+
+ public void setLifecycleId(final long lifecycleId) {
+ this.lifecycleId = lifecycleId;
+ }
+
+ public Date getStartDateTime() {
+ return new Date(startDateTime.getTime());
+ }
+
+ public void setStartDateTime(final Date startDateTime) {
+ this.startDateTime = new Date(startDateTime.getTime());
+ }
+
+ public Date getEndDateTime() {
+ return new Date(endDateTime.getTime());
+ }
+
+ public void setEndDateTime(final Date endDateTime) {
+ this.endDateTime = new Date(endDateTime.getTime());
+ }
+
+ public String getListener() {
+ return listener;
+ }
+
+ public void setListener(final String listener) {
+ this.listener = listener;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void setStarted(final boolean started) {
+ this.started = started;
+ }
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ public void setFinished(final boolean finished) {
+ this.finished = finished;
+ }
+
+ public LifecycleDefinition getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(final LifecycleDefinition definition) {
+ this.definition = definition;
+ }
+
+ public List getPhases() {
+ return Collections.unmodifiableList(phases);
+ }
+
+ protected void setPhases(final List phases) {
+ this.phases = new ArrayList<>(phases);
+ }
+
+ public void addPhase(final Phase phase) {
+ phases.add(phase);
+ }
+
+ public void removePhase(final Phase phase) {
+ phases.remove(phase);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 79 * hash + (int) (lifecycleId ^ (lifecycleId >>> 32));
+ hash = 79 * hash + Objects.hashCode(startDateTime);
+ hash = 79 * hash + Objects.hashCode(endDateTime);
+ hash = 79 * hash + Objects.hashCode(listener);
+ hash = 79 * hash + (started ? 1 : 0);
+ hash = 79 * hash + (finished ? 1 : 0);
+ hash = 79 * hash + Objects.hashCode(definition);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (obj instanceof Lifecycle) {
+ return false;
+ }
+ final Lifecycle other = (Lifecycle) obj;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+ if (lifecycleId != other.getLifecycleId()) {
+ return false;
+ }
+ if (started != other.isStarted()) {
+ return false;
+ }
+ if (finished != other.isFinished()) {
+ return false;
+ }
+ if (!Objects.equals(listener, other.getListener())) {
+ return false;
+ }
+ if (!Objects.equals(startDateTime, other.getStartDateTime())) {
+ return false;
+ }
+ if (!Objects.equals(endDateTime, other.getEndDateTime())) {
+ return false;
+ }
+ return Objects.equals(definition, other.getDefinition());
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof Lifecycle;
+ }
+
+ @Override
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "lifecycleId = %d, "
+ + "startDateTime = %tF %Jens Pelzetter
+ */
+@Entity
+@Table(name = "LIFECYLE_DEFINITIONS", schema = DB_SCHEMA)
+public class LifecycleDefinition implements Serializable {
+
+ private static final long serialVersionUID = 1291162870555527717L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "LIFECYCLE_DEFINITION_ID")
+ private long definitionId;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "LIFECYCLE_DEFINITION_LABELS",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString label;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "LIFECYCLE_DEFINITION_DESCRIPTIONS",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString description;
+
+ @Column(name = "DEFAULT_LISTENER", length = 1024)
+ private String defaultListener;
+
+ @OneToMany
+ @JoinColumn(name = "LIFECYCLE_DEFINITION_ID")
+ private List phaseDefinitions;
+
+ public LifecycleDefinition() {
+ phaseDefinitions = new ArrayList<>();
+ }
+
+ public long getDefinitionId() {
+ return definitionId;
+ }
+
+ public void setDefinitionId(final long definitionId) {
+ this.definitionId = definitionId;
+ }
+
+ public LocalizedString getLabel() {
+ return label;
+ }
+
+ public void setLabel(final LocalizedString label) {
+ this.label = label;
+ }
+
+ public LocalizedString getDescription() {
+ return description;
+ }
+
+ public void setDescription(final LocalizedString description) {
+ this.description = description;
+ }
+
+ public String getDefaultListener() {
+ return defaultListener;
+ }
+
+ public void setDefaultListener(final String defaultListener) {
+ this.defaultListener = defaultListener;
+ }
+
+ public List getPhaseDefinitions() {
+ if (phaseDefinitions == null) {
+ return null;
+ } else {
+ return Collections.unmodifiableList(phaseDefinitions);
+ }
+ }
+
+ protected void setPhaseDefinitions(List phaseDefinitions) {
+ this.phaseDefinitions = phaseDefinitions;
+ }
+
+ public void addPhaseDefinition(final PhaseDefinition definition) {
+ phaseDefinitions.add(definition);
+ }
+
+ public void removePhaseDefinition(final PhaseDefinition definition) {
+ phaseDefinitions.remove(definition);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 5;
+ hash = 71 * hash + (int) (definitionId ^ (definitionId >>> 32));
+ hash = 71 * hash + Objects.hashCode(label);
+ hash = 71 * hash + Objects.hashCode(description);
+ hash = 71 * hash + Objects.hashCode(defaultListener);
+ hash = 71 * hash + Objects.hashCode(phaseDefinitions);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof LifecycleDefinition)) {
+ return false;
+ }
+ final LifecycleDefinition other = (LifecycleDefinition) obj;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+ if (definitionId != other.getDefinitionId()) {
+ return false;
+ }
+ if (!Objects.equals(defaultListener, other.getDefaultListener())) {
+ return false;
+ }
+ if (!Objects.equals(label, other.getLabel())) {
+ return false;
+ }
+ if (!Objects.equals(description, other.getDescription())) {
+ return false;
+ }
+ return Objects.equals(phaseDefinitions, other.getPhaseDefinitions());
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof LifecycleDefinition;
+ }
+
+ @Override
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "definitionId = %d, "
+ + "label = %s, "
+ + "description = %s, "
+ + "defaultListener = \"%s\", "
+ + "phaseDefinitions = { %s }%s"
+ + " }",
+ super.toString(),
+ definitionId,
+ Objects.toString(label),
+ Objects.toString(description),
+ defaultListener,
+ Objects.toString(phaseDefinitions),
+ data);
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/lifecycle/Phase.java b/ccm-cms/src/main/java/org/librecms/lifecycle/Phase.java
new file mode 100644
index 000000000..3f80e4604
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/lifecycle/Phase.java
@@ -0,0 +1,226 @@
+/*
+ * 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.lifecycle;
+
+import java.io.Serializable;
+import java.util.Date;
+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.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@Entity
+@Table(name = "LIFECYLE_PHASES")
+public class Phase implements Serializable {
+
+ private static final long serialVersionUID = -1683874069942019941L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "PHASE_ID")
+ private long phaseId;
+
+ @Column(name = "START_DATE_TIME")
+ @Temporal(TemporalType.DATE)
+ private Date startDateTime;
+
+ @Column(name = "END_DATE_TIME")
+ @Temporal(TemporalType.DATE)
+ private Date endDateTime;
+
+ @Column(name = "LISTENER", length = 1024)
+ private String listener;
+
+ @Column(name = "STARTED")
+ private boolean started;
+
+ @Column(name = "FINISHED")
+ private boolean finished;
+
+ @ManyToOne
+ private Lifecycle lifecycle;
+
+ @OneToOne
+ @JoinColumn(name = "DEFINITION_ID")
+ private PhaseDefinition definition;
+
+ public long getPhaseId() {
+ return phaseId;
+ }
+
+ public void setPhaseId(final long phaseId) {
+ this.phaseId = phaseId;
+ }
+
+ public Date getStartDateTime() {
+ return new Date(startDateTime.getTime());
+ }
+
+ public void setStartDateTime(final Date startDateTime) {
+ this.startDateTime = new Date(startDateTime.getTime());
+ }
+
+ public Date getEndDateTime() {
+ return new Date(endDateTime.getTime());
+ }
+
+ public void setEndDateTime(final Date endDateTime) {
+ this.endDateTime = new Date(endDateTime.getTime());
+ }
+
+ public String getListener() {
+ return listener;
+ }
+
+ public void setListener(final String listener) {
+ this.listener = listener;
+ }
+
+ public boolean isStarted() {
+ return started;
+ }
+
+ public void setStarted(final boolean started) {
+ this.started = started;
+ }
+
+ public boolean isFinished() {
+ return finished;
+ }
+
+ public void setFinished(final boolean finished) {
+ this.finished = finished;
+ }
+
+ public Lifecycle getLifecycle() {
+ return lifecycle;
+ }
+
+ public void setLifecycle(final Lifecycle lifecycle) {
+ this.lifecycle = lifecycle;
+ }
+
+ public PhaseDefinition getDefinition() {
+ return definition;
+ }
+
+ protected void setDefinition(final PhaseDefinition definition) {
+ this.definition = definition;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 37 * hash + (int) (phaseId ^ (phaseId >>> 32));
+ hash = 37 * hash + Objects.hashCode(startDateTime);
+ hash = 37 * hash + Objects.hashCode(endDateTime);
+ hash = 37 * hash + Objects.hashCode(listener);
+ hash = 37 * hash + (started ? 1 : 0);
+ hash = 37 * hash + (finished ? 1 : 0);
+ hash = 37 * hash + Objects.hashCode(lifecycle);
+ hash = 37 * hash + Objects.hashCode(definition);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof Phase)) {
+ return false;
+ }
+ final Phase other = (Phase) obj;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+
+ if (phaseId != other.getPhaseId()) {
+ return false;
+ }
+ if (started != other.isStarted()) {
+ return false;
+ }
+ if (finished != other.isFinished()) {
+ return false;
+ }
+ if (!Objects.equals(listener, other.getListener())) {
+ return false;
+ }
+ if (!Objects.equals(startDateTime, other.getStartDateTime())) {
+ return false;
+ }
+ if (!Objects.equals(endDateTime, other.getEndDateTime())) {
+ return false;
+ }
+ if (!Objects.equals(lifecycle, other.getLifecycle())) {
+ return false;
+ }
+ return Objects.equals(definition, other.getDefinition());
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof Phase;
+ }
+
+ @Override
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "phaseId = %d, "
+ + "startDateTime = %tF %Jens Pelzetter
+ */
+@Entity
+@Table(name = "LIFECYCLE_PHASE_DEFINITIONS", schema = DB_SCHEMA)
+public class PhaseDefinition implements Serializable {
+
+ private static final long serialVersionUID = -7718926310758794075L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "PHASE_DEFINITION_ID")
+ private long definitionId;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "LIFECYCLE_PHASE_DEFINITION_LABELS",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString label;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "LIFECYCLE_PHASE_DEFINITION_DESCRIPTIONS",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString description;
+
+ @Column(name = "DEFAULT_DELAY")
+ private long defaultDelay;
+
+ @Column(name = "DEFAULT_DURATION")
+ private long defaultDuration;
+
+ @Column(name = "DEFAULT_LISTENER", length = 1024)
+ private String defaultListener;
+
+ public long getDefinitionId() {
+ return definitionId;
+ }
+
+ public void setDefinitionId(final long definitionId) {
+ this.definitionId = definitionId;
+ }
+
+ public LocalizedString getLabel() {
+ return label;
+ }
+
+ public void setLabel(final LocalizedString label) {
+ this.label = label;
+ }
+
+ public LocalizedString getDescription() {
+ return description;
+ }
+
+ public void setDescription(final LocalizedString description) {
+ this.description = description;
+ }
+
+ public long getDefaultDelay() {
+ return defaultDelay;
+ }
+
+ public void setDefaultDelay(final long defaultDelay) {
+ this.defaultDelay = defaultDelay;
+ }
+
+ public long getDefaultDuration() {
+ return defaultDuration;
+ }
+
+ public void setDefaultDuration(final long defaultDuration) {
+ this.defaultDuration = defaultDuration;
+ }
+
+ public String getDefaultListener() {
+ return defaultListener;
+ }
+
+ public void setDefaultListener(final String defaultListener) {
+ this.defaultListener = defaultListener;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 79 * hash + (int) (definitionId ^ (definitionId >>> 32));
+ hash = 79 * hash + Objects.hashCode(label);
+ hash = 79 * hash + Objects.hashCode(description);
+ hash = 79 * hash + (int) (defaultDelay ^ (defaultDelay >>> 32));
+ hash = 79 * hash + (int) (defaultDuration ^ (defaultDuration >>> 32));
+ hash = 79 * hash + Objects.hashCode(defaultListener);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof PhaseDefinition)) {
+ return false;
+ }
+ final PhaseDefinition other = (PhaseDefinition) obj;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+ if (definitionId != other.getDefinitionId()) {
+ return false;
+ }
+ if (defaultDelay != other.getDefaultDelay()) {
+ return false;
+ }
+ if (defaultDuration != other.getDefaultDuration()) {
+ return false;
+ }
+ if (!Objects.equals(defaultListener, other.getDefaultListener())) {
+ return false;
+ }
+ if (!Objects.equals(label, other.getLabel())) {
+ return false;
+ }
+ return Objects.equals(description, other.getDescription());
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof PhaseDefinition;
+ }
+
+ @Override
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "definitionId = %d, "
+ + "label = %s, "
+ + "description = %s, "
+ + "defaultDelay = %s, "
+ + "defaultDuration = %s, "
+ + "defaultListener = \"%s\"%s"
+ + " }",
+ super.toString(),
+ definitionId,
+ Objects.toString(label),
+ Objects.toString(description),
+ defaultDelay,
+ defaultDuration,
+ defaultListener,
+ data);
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/workflow/CmsTask.java b/ccm-cms/src/main/java/org/librecms/workflow/CmsTask.java
new file mode 100644
index 000000000..893465a33
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/workflow/CmsTask.java
@@ -0,0 +1,96 @@
+/*
+ * 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.workflow;
+
+import org.libreccm.workflow.UserTask;
+
+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
+ */
+@Entity
+@Table(name = "WORKFLOW_TASKS", schema = DB_SCHEMA)
+public class CmsTask extends UserTask implements Serializable {
+
+ private static final long serialVersionUID = -3988352366529930659L;
+
+ @OneToOne
+ @JoinColumn(name = "TASK_TYPE_ID")
+ private CmsTaskType taskType;
+
+ public CmsTaskType getTaskType() {
+ return taskType;
+ }
+
+ public void setTaskType(final CmsTaskType taskType) {
+ this.taskType = taskType;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = super.hashCode();
+ hash = 79 * hash + Objects.hashCode(taskType);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+
+ if (obj instanceof CmsTask) {
+ return false;
+ }
+ final CmsTask other = (CmsTask) obj;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+
+ return Objects.equals(taskType, other.taskType);
+ }
+
+ @Override
+ public boolean canEqual(final Object obj) {
+ return obj instanceof CmsTask;
+ }
+
+ @Override
+ public String toString(final String data) {
+ return super.toString(String.format(", taskType = %s%s",
+ Objects.toString(taskType),
+ data));
+ }
+}
diff --git a/ccm-cms/src/main/java/org/librecms/workflow/CmsTaskType.java b/ccm-cms/src/main/java/org/librecms/workflow/CmsTaskType.java
new file mode 100644
index 000000000..a26298a40
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/workflow/CmsTaskType.java
@@ -0,0 +1,205 @@
+/*
+ * 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.workflow;
+
+import org.libreccm.l10n.LocalizedString;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+
+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
+ */
+@Entity
+@Table(name = "WORKFLOW_TASK_TYPES", schema = DB_SCHEMA)
+public class CmsTaskType implements Serializable {
+
+ private static final long serialVersionUID = -4326031746212785970L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "TASK_TYPE_ID")
+ private long taskTypeId;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "ARTICLE_LEADS",
+ schema = DB_SCHEMA,
+ joinColumns = {
+ @JoinColumn(name = "OBJECT_ID")}
+ ))
+ private LocalizedString name;
+
+ @Column(name = "DEFAULT_URL_GENERATOR_CLASS", length = 1024)
+ private String defaultUrlGeneratorClass;
+
+ @Column(name = "PRIVILEGE", length = 256)
+ private String privilege;
+
+ @OneToMany
+ @JoinColumn(name = "TASK_TYPE_ID")
+ private Set generators;
+
+ public CmsTaskType() {
+ generators = new HashSet<>();
+ }
+
+ public long getTaskTypeId() {
+ return taskTypeId;
+ }
+
+ protected void setTaskTypeId(final long taskTypeId) {
+ this.taskTypeId = taskTypeId;
+ }
+
+ public LocalizedString getName() {
+ return name;
+ }
+
+ public void setName(final LocalizedString name) {
+ this.name = name;
+ }
+
+ public String getDefaultUrlGeneratorClass() {
+ return defaultUrlGeneratorClass;
+ }
+
+ public void setDefaultUrlGeneratorClass(
+ final String defaultUrlGeneratorClass) {
+ this.defaultUrlGeneratorClass = defaultUrlGeneratorClass;
+ }
+
+ public String getPrivilege() {
+ return privilege;
+ }
+
+ public void setPrivilege(final String privilege) {
+ this.privilege = privilege;
+ }
+
+ public Set getGenerators() {
+ if (generators == null) {
+ return null;
+ } else {
+ return Collections.unmodifiableSet(generators);
+ }
+ }
+
+ protected void setGenerators(final Set generators) {
+ this.generators = generators;
+ }
+
+ public void addGenerator(final TaskEventUrlGenerator generator) {
+ generators.add(generator);
+ }
+
+ public void removeGenerator(final TaskEventUrlGenerator generator) {
+ generators.remove(generator);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 5;
+ hash = 79 * hash + (int) (taskTypeId ^ (taskTypeId >>> 32));
+ hash = 79 * hash + Objects.hashCode(name);
+ hash = 79 * hash + Objects.hashCode(defaultUrlGeneratorClass);
+ hash = 79 * hash + Objects.hashCode(privilege);
+ hash = 79 * hash + Objects.hashCode(generators);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (obj instanceof CmsTaskType) {
+ return false;
+ }
+ final CmsTaskType other = (CmsTaskType) obj;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+
+ if (taskTypeId != other.getTaskTypeId()) {
+ return false;
+ }
+ if (!Objects.equals(defaultUrlGeneratorClass,
+ other.getDefaultUrlGeneratorClass())) {
+ return false;
+ }
+ if (!Objects.equals(privilege, other.getPrivilege())) {
+ return false;
+ }
+ if (!Objects.equals(name, other.getName())) {
+ return false;
+ }
+
+ return Objects.equals(generators, other.getGenerators());
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof CmsTaskType;
+ }
+
+ @Override
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "taskTypeId = %d, "
+ + "name = %s, "
+ + "defaultUrlGeneratorClass = \"%s\", "
+ + "privilege = \"%s\","
+ + "generators = { %s }%s"
+ + " }",
+ super.toString(),
+ taskTypeId,
+ Objects.toString(name),
+ defaultUrlGeneratorClass,
+ privilege,
+ Objects.toString(generators),
+ data);
+ }
+
+}
diff --git a/ccm-cms/src/main/java/org/librecms/workflow/TaskEventUrlGenerator.java b/ccm-cms/src/main/java/org/librecms/workflow/TaskEventUrlGenerator.java
new file mode 100644
index 000000000..1b99dc506
--- /dev/null
+++ b/ccm-cms/src/main/java/org/librecms/workflow/TaskEventUrlGenerator.java
@@ -0,0 +1,156 @@
+/*
+ * 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.workflow;
+
+import org.librecms.contentsection.ContentType;
+
+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
+ */
+@Entity
+@Table(name = "TASK_EVENT_URL_GENERATOR", schema = DB_SCHEMA)
+public class TaskEventUrlGenerator implements Serializable {
+
+ private static final long serialVersionUID = -1861545657474968084L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "GENERATOR_ID")
+ private long generatorId;
+
+ @Column(name = "EVENT", length = 256)
+ private String event;
+
+ @OneToOne
+ @JoinColumn(name = "CONTENT_TYPE_ID")
+ private ContentType contentType;
+
+ @Column(name = "URL_GENERATOR_CLASS", length = 1024)
+ private String urlGeneratorClass;
+
+ public long getGeneratorId() {
+ return generatorId;
+ }
+
+ public void setGeneratorId(final long generatorId) {
+ this.generatorId = generatorId;
+ }
+
+ public String getEvent() {
+ return event;
+ }
+
+ public void setEvent(final String event) {
+ this.event = event;
+ }
+
+ public ContentType getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(final ContentType contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getUrlGeneratorClass() {
+ return urlGeneratorClass;
+ }
+
+ public void setUrlGeneratorClass(final String urlGeneratorClass) {
+ this.urlGeneratorClass = urlGeneratorClass;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 3;
+ hash = 47 * hash + (int) (generatorId ^ (generatorId >>> 32));
+ hash = 47 * hash + Objects.hashCode(event);
+ hash = 47 * hash + Objects.hashCode(contentType);
+ hash = 47 * hash + Objects.hashCode(urlGeneratorClass);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (obj instanceof TaskEventUrlGenerator) {
+ return false;
+ }
+ final TaskEventUrlGenerator other = (TaskEventUrlGenerator) obj;
+ if (!(other.canEqual(this))) {
+ return false;
+ }
+
+ if (generatorId != other.getGeneratorId()) {
+ return false;
+ }
+ if (!Objects.equals(event, other.getEvent())) {
+ return false;
+ }
+ if (!Objects.equals(urlGeneratorClass, other.getUrlGeneratorClass())) {
+ return false;
+ }
+ return Objects.equals(contentType, other.getContentType());
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof TaskEventUrlGenerator;
+ }
+
+ @Override
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "generatorId = %d, "
+ + "event = \"%s\", "
+ + "contentType = %s, "
+ + "urlGeneratorClass = \"%s\"%s"
+ + " }",
+ super.toString(),
+ generatorId,
+ event,
+ Objects.toString(contentType),
+ urlGeneratorClass,
+ data);
+ }
+
+}
diff --git a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/Resources.properties b/ccm-cms/src/main/resources/org/librecms/contenttypes/MultiPartArticle.properties.properties
similarity index 100%
rename from ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/Resources.properties
rename to ccm-cms/src/main/resources/org/librecms/contenttypes/MultiPartArticle.properties.properties
diff --git a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/Resources_de.properties b/ccm-cms/src/main/resources/org/librecms/contenttypes/MultiPartArticle_de.properties
similarity index 100%
rename from ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/Resources_de.properties
rename to ccm-cms/src/main/resources/org/librecms/contenttypes/MultiPartArticle_de.properties
diff --git a/ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/Resources_fr.properties b/ccm-cms/src/main/resources/org/librecms/contenttypes/MultiPartArticle_fr.properties
similarity index 100%
rename from ccm-cms-types-mparticle/src/main/java/org/librecms/contenttypes/mparticle/Resources_fr.properties
rename to ccm-cms/src/main/resources/org/librecms/contenttypes/MultiPartArticle_fr.properties
diff --git a/ccm-cms/src/test/java/org/librecms/assets/EqualsAndHashCodeTest.java b/ccm-cms/src/test/java/org/librecms/assets/EqualsAndHashCodeTest.java
index 9844d561e..46a27b423 100644
--- a/ccm-cms/src/test/java/org/librecms/assets/EqualsAndHashCodeTest.java
+++ b/ccm-cms/src/test/java/org/librecms/assets/EqualsAndHashCodeTest.java
@@ -20,13 +20,17 @@ package org.librecms.assets;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.libreccm.categorization.Category;
+import org.libreccm.core.CcmObject;
+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 java.util.Arrays;
import java.util.Collection;
-
/**
*
* @author Jens Pelzetter
@@ -47,4 +51,63 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
super(clazz);
}
+ @Override
+ protected void addPrefabValues(
+ final nl.jqno.equalsverifier.EqualsVerifier> verifier) {
+
+ final CcmObject object1 = new CcmObject();
+ object1.setDisplayName("Object 1");
+
+ final CcmObject object2 = new CcmObject();
+ object2.setDisplayName("Object 2");
+
+ final Role role1 = new Role();
+ role1.setName("Role 1");
+
+ final Role role2 = new Role();
+ role2.setName("Role 2");
+
+ 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 Category category1 = new Category();
+ category1.setObjectId(-4100);
+ category1.setDisplayName("Category 1");
+
+ final Category category2 = new Category();
+ category2.setObjectId(-4200);
+ category2.setDisplayName("Category 2");
+
+ verifier
+ .withPrefabValues(CcmObject.class, object1, object2)
+ .withPrefabValues(Role.class, role1, role2)
+ .withPrefabValues(User.class, user1, user2)
+ .withPrefabValues(Group.class, group1, group2)
+ .withPrefabValues(Category.class, category1, category2);
+
+ }
+
+ /**
+ * {@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-cms/src/test/java/org/librecms/contentsection/EqualsAndHashCodeTest.java b/ccm-cms/src/test/java/org/librecms/contentsection/EqualsAndHashCodeTest.java
index 4a8cb5aa0..6e625d8c2 100644
--- a/ccm-cms/src/test/java/org/librecms/contentsection/EqualsAndHashCodeTest.java
+++ b/ccm-cms/src/test/java/org/librecms/contentsection/EqualsAndHashCodeTest.java
@@ -45,7 +45,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
@Parameterized.Parameters(name = "{0}")
public static Collection> data() {
return Arrays.asList(new Class>[]{
- ContentItem.class,
+ //ContentItem.class,
ContentSection.class,
ContentType.class
});
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/Task.java b/ccm-core/src/main/java/org/libreccm/workflow/Task.java
index eaaebaabf..d7ab81ee5 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/Task.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/Task.java
@@ -51,7 +51,7 @@ import javax.persistence.Table;
*/
@Entity
@Table(name = "WORKFLOW_TASKS", schema = DB_SCHEMA)
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+@Inheritance(strategy = InheritanceType.JOINED)
//Can't reduce complexity yet, Task is a fine name
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java b/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java
index 4cf787483..76603de9d 100644
--- a/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java
+++ b/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java
@@ -35,6 +35,8 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
@@ -46,6 +48,7 @@ import javax.persistence.Table;
*/
@Entity
@Table(name = "WORKFLOWS", schema = DB_SCHEMA)
+@Inheritance(strategy = InheritanceType.JOINED)
public class Workflow implements Serializable {
private static final long serialVersionUID = 4322500264543325829L;
@@ -162,14 +165,19 @@ public class Workflow implements Serializable {
}
@Override
- public String toString() {
+ public final String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
return String.format("%s{ "
+ "workflowId = %d, "
- + "name = \"%s\""
+ + "name = \"%s\"%s"
+ " }",
super.toString(),
workflowId,
- name);
+ name,
+ data);
}
-
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/workflow/WorkflowTemplate.java b/ccm-core/src/main/java/org/libreccm/workflow/WorkflowTemplate.java
new file mode 100644
index 000000000..7ff233d2c
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/workflow/WorkflowTemplate.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2016 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.libreccm.workflow;
+
+import static org.libreccm.core.CoreConstants.*;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@Entity
+@Table(name = "WORKFLOW_TEMPLATES", schema = DB_SCHEMA)
+public class WorkflowTemplate extends Workflow implements Serializable {
+
+ private static final long serialVersionUID = 5770519379144947171L;
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+
+ if (!super.equals(obj)) {
+ return false;
+ }
+
+ if (!(obj instanceof WorkflowTemplate)) {
+ return false;
+ }
+ final WorkflowTemplate other = (WorkflowTemplate) obj;
+ return other.canEqual(obj);
+ }
+
+ @Override
+ public boolean canEqual(final Object obj) {
+ return obj instanceof WorkflowTemplate;
+ }
+
+}
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_4__add_workflow_templates.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_4__add_workflow_templates.sql
new file mode 100644
index 000000000..11e4540b7
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_4__add_workflow_templates.sql
@@ -0,0 +1,9 @@
+create table CCM_CORE.WORKFLOW_TEMPLATES (
+ WORKFLOW_ID bigint not null,
+ primary key (WORKFLOW_ID)
+);
+
+alter table CCM_CORE.WORKFLOW_TEMPLATES
+ add constraint FK8692vdme4yxnkj1m0k1dw74pk
+ foreign key (WORKFLOW_ID)
+ references CCM_CORE.WORKFLOWS;
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_5__alter_user_tasks.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_5__alter_user_tasks.sql
new file mode 100644
index 000000000..84e5ee38a
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_5__alter_user_tasks.sql
@@ -0,0 +1,6 @@
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop column if exists ACTIVE;
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop column if exists TASK_STATE;
+
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop constraint FK_bg60xxg9kerqsxyphbfxulg8y;
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop column if exists WORKFLOW_ID;
+
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_4__add_workflow_templates.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_4__add_workflow_templates.sql
new file mode 100644
index 000000000..669eef285
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_4__add_workflow_templates.sql
@@ -0,0 +1,9 @@
+create table CCM_CORE.WORKFLOW_TEMPLATES (
+ WORKFLOW_ID int8 not null,
+ primary key (WORKFLOW_ID)
+);
+
+alter table CCM_CORE.WORKFLOW_TEMPLATES
+ add constraint FK8692vdme4yxnkj1m0k1dw74pk
+ foreign key (WORKFLOW_ID)
+ references CCM_CORE.WORKFLOWS;
\ No newline at end of file
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_5__alter_user_tasks.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_5__alter_user_tasks.sql
new file mode 100644
index 000000000..84e5ee38a
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_5__alter_user_tasks.sql
@@ -0,0 +1,6 @@
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop column if exists ACTIVE;
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop column if exists TASK_STATE;
+
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop constraint FK_bg60xxg9kerqsxyphbfxulg8y;
+alter table CCM_CORE.WORKFLOW_USER_TASKS drop column if exists WORKFLOW_ID;
+
diff --git a/ccm-core/src/test/java/org/libreccm/workflow/EqualsAndHashCodeTest.java b/ccm-core/src/test/java/org/libreccm/workflow/EqualsAndHashCodeTest.java
index 4fcc0d13f..1b2e7504f 100644
--- a/ccm-core/src/test/java/org/libreccm/workflow/EqualsAndHashCodeTest.java
+++ b/ccm-core/src/test/java/org/libreccm/workflow/EqualsAndHashCodeTest.java
@@ -44,7 +44,8 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
Task.class,
TaskAssignment.class,
UserTask.class,
- Workflow.class
+ Workflow.class,
+ WorkflowTemplate.class
});
}
diff --git a/pom.xml b/pom.xml
index e75df9310..83e53f0fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -59,7 +59,6 @@
ccm-cms-types-bookmark
ccm-cms-types-minutes
ccm-cms-types-decisiontree
- ccm-cms-types-mparticle
ccm-cms-types-glossaryitem
ccm-cms-types-faqitem
ccm-cms-types-externallink