diff --git a/ccm-cms-archetype-contenttype/pom.xml b/ccm-cms-archetype-contenttype/pom.xml index aaecdc1a8..24b15039f 100644 --- a/ccm-cms-archetype-contenttype/pom.xml +++ b/ccm-cms-archetype-contenttype/pom.xml @@ -4,17 +4,16 @@ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - 4.0.0 - - org.libreccm - libreccm-parent - 7.0.0-SNAPSHOT - + 4.0.0 + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + - org.libreccm.cms - ccm-cms-archetype-contenttype - 7.0.0-SNAPSHOT - LibreCCM CMS Archetype for Contenttypes + org.librecms + ccm-cms-archetype-contenttype + LibreCCM CMS Archetype for Contenttypes - http://cms.libreccm.org + http://cms.libreccm.org diff --git a/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/pom.xml b/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/pom.xml index 3d261893b..8ab90a480 100644 --- a/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/pom.xml +++ b/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/pom.xml @@ -32,6 +32,13 @@ ${project.parent.version} provided + + + org.librecms + ccm-cms + ${project.parent.version} + provided + org.hibernate @@ -314,5 +321,4 @@ -< - + \ No newline at end of file diff --git a/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Constants.java b/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Constants.java index dc13292b7..4ba804a1c 100644 --- a/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Constants.java +++ b/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Constants.java @@ -1,6 +1,6 @@ package ${package}; -public ${typeName}Constants { +public class ${typeName}Constants { public static final String DB_SCHEMA = "${schemaName}"; diff --git a/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Module.java b/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Module.java index 67dace6cb..7e839c91f 100644 --- a/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Module.java +++ b/ccm-cms-archetype-contenttype/src/main/resources/archetype-resources/src/main/java/__typeName__Module.java @@ -13,7 +13,7 @@ import org.libreccm.modules.UnInstallEvent; @Module(packageName="${package}", requiredModules = {@RequiredModule(module = org.libreccm.core.CcmCore)}) -public class ${moduleClass} implements CcmModule { +public class ${typeName}Module implements CcmModule { @Override public void install(final InstallEvent event) { diff --git a/ccm-cms-types-article/pom.xml b/ccm-cms-types-article/pom.xml new file mode 100644 index 000000000..e099626d1 --- /dev/null +++ b/ccm-cms-types-article/pom.xml @@ -0,0 +1,325 @@ + + + + 4.0.0 + + + libreccm-parent + org.libreccm + 7.0.0-SNAPSHOT + + + + UTF-8 + ${maven.build.timestamp} + yyyy-MM-dd'T'HH:mm:ss'Z'Z + + + + org.librecms + ccm-cms-types-article + + LibreCMS Contenttype Article + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + + + + org.hibernate + hibernate-validator + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-article + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.7 + 1.7 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + 0.7.5.201505241946 + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + 0.60 + + + + + + + + + + + de.jpdigital + hibernate4-ddl-maven-plugin + + + h2 + mysql5_innodb + oracle10g + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + true + true + + http://docs.oracle.com/javase/7/docs/api/ + http://docs.oracle.com/javaee/7/api/ + http://docs.jboss.org/hibernate/orm/4.3/javadocs/ + + private + true + UTF-8 + UTF-8 + UTF-8 + true + true + true + true + false + org.jboss.apiviz.APIviz + + org.jboss.apiviz + apiviz + 1.3.2.GA + + true + -sourceclasspath ${project.build.outputDirectory} + + + + + org.apache.maven.plugins + maven-jxr-plugin + 2.5 + + + org.apache.maven.plugins + maven-surefire-report-plugin + 2.18.1 + + + org.jacoco + jacoco-maven-plugin + 0.7.5.201505241946 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.1 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.4 + + true + utf-8 + 1.7 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/javabeans.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + org.codehaus.mojo + javancss-maven-plugin + 2.1 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.8 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms-types-article/src/main/java/org/librecms/article/Article.java b/ccm-cms-types-article/src/main/java/org/librecms/article/Article.java new file mode 100644 index 000000000..5205fa232 --- /dev/null +++ b/ccm-cms-types-article/src/main/java/org/librecms/article/Article.java @@ -0,0 +1,46 @@ +/* + * 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.article; + +import static org.librecms.article.ArticleConstants.*; + +import org.hibernate.envers.Audited; + +import org.libreccm.cms.contentsection.ContentItem; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.Table; +import org.libreccm.cms.contenttypes.GenericArticle; + +/** + * This type simply exposes the {@link GenericArticle} type from the + * @code{ccm-cms} module. + * + * @author Jens Pelzetter + */ +@Entity +@Audited +@Table(name = "${type_name}", schema = DB_SCHEMA) +public class Article extends ContentItem implements Serializable { + + private static final long serialVersionUID = 1L; + +} diff --git a/ccm-cms-types-article/src/main/java/org/librecms/article/ArticleConstants.java b/ccm-cms-types-article/src/main/java/org/librecms/article/ArticleConstants.java new file mode 100644 index 000000000..c97ab5a21 --- /dev/null +++ b/ccm-cms-types-article/src/main/java/org/librecms/article/ArticleConstants.java @@ -0,0 +1,29 @@ +/* + * 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.article; + +public final class ArticleConstants { + + public static final String DB_SCHEMA = "cms_article"; + + private ArticleConstants() { + //Nothing + } + +} diff --git a/ccm-cms-types-article/src/main/java/org/librecms/article/ArticleModule.java b/ccm-cms-types-article/src/main/java/org/librecms/article/ArticleModule.java new file mode 100644 index 000000000..8d4b03cce --- /dev/null +++ b/ccm-cms-types-article/src/main/java/org/librecms/article/ArticleModule.java @@ -0,0 +1,54 @@ +/* + * 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.article; + +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.article", + requiredModules = {@RequiredModule(module = org.libreccm.core.CcmCore.class)}) +public class ArticleModule implements CcmModule { + + @Override + public void install(final InstallEvent event) { + //ToDo Create initial data for the module if neccessary + } + + @Override + public void init(final InitEvent event) { + //ToDo Add initialisation logic necessary for your module + } + + @Override + public void shutdown(final ShutdownEvent event) { + //ToDo Add shutdown logic if necessary + } + + @Override + public void uninstall(final UnInstallEvent event) { + //ToDo Remove module data + } + + +} diff --git a/ccm-cms-types-article/src/main/resources/META-INF/services/org.libreccm.modules.CcmModule b/ccm-cms-types-article/src/main/resources/META-INF/services/org.libreccm.modules.CcmModule new file mode 100644 index 000000000..409cf304f --- /dev/null +++ b/ccm-cms-types-article/src/main/resources/META-INF/services/org.libreccm.modules.CcmModule @@ -0,0 +1 @@ +org.librecms.article.Article diff --git a/ccm-cms-types-article/src/main/resources/module-info/org.librecms.ccm-cms-types-article.properties b/ccm-cms-types-article/src/main/resources/module-info/org.librecms.ccm-cms-types-article.properties new file mode 100644 index 000000000..b9f3b36c8 --- /dev/null +++ b/ccm-cms-types-article/src/main/resources/module-info/org.librecms.ccm-cms-types-article.properties @@ -0,0 +1,4 @@ +groupId=${project.groupId} +artifactId=${project.artifactId} +version=${project.version} +build.date=${timestamp} diff --git a/ccm-cms-types-article/src/test/java/org/librecms/article/AppTest.java b/ccm-cms-types-article/src/test/java/org/librecms/article/AppTest.java new file mode 100644 index 000000000..b439ce635 --- /dev/null +++ b/ccm-cms-types-article/src/test/java/org/librecms/article/AppTest.java @@ -0,0 +1,38 @@ +package org.librecms.article; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/ccm-cms/pom.xml b/ccm-cms/pom.xml index ca5f2664a..de3fdaad8 100644 --- a/ccm-cms/pom.xml +++ b/ccm-cms/pom.xml @@ -15,11 +15,10 @@ yyyy-MM-dd'T'HH:mm:ss'Z'Z - org.libreccm + org.librecms ccm-cms - 7.0.0-SNAPSHOT - LibreCCM CMS + LibreCMS diff --git a/ccm-cms/src/main/java/org/libreccm/cms/contentsection/ContentItem.java b/ccm-cms/src/main/java/org/libreccm/cms/contentsection/ContentItem.java index 70afe1790..c43b40209 100644 --- a/ccm-cms/src/main/java/org/libreccm/cms/contentsection/ContentItem.java +++ b/ccm-cms/src/main/java/org/libreccm/cms/contentsection/ContentItem.java @@ -43,6 +43,7 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; /** + * Base type for all content item types. Specifies some common properties. * * @author Jens Pelzetter */ @@ -53,45 +54,70 @@ public class ContentItem extends CcmObject implements Serializable { private static final long serialVersionUID = 5897287630227129653L; + /** + * The name of the content item which is used to generate the URL of the + * content item. We are using a {@link LocalizedString} here to make it + * possible to generate localised URLs. Therefore only characters allowed in + * URLs should be used here. + */ @Embedded @AssociationOverride( - name = "VALUES", - joinTable = @JoinTable(name = "CONTENT_ITEM_NAMES", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "OBJECT_ID")} - )) + name = "VALUES", + joinTable = @JoinTable(name = "CONTENT_ITEM_NAMES", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "OBJECT_ID")} + )) private LocalizedString name; + /** + * The content type associated with the content item. + */ @OneToOne private ContentType contentType; + /** + * The human readable title of the content item. + */ @Embedded @AssociationOverride( - name = "VALUES", - joinTable = @JoinTable(name = "CONTENT_ITEM_TITLES", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "OBJECT_ID")} - )) + name = "VALUES", + joinTable = @JoinTable(name = "CONTENT_ITEM_TITLES", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "OBJECT_ID")} + )) private LocalizedString title; + /** + * A short text which describes the content of the content item. + */ @Embedded @AssociationOverride( - name = "VALUES", - joinTable = @JoinTable(name = "CONTENT_ITEM_DESCRIPTIONS", - schema = DB_SCHEMA, - joinColumns = { - @JoinColumn(name = "OBJECT_ID")} - )) + name = "VALUES", + joinTable = @JoinTable(name = "CONTENT_ITEM_DESCRIPTIONS", + schema = DB_SCHEMA, + joinColumns = { + @JoinColumn(name = "OBJECT_ID")} + )) private LocalizedString description; + /** + * The version/publishing state of the content item. + */ @Enumerated(EnumType.STRING) private ContentItemVersion version; + /** + * The launch date of the content item (date when the item is made public) + */ @Temporal(TemporalType.DATE) private Date launchDate; + /** + * String with the IDs (separated by slashes) of the ancestors of the + * content item (aka the path of the content item). + */ @Column(name = "ancestors", length = 1024) private String ancestors; @@ -211,10 +237,10 @@ public class ContentItem extends CcmObject implements Serializable { @Override public String toString(final String data) { return String.format(", name = {}, " - + "contentType = {}, " - + "title = {}, " - + "version = %s," - + "launchDate = %s%s", + + "contentType = {}, " + + "title = {}, " + + "version = %s," + + "launchDate = %s%s", Objects.toString(name), Objects.toString(contentType), Objects.toString(description), diff --git a/ccm-cms/src/main/java/org/libreccm/cms/contenttypes/GenericArticle.java b/ccm-cms/src/main/java/org/libreccm/cms/contenttypes/GenericArticle.java index 7025aa65f..9aaf5e237 100644 --- a/ccm-cms/src/main/java/org/libreccm/cms/contenttypes/GenericArticle.java +++ b/ccm-cms/src/main/java/org/libreccm/cms/contenttypes/GenericArticle.java @@ -34,7 +34,10 @@ import org.libreccm.cms.contentsection.ContentItem; import org.libreccm.l10n.LocalizedString; /** - * + * Base class for article like content items. These items usually contain a + * short introduction text (the description) and a longer text containing + * the more detailed content. + * * @author Jens Pelzetter */ @Entity diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/UserAdministrationTab.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/UserAdministrationTab.java index 636420f17..6e0bbfef5 100644 --- a/ccm-core/src/main/java/com/arsdigita/ui/admin/UserAdministrationTab.java +++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/UserAdministrationTab.java @@ -64,20 +64,22 @@ class UserAdministrationTab extends LayoutPanel { setLeft(sections); final UserBrowsePane browsePane = new UserBrowsePane(); -// final UserSummarySection summarySection = new UserSummarySection(this, browsePane); -// final UserSearchSection searchSection = new UserSearchSection(this, browsePane); -// final UserCreateSection createSection = new UserCreateSection(this); -// -// browsePane.setTabbedPane(parent); -// browsePane.setGroupAdministrationTab(groupAdminTab); -// -// final BoxPanel body = new BoxPanel(); -// addSection(USER_TAB_SUMMARY, summarySection, body); -// addSection(USER_TAB_BROWSE, browsePane, body); -// addSection(USER_TAB_SEARCH, searchSection, body); -// addSection(USER_TAB_CREATE_USER, createSection, body); -// -// setBody(body); + final UserSummarySection summarySection = new UserSummarySection( + this, browsePane); + final UserSearchSection searchSection = new UserSearchSection( + this, browsePane); + final UserCreateSection createSection = new UserCreateSection(this); + + browsePane.setTabbedPane(parent); + browsePane.setGroupAdministrationTab(groupAdminTab); + + final BoxPanel body = new BoxPanel(); + addSection(USER_TAB_SUMMARY, summarySection, body); + addSection(USER_TAB_BROWSE, browsePane, body); + addSection(USER_TAB_SEARCH, searchSection, body); + addSection(USER_TAB_CREATE_USER, createSection, body); + + setBody(body); } /** diff --git a/pom.xml b/pom.xml index 3000979fa..d5de7e756 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,7 @@ ccm-archetype-module ccm-cms ccm-cms-archetype-contenttype + ccm-cms-types-article