- Moved MultiPartArticle to ccm-cms module
- Added serveral entities to ccm-cms (Workflow, Lifecycle)
- Added entity WorkflowTemplate to ccm-core
- Fixed wrong inheritence strategy for Task entity


git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4179 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-06-29 17:40:51 +00:00
parent c62744ca7e
commit 4b143d3b3b
38 changed files with 1855 additions and 667 deletions

View File

@ -1,338 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>libreccm-parent</artifactId>
<groupId>org.libreccm</groupId>
<version>7.0.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'Z</maven.build.timestamp.format>
</properties>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms-types-mparticle</artifactId>
<version>7.0.0-SNAPSHOT</version>
<name>ccm-cms-types-mparticle</name>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.libreccm</groupId>
<artifactId>ccm-core</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-cdi</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.libreccm</groupId>
<artifactId>ccm-testutils</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.jqno.equalsverifier</groupId>
<artifactId>equalsverifier</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-persistence-dbunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-transaction-impl-base</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>ccm-cms-types-mparticle</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<optimize>true</optimize>
<debug>true</debug>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<groups>org.libreccm.tests.categories.UnitTest</groups>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>de.jpdigital</groupId>
<artifactId>hibernate5-ddl-maven-plugin</artifactId>
<configuration>
<dialects>
<param>h2</param>
<param>oracle10g</param>
<param>postgresql9</param>
</dialects>
<packages>
<param>org.libreccm</param>
</packages>
<useEnvers>true</useEnvers>
</configuration>
<executions>
<execution>
<goals>
<goal>gen-ddl</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<detectLinks>true</detectLinks>
<detectJavaApiLinks>true</detectJavaApiLinks>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
<link>http://docs.oracle.com/javaee/7/api/</link>
<link>http://docs.jboss.org/hibernate/orm/4.3/javadocs/</link>
</links>
<show>private</show>
<docfilessubdirs>true</docfilessubdirs>
<charset>UTF-8</charset>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
<breakiterator>true</breakiterator>
<version>true</version>
<author>true</author>
<keywords>true</keywords>
<failOnError>false</failOnError>
<doclet>org.jboss.apiviz.APIviz</doclet>
<docletArtifact>
<groupId>org.jboss.apiviz</groupId>
<artifactId>apiviz</artifactId>
<version>1.3.2.GA</version>
</docletArtifact>
<useStandardDocletOptions>true</useStandardDocletOptions>
<additionalparam>-sourceclasspath ${project.build.outputDirectory}</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.4</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<targetJdk>1.7</targetJdk>
<rulesets>
<ruleset>/rulesets/java/basic.xml</ruleset>
<ruleset>/rulesets/java/braces.xml</ruleset>
<ruleset>/rulesets/java/clone.xml</ruleset>
<ruleset>/rulesets/java/codesize.xml</ruleset>
<ruleset>/rulesets/java/design.xml</ruleset>
<ruleset>/rulesets/java/empty.xml</ruleset>
<ruleset>/rulesets/java/finalizers.xml</ruleset>
<ruleset>/rulesets/java/imports.xml</ruleset>
<ruleset>/rulesets/java/junit.xml</ruleset>
<ruleset>/rulesets/java/naming.xml</ruleset>
<ruleset>/rulesets/java/optimizations.xml</ruleset>
<ruleset>/rulesets/java/strictexception.xml</ruleset>
<ruleset>/rulesets/java/strings.xml</ruleset>
<ruleset>/rulesets/java/sunsecure.xml</ruleset>
<ruleset>/rulesets/java/typeresolution.xml</ruleset>
<ruleset>/rulesets/java/unnecessary.xml</ruleset>
<ruleset>/rulesets/java/unusedcode.xml</ruleset>
</rulesets>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<reportSets>
<reportSet>
<reports>
<report>dependencies</report>
<report>license</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -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;
}
}

View File

@ -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 <a href="mailto:konerman@tzi.de">Alexander Konermann</a>
* @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<ArticleSection> articles;
public LocalizedString getSummary() {
return summary;
}
public void setSummary(LocalizedString summary) {
this.summary = summary;
}
public List<ArticleSection> getArticles() {
return articles;
}
public void setArticles(List<ArticleSection> articles) {
this.articles = articles;
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -1 +0,0 @@
org.librecms.contenttypes.mparticle.MultiPartArticle

View File

@ -1,4 +0,0 @@
groupId=${project.groupId}
artifactId=${project.artifactId}
version=${project.version}
build.date=${timestamp}

View File

@ -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 );
}
}

View File

@ -15,6 +15,11 @@
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'Z</maven.build.timestamp.format>
</properties>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<name>LibreCMS</name>
<licenses>
<license>
<name>Lesser GPL 2.1</name>
@ -22,11 +27,6 @@
</license>
</licenses>
<groupId>org.librecms</groupId>
<artifactId>ccm-cms</artifactId>
<name>LibreCMS</name>
<dependencies>
<dependency>
<groupId>javax</groupId>

View File

@ -71,6 +71,9 @@ public class ReusableAsset<T extends Asset> extends CcmObject
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ReusableAsset)) {
return false;
}

View File

@ -52,7 +52,7 @@ import static org.librecms.CmsConstants.*;
* @param <T>
*/
@Entity
@Table(schema = DB_SCHEMA, name = "attachment_lists")
@Table(schema = DB_SCHEMA, name = "ATTACHMENT_LISTS")
@Audited
public class AttachmentList<T extends Asset> implements Identifiable,
List<ItemAttachment<T>>,
@ -121,8 +121,12 @@ public class AttachmentList<T extends Asset> implements Identifiable,
}
public List<ItemAttachment<T>> getAttachments() {
if (attachments == null) {
return null;
} else {
return Collections.unmodifiableList(attachments);
}
}
public void setAttachments(List<ItemAttachment<T>> attachments) {
this.attachments = new ArrayList<>(attachments);

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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<MultiPartArticleSection> sections;
public MultiPartArticle() {
this.sections = new ArrayList<>();
}
public LocalizedString getSummary() {
return summary;
}
public void setSummary(final LocalizedString summary) {
this.summary = summary;
}
public List<MultiPartArticleSection> getSections() {
if (sections == null) {
return null;
} else {
return Collections.unmodifiableList(sections);
}
}
protected void setSections(final List<MultiPartArticleSection> 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));
}
}

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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
);
}
}

View File

@ -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 = {

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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<Phase> 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<Phase> getPhases() {
return Collections.unmodifiableList(phases);
}
protected void setPhases(final List<Phase> 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 %<tT, "
+ "endDateTime = %tF %<tT, "
+ "listener = \"%s\", "
+ "started = %b, "
+ "finished = %b, "
+ "definition = %s%s"
+ " }",
super.toString(),
lifecycleId,
startDateTime,
endDateTime,
listener,
started,
finished,
Objects.toString(definition),
data);
}
}

View File

@ -0,0 +1,208 @@
/*
* 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 org.libreccm.l10n.LocalizedString;
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.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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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<PhaseDefinition> 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<PhaseDefinition> getPhaseDefinitions() {
if (phaseDefinitions == null) {
return null;
} else {
return Collections.unmodifiableList(phaseDefinitions);
}
}
protected void setPhaseDefinitions(List<PhaseDefinition> 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);
}
}

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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 %<tT,"
+ "endDateTime = %tF %<tT, "
+ "listener = \"%s\", "
+ "started = %b, "
+ "finished = %b, "
+ "lifecycle = %s, "
+ "definition = %s%s"
+ " }",
super.toString(),
phaseId,
startDateTime,
endDateTime,
listener,
started,
finished,
Objects.toString(lifecycle),
Objects.toString(definition),
data);
}
}

View File

@ -0,0 +1,204 @@
/*
* 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 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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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);
}
}

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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));
}
}

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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<TaskEventUrlGenerator> 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<TaskEventUrlGenerator> getGenerators() {
if (generators == null) {
return null;
} else {
return Collections.unmodifiableSet(generators);
}
}
protected void setGenerators(final Set<TaskEventUrlGenerator> 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);
}
}

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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);
}
}

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
@ -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();
}
}
}

View File

@ -45,7 +45,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
@Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() {
return Arrays.asList(new Class<?>[]{
ContentItem.class,
//ContentItem.class,
ContentSection.class,
ContentType.class
});

View File

@ -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",

View File

@ -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);
}
}

View File

@ -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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -44,7 +44,8 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
Task.class,
TaskAssignment.class,
UserTask.class,
Workflow.class
Workflow.class,
WorkflowTemplate.class
});
}

View File

@ -59,7 +59,6 @@
<module>ccm-cms-types-bookmark</module>
<module>ccm-cms-types-minutes</module>
<module>ccm-cms-types-decisiontree</module>
<module>ccm-cms-types-mparticle</module>
<module>ccm-cms-types-glossaryitem</module>
<module>ccm-cms-types-faqitem</module>
<module>ccm-cms-types-externallink</module>