- Entities for ccm-cms needed for creating the entities of content types
    - Archetype for content types



git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3696 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2015-10-18 13:43:46 +00:00
parent 41ab6d05a1
commit 2c700637ff
18 changed files with 1203 additions and 1 deletions

View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.libreccm</groupId>
<artifactId>libreccm-parent</artifactId>
<version>7.0.0-SNAPSHOT</version>
</parent>
<groupId>org.libreccm.cms</groupId>
<artifactId>ccm-cms-archetype-contenttype</artifactId>
<version>7.0.0-SNAPSHOT</version>
<name>LibreCCM CMS Archetype for Contenttypes</name>
<url>http://cms.libreccm.org</url>
</project>

View File

@ -0,0 +1,34 @@
<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name = "LibreCCM CMS Contenttypes Archetype"
partial="false">
<requiredProperties>
<requiredProperty key="typeName">
<defaultValue>${artifactId}</defaultValue>
</requiredProperty>
<requiredProperty key="schemaName">
<defaultValue>${artifactId}</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
</fileSet>
<fileSet filtered="false" packaged="true">
<directory>src/main/resources/db/migrations</directory>
</fileSet>
<fileSet filtered="true" packaged="false">
<directory>src/main/resources/META-INF</directory>
</fileSet>
<fileSet filtered="false" packaged="false">
<directory>src/main/resources/module-info</directory>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
</fileSet>
</fileSets>
</archetype-descriptor>

View File

@ -0,0 +1,318 @@
<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>
<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>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<name>${artifactId}</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.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</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>${artifactId}</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>hibernate4-ddl-maven-plugin</artifactId>
<configuration>
<dialects>
<param>h2</param>
<param>mysql5_innodb</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/javabeans.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

@ -0,0 +1,22 @@
/*
* Add your license here, for example LGPL
*/
package ${package};
import static ${package}.${typeName}Constants.*;
import org.hibernate.envers.Audited;
import org.libreccm.cms.contentsection.ContentItem;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Audited
@Table(name = "${type_name}", schema = DB_SCHEMA)
public class ${typeName} extends ContentItem implements Serializable {
}

View File

@ -0,0 +1,11 @@
package ${package};
public ${typeName}Constants {
public static final String DB_SCHEMA = "${schemaName}";
private ${typeName}Constants() {
//Nothing
}
}

View File

@ -0,0 +1,39 @@
/**
* Add your license here, for example LGPL
*/
package ${package};
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="${package}",
requiredModules = {@RequiredModule(module = org.libreccm.core.CcmCore)})
public class ${moduleClass} 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

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

View File

@ -0,0 +1,38 @@
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

@ -19,7 +19,7 @@
<artifactId>ccm-cms</artifactId> <artifactId>ccm-cms</artifactId>
<version>7.0.0-SNAPSHOT</version> <version>7.0.0-SNAPSHOT</version>
<name>ccm-cms</name> <name>LibreCCM CMS</name>
<dependencies> <dependencies>
<dependency> <dependency>

View File

@ -0,0 +1,35 @@
/*
* 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.libreccm.cms;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class CmsConstants {
public static final String CMS_XML_NS = "http://cms.libreccm.org";
public static final String DB_SCHEMA = "CCM_CMS";
private CmsConstants() {
//Nothing
}
}

View File

@ -0,0 +1,225 @@
/*
* 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.libreccm.cms.contentsection;
import org.hibernate.envers.Audited;
import static org.libreccm.cms.CmsConstants.*;
import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
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
@Audited
@Table(name = "content_items", schema = DB_SCHEMA)
public class ContentItem extends CcmObject implements Serializable {
private static final long serialVersionUID = 5897287630227129653L;
@Embedded
@AssociationOverride(
name = "VALUES",
joinTable = @JoinTable(name = "CONTENT_ITEM_NAMES",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "OBJECT_ID")}
))
private LocalizedString name;
@OneToOne
private ContentType contentType;
@Embedded
@AssociationOverride(
name = "VALUES",
joinTable = @JoinTable(name = "CONTENT_ITEM_TITLES",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "OBJECT_ID")}
))
private LocalizedString title;
@Embedded
@AssociationOverride(
name = "VALUES",
joinTable = @JoinTable(name = "CONTENT_ITEM_DESCRIPTIONS",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "OBJECT_ID")}
))
private LocalizedString description;
@Enumerated(EnumType.STRING)
private ContentItemVersion version;
@Temporal(TemporalType.DATE)
private Date launchDate;
@Column(name = "ancestors", length = 1024)
private String ancestors;
public LocalizedString getName() {
return name;
}
public void setName(final LocalizedString name) {
this.name = name;
}
public ContentType getContentType() {
return contentType;
}
public void setContentType(final ContentType contentType) {
this.contentType = contentType;
}
public LocalizedString getTitle() {
return title;
}
public void setTitle(final LocalizedString title) {
this.title = title;
}
public LocalizedString getDescription() {
return description;
}
public void setDescription(final LocalizedString description) {
this.description = description;
}
public ContentItemVersion getVersion() {
return version;
}
public void setVersion(final ContentItemVersion version) {
this.version = version;
}
public Date getLaunchDate() {
return new Date(launchDate.getTime());
}
public void setLaunchDate(final Date launchDate) {
this.launchDate = new Date(launchDate.getTime());
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(final String ancestors) {
this.ancestors = ancestors;
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 59 * hash + Objects.hashCode(name);
hash = 59 * hash + Objects.hashCode(contentType);
hash = 59 * hash + Objects.hashCode(title);
hash = 59 * hash + Objects.hashCode(description);
hash = 59 * hash + Objects.hashCode(version);
hash = 59 * hash + Objects.hashCode(launchDate);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ContentItem)) {
return false;
}
final ContentItem other = (ContentItem) obj;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(name, other.getName())) {
return false;
}
if (!Objects.equals(contentType, other.getContentType())) {
return false;
}
if (!Objects.equals(title, other.getTitle())) {
return false;
}
if (!Objects.equals(description, other.getDescription())) {
return false;
}
if (version != other.getVersion()) {
return false;
}
if (!Objects.equals(launchDate, other.getLaunchDate())) {
return false;
}
return true;
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof ContentItem;
}
@Override
public String toString(final String data) {
return String.format(", name = {}, "
+ "contentType = {}, "
+ "title = {}, "
+ "version = %s,"
+ "launchDate = %s%s",
Objects.toString(name),
Objects.toString(contentType),
Objects.toString(description),
Objects.toString(version),
Objects.toString(launchDate));
}
}

View File

@ -0,0 +1,31 @@
/*
* 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.libreccm.cms.contentsection;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public enum ContentItemMode {
DEFAULT,
INTERNAL,
HIDDEN
}

View File

@ -0,0 +1,30 @@
/*
* 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.libreccm.cms.contentsection;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public enum ContentItemVersion {
DRAFT,
LIVE
}

View File

@ -0,0 +1,206 @@
/*
* 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.libreccm.cms.contentsection;
import static org.libreccm.cms.CmsConstants.*;
import org.libreccm.core.Group;
import org.libreccm.web.CcmApplication;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "content_sections", schema = DB_SCHEMA)
public class ContentSection extends CcmApplication implements Serializable {
private static final long serialVersionUID = -671718122153931727L;
@Column(name = "label", length = 512)
private String label;
@Column(name = "page_resolver_class", length = 1024)
private String pageResolverClass;
@Column(name = "item_resolver_class", length = 1024)
private String itemResolverClass;
@Column(name = "template_resolver_class", length = 1024)
private String templateResolverClass;
@Column(name = "xml_generator_class", length = 1024)
private String xmlGeneratorClass;
@OneToOne
private Group staffGroup;
@OneToOne
private Group viewersGroup;
@Column(name = "default_locale", length = 10)
private String defaultLocale;
public String getLabel() {
return label;
}
public void setLabel(final String label) {
this.label = label;
}
public String getPageResolverClass() {
return pageResolverClass;
}
public void setPageResolverClass(final String pageResolverClass) {
this.pageResolverClass = pageResolverClass;
}
public String getItemResolverClass() {
return itemResolverClass;
}
public void setItemResolverClass(final String itemResolverClass) {
this.itemResolverClass = itemResolverClass;
}
public String getTemplateResolverClass() {
return templateResolverClass;
}
public void setTemplateResolverClass(final String templateResolverClass) {
this.templateResolverClass = templateResolverClass;
}
public String getXmlGeneratorClass() {
return xmlGeneratorClass;
}
public void setXmlGeneratorClass(final String xmlGeneratorClass) {
this.xmlGeneratorClass = xmlGeneratorClass;
}
public Group getStaffGroup() {
return staffGroup;
}
public void setStaffGroup(final Group staffGroup) {
this.staffGroup = staffGroup;
}
public Group getViewersGroup() {
return viewersGroup;
}
public void setViewersGroup(final Group viewersGroup) {
this.viewersGroup = viewersGroup;
}
public String getDefaultLocale() {
return defaultLocale;
}
public void setDefaultLocale(final String defaultLocale) {
this.defaultLocale = defaultLocale;
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 47 * hash + Objects.hashCode(label);
hash = 47 * hash + Objects.hashCode(pageResolverClass);
hash = 47 * hash + Objects.hashCode(itemResolverClass);
hash = 47 * hash + Objects.hashCode(templateResolverClass);
hash = 47 * hash + Objects.hashCode(xmlGeneratorClass);
hash = 47 * hash + Objects.hashCode(defaultLocale);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ContentSection)) {
return false;
}
final ContentSection other = (ContentSection) obj;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(label, other.getLabel())) {
return false;
}
if (!Objects.equals(pageResolverClass, other.getPageResolverClass())) {
return false;
}
if (!Objects.equals(itemResolverClass, other.getItemResolverClass())) {
return false;
}
if (!Objects.equals(templateResolverClass,
other.getTemplateResolverClass())) {
return false;
}
if (!Objects.equals(xmlGeneratorClass, other.getXmlGeneratorClass())) {
return false;
}
return Objects.equals(defaultLocale, other.getDefaultLocale());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof ContentSection;
}
@Override
public String toString(final String data) {
return super.toString(String.format(", label = \"%s\", "
+ "pageResolverClass = \"%s\", "
+ "itemResolverClass = \"%s\", "
+ "templateResolverClass = \"%s\", "
+ "xmlGeneratorClass = \"%s\", "
+ "defaultLocale = \"%s\"%s",
label,
pageResolverClass,
itemResolverClass,
templateResolverClass,
xmlGeneratorClass,
defaultLocale,
data));
}
}

View File

@ -0,0 +1,187 @@
/*
* 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.libreccm.cms.contentsection;
import static org.libreccm.cms.CmsConstants.*;
import org.libreccm.core.CcmObject;
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.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Table;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Table(name = "content_types", schema = DB_SCHEMA)
public class ContentType extends CcmObject implements Serializable {
private static final long serialVersionUID = -2708659750560382851L;
@Column(name = "content_item_class", length = 1024)
private String contentItemClass;
@Embedded
@AssociationOverride(
name = "VALUES",
joinTable = @JoinTable(name = "CONTENT_TYPE_LABELS",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "OBJECT_ID")}
))
private LocalizedString label;
@Embedded
@AssociationOverride(
name = "VALUES",
joinTable = @JoinTable(name = "CONTENT_TYPE_DESCRIPTIONS",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "OBJECT_ID")}
))
private LocalizedString description;
@Column(name = "ancestors", length = 1024)
private String ancestors;
@Column(name = "descendants", length = 1024)
private String descendants;
@Enumerated(EnumType.STRING)
private ContentItemMode mode;
//ToDo references for authoring kit etc
public String getContentItemClass() {
return contentItemClass;
}
public void setContentItemClass(final String contentItemClass) {
this.contentItemClass = contentItemClass;
}
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 getAncestors() {
return ancestors;
}
public void setAncestors(final String ancestors) {
this.ancestors = ancestors;
}
public String getDescendants() {
return descendants;
}
public void setDescendants(final String descendants) {
this.descendants = descendants;
}
public ContentItemMode getMode() {
return mode;
}
public void setMode(final ContentItemMode mode) {
this.mode = mode;
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 79 * hash + Objects.hashCode(contentItemClass);
hash = 79 * hash + Objects.hashCode(label);
hash = 79 * hash + Objects.hashCode(description);
hash = 79 * hash + Objects.hashCode(mode);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ContentType)) {
return false;
}
final ContentType other = (ContentType) obj;
if (!other.canEqual(this)) {
return false;
}
if (!Objects.equals(contentItemClass, other.getContentItemClass())) {
return false;
}
if (!Objects.equals(label, other.getLabel())) {
return false;
}
if (!Objects.equals(description, other.getDescription())) {
return false;
}
return mode == other.getMode();
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof ContentType;
}
@Override
public String toString(final String data) {
return super.toString(String.format(", contentItemClass = \"%s\", "
+ "label = {%s}, "
+ "mode = %s%s",
contentItemClass,
Objects.toString(label),
mode,
data));
}
}

View File

@ -46,6 +46,7 @@
<!-- Archetypes --> <!-- Archetypes -->
<module>ccm-archetype-module</module> <module>ccm-archetype-module</module>
<module>ccm-cms</module> <module>ccm-cms</module>
<module>ccm-cms-archetype-contenttype</module>
</modules> </modules>
<!--<repositories> <!--<repositories>