From 02f48b15d75e34ab92813044c61dbeea9e4930b0 Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 9 May 2018 17:43:09 +0000 Subject: [PATCH] CCM NG: RESTful endpoints for the PageModel editor git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5424 8810af33-2d31-482b-a856-94f89814c4df Former-commit-id: bc3dff9ac9675ad6b90c088b6e2e4f6b1738e673 --- ccm-archetype-module/pom.xml.releaseBackup | 19 + .../pom.xml.releaseBackup | 215 +++ .../pom.xml.releaseBackup | 107 ++ .../pom.xml.releaseBackup | 205 +++ ccm-bundle-devel/pom.xml.releaseBackup | 98 ++ .../pom.xml.releaseBackup | 19 + ccm-cms-types-agenda/pom.xml.releaseBackup | 316 +++++ ccm-cms-types-bookmark/pom.xml.releaseBackup | 320 +++++ .../pom.xml.releaseBackup | 316 +++++ .../pom.xml.releaseBackup | 321 +++++ ccm-cms-types-faqitem/pom.xml.releaseBackup | 316 +++++ .../pom.xml.releaseBackup | 316 +++++ ccm-cms-types-minutes/pom.xml.releaseBackup | 316 +++++ ccm-cms/pom.xml.releaseBackup | 752 +++++++++++ ccm-core/pom.xml.releaseBackup | 1148 +++++++++++++++++ .../org/libreccm/pagemodel/rs/Components.java | 187 ++- .../org/libreccm/pagemodel/rs/Containers.java | 66 +- .../org/libreccm/pagemodel/rs/PageModels.java | 114 +- .../libreccm/pagemodel/rs/PageModelsApp.java | 25 +- .../pagemodel/rs/PageModelsController.java | 71 +- .../pagemodel/rs/StylesJsonMapper.java | 200 +++ .../pagemodel/rs/StylesMediaRule.java | 622 +++++++++ .../org/libreccm/pagemodel/rs/StylesRs.java | 666 ++++++++++ .../org/libreccm/pagemodel/rs/StylesRule.java | 355 +++++ .../libreccm/pagemodel/rs/package-info.java | 25 + .../pagemodel/styles/CssProperty.java | 9 + .../libreccm/pagemodel/styles/Dimension.java | 15 +- .../libreccm/pagemodel/styles/MediaRule.java | 2 +- .../pagemodel/styles/StylesManager.java | 149 +++ .../pagemodel/styles/StylesRepository.java | 168 +++ ccm-docrepo/pom.xml.releaseBackup | 637 +++++++++ ccm-editor/pom.xml.releaseBackup | 81 ++ ccm-shortcuts/pom.xml.releaseBackup | 709 ++++++++++ ccm-testutils/pom.xml.releaseBackup | 211 +++ ccm-theme-foundry/pom.xml.releaseBackup | 39 + ccm-xafilesystemadapter/pom.xml.releaseBackup | 236 ++++ pom.xml.releaseBackup | 777 +++++++++++ release.properties | 80 ++ 38 files changed, 10170 insertions(+), 58 deletions(-) create mode 100644 ccm-archetype-module/pom.xml.releaseBackup create mode 100644 ccm-bundle-devel-wildfly-swarm/pom.xml.releaseBackup create mode 100644 ccm-bundle-devel-wildfly-web/pom.xml.releaseBackup create mode 100644 ccm-bundle-devel-wildfly/pom.xml.releaseBackup create mode 100644 ccm-bundle-devel/pom.xml.releaseBackup create mode 100644 ccm-cms-archetype-contenttype/pom.xml.releaseBackup create mode 100644 ccm-cms-types-agenda/pom.xml.releaseBackup create mode 100644 ccm-cms-types-bookmark/pom.xml.releaseBackup create mode 100644 ccm-cms-types-decisiontree/pom.xml.releaseBackup create mode 100644 ccm-cms-types-externallink/pom.xml.releaseBackup create mode 100644 ccm-cms-types-faqitem/pom.xml.releaseBackup create mode 100644 ccm-cms-types-glossaryitem/pom.xml.releaseBackup create mode 100644 ccm-cms-types-minutes/pom.xml.releaseBackup create mode 100644 ccm-cms/pom.xml.releaseBackup create mode 100644 ccm-core/pom.xml.releaseBackup create mode 100644 ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesJsonMapper.java create mode 100644 ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesMediaRule.java create mode 100644 ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRs.java create mode 100644 ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRule.java create mode 100644 ccm-core/src/main/java/org/libreccm/pagemodel/rs/package-info.java create mode 100644 ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesManager.java create mode 100644 ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesRepository.java create mode 100644 ccm-docrepo/pom.xml.releaseBackup create mode 100644 ccm-editor/pom.xml.releaseBackup create mode 100644 ccm-shortcuts/pom.xml.releaseBackup create mode 100644 ccm-testutils/pom.xml.releaseBackup create mode 100644 ccm-theme-foundry/pom.xml.releaseBackup create mode 100644 ccm-xafilesystemadapter/pom.xml.releaseBackup create mode 100644 pom.xml.releaseBackup create mode 100644 release.properties diff --git a/ccm-archetype-module/pom.xml.releaseBackup b/ccm-archetype-module/pom.xml.releaseBackup new file mode 100644 index 000000000..da9d88324 --- /dev/null +++ b/ccm-archetype-module/pom.xml.releaseBackup @@ -0,0 +1,19 @@ + + + 4.0.0 + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-archetype-module + 7.0.0-SNAPSHOT + + LibreCCM Module archetype + http://www.libreccm.org/devel/modules + + diff --git a/ccm-bundle-devel-wildfly-swarm/pom.xml.releaseBackup b/ccm-bundle-devel-wildfly-swarm/pom.xml.releaseBackup new file mode 100644 index 000000000..ccf5872ae --- /dev/null +++ b/ccm-bundle-devel-wildfly-swarm/pom.xml.releaseBackup @@ -0,0 +1,215 @@ + + + + 4.0.0 + + + + + org.libreccm + ccm-bundle-devel + ../ccm-bundle-devel + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-bundle-devel-wildfly-swarm + war + + LibreCCM Devel Bundle for Wildfly Swarm + http://www.libreccm.org + + + libreccm-site + LibreCCM + http://www.libreccm.org/project-sites/ + + + + + LibreCCM Foundation + + + + + LGPLv2 or newer + http://www.gnu.org/licenses/lgpl-2.0.html + + + + + false + + + + + + org.wildfly.swarm + bom-all + 2017.11.0 + import + pom + + + + + + + + org.wildfly.swarm + cdi + + + + org.wildfly.swarm + container + + + + org.wildfly.swarm + datasources + + + + org.wildfly.swarm + ejb + + + + org.wildfly.swarm + hibernate-search + + + + org.wildfly.swarm + hibernate-validator + + + + org.wildfly.swarm + jaxrs + + + + org.wildfly.swarm + jaxrs-cdi + + + + org.wildfly.swarm + jpa + + + + org.wildfly.swarm + jsf + + + + org.wildfly.swarm + logging + + + + org.wildfly.swarm + mail + + + + org.wildfly.swarm + undertow + + + + com.h2database + h2 + + + org.postgresql + postgresql + 42.1.4.jre7 + + + + org.webjars + font-awesome + 4.7.0 + + + org.webjars + requirejs + 2.3.5 + + + org.webjars + requirejs-domready + 2.0.1-2 + + + + + + ccm-bundle-devel-wildfly + + + + org.wildfly.swarm + wildfly-swarm-plugin + + + + + package + + + + + + + org.apache.maven.plugins + maven-war-plugin + + + + org.libreccm + ccm-editor + jar + + + org.libreccm + ccm-theme-foundry + jar + + + org.libreccm + ccm-core + jar + + assets/ + VAADIN/ + + + + org.librecms + ccm-cms + jar + + templates/ + + + + + + + + + diff --git a/ccm-bundle-devel-wildfly-web/pom.xml.releaseBackup b/ccm-bundle-devel-wildfly-web/pom.xml.releaseBackup new file mode 100644 index 000000000..0a5ef02fb --- /dev/null +++ b/ccm-bundle-devel-wildfly-web/pom.xml.releaseBackup @@ -0,0 +1,107 @@ + + + + + UTF-8 + + + 4.0.0 + + + org.libreccm + ccm-bundle-devel + ../ccm-bundle-devel + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-bundle-devel-wildfly-web + + war + + LibreCCM Devel Bundle Web for Wildfly + http://www.libreccm.org/modules/web/wildfly + + + + org.webjars + font-awesome + 4.7.0 + + + org.webjars + requirejs + 2.3.5 + + + org.webjars + requirejs-domready + 2.0.1-2 + + + + + libreccm-web-wildfly + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-war-plugin + + + + org.libreccm + ccm-editor + jar + + + org.libreccm + ccm-theme-foundry + jar + + + org.libreccm + ccm-core + jar + + assets/ + VAADIN/ + + + + org.librecms + ccm-cms + jar + + templates/ + + + + + + + + org.wildfly.plugins + wildfly-maven-plugin + + true + + + + + diff --git a/ccm-bundle-devel-wildfly/pom.xml.releaseBackup b/ccm-bundle-devel-wildfly/pom.xml.releaseBackup new file mode 100644 index 000000000..2fff1b822 --- /dev/null +++ b/ccm-bundle-devel-wildfly/pom.xml.releaseBackup @@ -0,0 +1,205 @@ + + + + + UTF-8 + 10.0.0.Final + + + 4.0.0 + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-bundle-devel-wildfly + + ear + + LibreCCM Devel Bundle for Wildfly + http://www.libreccm.org/bundles/devel/wildfly + + + + org.libreccm + ccm-bundle-devel-wildfly-web + ${project.parent.version} + war + + + + + libreccm-devel-${project.version} + + + + org.apache.maven.plugins + maven-ear-plugin + + + 7 + + lib + no-version + + + org.libreccm + ccm-bundle-devel-wildfly-web + /libreccm + + + + + + + + + + + + + + h2 + + + + + org.wildfly.plugins + wildfly-maven-plugin + + + ${wildfly.version} + + false + + + + + admin + admin123 + + + + + + + data-source add --jndi-name=java:/comp/env/jdbc/libreccm/db --name=ccm-devel --connection-url=jdbc:h2:${project.build.directory}/libreccm-db;DB_CLOSE_ON_EXIT=FALSE --driver-name=h2 --driver-class=org.h2.Driver --user-name=sa --password=sa + + + + + -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787 + + + + + + + + + + + + pgsql + + + + org.postgresql + postgresql + 9.4.1208 + + + + + + + org.wildfly.plugins + wildfly-maven-plugin + + + ${wildfly.version} + + false + + + + + admin + admin1234 + + + + + + + + module add --name=org.postgres --resources=${project.build.directory}/${project.build.finalName}/lib/postgresql.jar --dependencies=javax.api,javax.transaction.api + /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver) + data-source add --jndi-name=java:/comp/env/jdbc/libreccm/db --name=libreccm-devel --connection-url=jdbc:postgresql://localhost:5432/libreccm-devel --driver-name=postgres --driver-class=org.postgresql.Driver --user-name=ccm --password=ccm47web + + + + + -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787 + + + + + + + + + + + + generic + + + + + org.wildfly.plugins + wildfly-maven-plugin + + + ${wildfly.version} + + false + 120 + + + -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787 + + + + + + + + + + diff --git a/ccm-bundle-devel/pom.xml.releaseBackup b/ccm-bundle-devel/pom.xml.releaseBackup new file mode 100644 index 000000000..3faedc2d4 --- /dev/null +++ b/ccm-bundle-devel/pom.xml.releaseBackup @@ -0,0 +1,98 @@ + + + + 4.0.0 + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-bundle-devel + pom + + LibreCCM Devel Bundle + http://www.libreccm.org/bundles/devel + + + + org.libreccm + ccm-core + ${project.parent.version} + + + + org.libreccm + ccm-editor + ${project.parent.version} + + + org.libreccm + ccm-theme-foundry + ${project.parent.version} + + + + net.sf.saxon + Saxon-HE + + + + + org.libreccm + ccm-shortcuts + ${project.parent.version} + + + org.librecms + ccm-cms + ${project.parent.version} + + + + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + + + com.vaadin + vaadin-cdi + + + + + + true + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + summary + license + scm + dependency-management + plugin-management + + + + + + + + diff --git a/ccm-cms-archetype-contenttype/pom.xml.releaseBackup b/ccm-cms-archetype-contenttype/pom.xml.releaseBackup new file mode 100644 index 000000000..24b15039f --- /dev/null +++ b/ccm-cms-archetype-contenttype/pom.xml.releaseBackup @@ -0,0 +1,19 @@ + + + + 4.0.0 + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.librecms + ccm-cms-archetype-contenttype + LibreCCM CMS Archetype for Contenttypes + + http://cms.libreccm.org + diff --git a/ccm-cms-types-agenda/pom.xml.releaseBackup b/ccm-cms-types-agenda/pom.xml.releaseBackup new file mode 100644 index 000000000..212562187 --- /dev/null +++ b/ccm-cms-types-agenda/pom.xml.releaseBackup @@ -0,0 +1,316 @@ + + + + 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-agenda + 7.0.0-SNAPSHOT + + ccm-cms-types-agenda + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-agenda + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms-types-bookmark/pom.xml.releaseBackup b/ccm-cms-types-bookmark/pom.xml.releaseBackup new file mode 100644 index 000000000..5b92ed95c --- /dev/null +++ b/ccm-cms-types-bookmark/pom.xml.releaseBackup @@ -0,0 +1,320 @@ + + + + 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-bookmark + 7.0.0-SNAPSHOT + + ccm-cms-types-bookmark + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-bookmark + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + org.codehaus.mojo + javancss-maven-plugin + 2.1 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.8 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms-types-decisiontree/pom.xml.releaseBackup b/ccm-cms-types-decisiontree/pom.xml.releaseBackup new file mode 100644 index 000000000..6de8ae2df --- /dev/null +++ b/ccm-cms-types-decisiontree/pom.xml.releaseBackup @@ -0,0 +1,316 @@ + + + + 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-decisiontree + 7.0.0-SNAPSHOT + + ccm-cms-types-decisiontree + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-decisiontree + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms-types-externallink/pom.xml.releaseBackup b/ccm-cms-types-externallink/pom.xml.releaseBackup new file mode 100644 index 000000000..7ab38d668 --- /dev/null +++ b/ccm-cms-types-externallink/pom.xml.releaseBackup @@ -0,0 +1,321 @@ + + + + 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-externallink + 7.0.0-SNAPSHOT + + ccm-cms-types-externallink + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-externallink + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /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.9 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms-types-faqitem/pom.xml.releaseBackup b/ccm-cms-types-faqitem/pom.xml.releaseBackup new file mode 100644 index 000000000..a081d0bd2 --- /dev/null +++ b/ccm-cms-types-faqitem/pom.xml.releaseBackup @@ -0,0 +1,316 @@ + + + + 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-faqitem + 7.0.0-SNAPSHOT + + ccm-cms-types-faqitem + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-faqitem + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /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.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms-types-glossaryitem/pom.xml.releaseBackup b/ccm-cms-types-glossaryitem/pom.xml.releaseBackup new file mode 100644 index 000000000..b159f096c --- /dev/null +++ b/ccm-cms-types-glossaryitem/pom.xml.releaseBackup @@ -0,0 +1,316 @@ + + + + 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-glossaryitem + 7.0.0-SNAPSHOT + + ccm-cms-types-glossaryitem + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-glossaryitem + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /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.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms-types-minutes/pom.xml.releaseBackup b/ccm-cms-types-minutes/pom.xml.releaseBackup new file mode 100644 index 000000000..ddff7b682 --- /dev/null +++ b/ccm-cms-types-minutes/pom.xml.releaseBackup @@ -0,0 +1,316 @@ + + + + 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-minutes + 7.0.0-SNAPSHOT + + ccm-cms-types-minutes + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + org.libreccm + ccm-testutils + ${project.parent.version} + test + + + + nl.jqno.equalsverifier + equalsverifier + test + + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + test + + + org.jboss.arquillian.extension + arquillian-transaction-impl-base + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + ccm-cms-types-minutes + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + src/main/resources + true + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + license + + + + + false + + + + + diff --git a/ccm-cms/pom.xml.releaseBackup b/ccm-cms/pom.xml.releaseBackup new file mode 100644 index 000000000..736fa5b64 --- /dev/null +++ b/ccm-cms/pom.xml.releaseBackup @@ -0,0 +1,752 @@ + + + + 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 + + LibreCMS + + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + + org.hibernate + hibernate-search-orm + provided + + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-xml-provider + + + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + + org.apache.shiro + shiro-core + + + org.apache.shiro + shiro-web + + + + + com.vaadin + vaadin-themes + + + com.vaadin + vaadin-client-compiled + + + com.vaadin + vaadin-cdi + + + + 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 + + + + src/main/resources + true + + + + + + src/test/resources + + + ${project.build.directory}/generated-resources + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + false + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + org.librecms + + ${basedir}/src/main/resources/META-INF/persistence-ddl.xml + true + + + + + gen-ddl + + process-classes + + + + + + com.vaadin + vaadin-maven-plugin + + + + clean + resources + update-theme + update-widgetset + compile-theme + compile + + + + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + false + + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.5 + + + com.github.spotbugs + spotbugs-maven-plugin + 3.1.0-RC8 + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + license + + + + + false + + + + + + + + + wildfly-managed-h2-mem + + + org.wildfly + wildfly-arquillian-container-managed + + test + + + org.jacoco + org.jacoco.core + + test + + + org.jboss.arquillian.extension + arquillian-jacoco + 1.0.0.Alpha9 + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + false + + org.jboss.logmanager.LogManager + + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-managed-pgsql + + + org.wildfly + wildfly-arquillian-container-managed + + test + + + org.jacoco + org.jacoco.core + + test + + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + always + 999 + true + + org.jboss.logmanager.LogManager + + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-remote-h2-mem + + + org.wildfly + wildfly-arquillian-container-remote + + test + + + org.jacoco + org.jacoco.core + + test + + + org.jboss.arquillian.extension + arquillian-jacoco + 1.0.0.Alpha9 + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + false + + org.jboss.logmanager.LogManager + + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-remote-pgsql + + + org.wildfly + wildfly-arquillian-container-remote + + test + + + org.jacoco + org.jacoco.core + + test + + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + always + 999 + true + + org.jboss.logmanager.LogManager + + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + + diff --git a/ccm-core/pom.xml.releaseBackup b/ccm-core/pom.xml.releaseBackup new file mode 100644 index 000000000..7c02cb2f1 --- /dev/null +++ b/ccm-core/pom.xml.releaseBackup @@ -0,0 +1,1148 @@ + + + + 4.0.0 + + + UTF-8 + ${maven.build.timestamp} + yyyy-MM-dd'T'HH:mm:ss'Z'Z + + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-core + + + LibreCCM Core + + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + + + + javax + javaee-api + jar + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-validator + provided + + + org.hibernate + hibernate-validator-cdi + provided + + + javax.el + javax.el-api + + + org.glassfish + javax.el + + + + org.hibernate + hibernate-search-orm + provided + + + + + org.flywaydb + flyway-core + + + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + + commons-beanutils + commons-beanutils + + + commons-codec + commons-codec + + + commons-fileupload + commons-fileupload + + + commons-lang + commons-lang + + + + oro + oro + + + org.bouncycastle + bcprov-jdk16 + + + + net.sf.jtidy + jtidy + + + + 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 + + + + org.apache.maven + maven-artifact + + + + org.apache.shiro + shiro-core + + + org.apache.shiro + shiro-web + + + + com.h2database + h2 + test + + + + org.reflections + reflections + 0.9.11 + + + + org.glassfish + javax.json + + + + net.sf.saxon + Saxon-HE + + + + org.primefaces + primefaces + + + + + com.vaadin + vaadin-themes + + + com.vaadin + vaadin-client-compiled + + + com.vaadin + vaadin-cdi + + + + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-annotations + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + org.codehaus.woodstox + woodstox-core-asl + + + com.fasterxml.jackson.dataformat + jackson-dataformat-csv + + + + + + ccm-core + + + + + + + src/main/resources + true + + + + + + src/test/resources + + + ${project.build.directory}/generated-resources + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + false + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm.categorization + org.libreccm.core + org.libreccm.formbuilder + org.libreccm.jpa + org.libreccm.l10n + org.libreccm.messaging + org.libreccm.notification + org.libreccm.portal + org.libreccm.runtime + org.libreccm.search.lucene + org.libreccm.web + org.libreccm.workflow + + ${basedir}/src/main/resources/META-INF/persistence-ddl.xml + true + + + + + gen-ddl + + process-classes + + + + + com.vaadin + vaadin-maven-plugin + + + + clean + resources + update-theme + update-widgetset + compile-theme + compile + + + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + false + + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.5 + + findbugs-exclude.xml + + + + com.github.spotbugs + spotbugs-maven-plugin + 3.1.0-RC8 + + findbugs-exclude.xml + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + src/main/java/com/arsdigita + + + **/AbstractConfig.java + **/AbstractParameter.java + **/AbstractParameterContext.java + **/AbstractSingleSelectionModel.java + **/Assert.java + **/bebop/** + **/CCMApplicationContextListener.java + **/CCMResourceManager.java + **/Classes.java + **/ClassParameter.java + **/ClassParameterReader.java + **/CompoundParameterReader.java + **/ConfigError.java + **/ConfigRegistry.java + **/Converters.java + **/CSVParameterReader.java + **/DateFormatter.java + **/DateFormatterConfig.java + **/DateTimeFormatter.java + **/dispatcher/** + **/DispatcherConfig.java + **/Document.java + **/Element.java + **/EmailParameter.java + **/EnumerationParameter.java + **/ErrorList.java + **/ExceptionUnwrapper.java + **/Exceptions.java + **/FileParameter.java + **/FullDateFormatter.java + **/globalization/** + **/GlobalizationConfig.java + **/IntegerParameter.java + **/JavaPropertyReader.java + **/JavaPropertyWriter.java + **/kernel/** + **/LockableImpl.java + **/mail/** + **/MapParameter.java + **/NotificationConfig.java + **/Parameter.java + **/ParameterError.java + **/ParameterException.java + **/RegistryConfig.java + **/ResourceParameter.java + **/SecurityHelper.java + **/SingletonParameter.java + **/SpecificClassParameter.java + **/StringParameter.java + **/templating/** + **/toolbox/** + **/TimeFormatter.java + **/ui/** + **/UIConfig.java + **/UncheckedWrapperException.java + **/util/** + **/web/** + **/WorkflowConfig.java + **/XML.java + **/XMLConfig.java + + + + + + org.codehaus.mojo + jdepend-maven-plugin + 2.0 + + + org.codehaus.mojo + taglist-maven-plugin + 2.4 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + + license + + + + + + false + + + + org.codehaus.mojo + versions-maven-plugin + 2.4 + + + + dependency-updates-report + plugin-updates-report + property-updates-report + + + + + + + + + + tomee-embedded + + + org.apache.openejb + arquillian-tomee-embedded + 1.7.3 + test + + + org.apache.openejb + tomee-embedded + 1.7.3 + test + + + org.apache.bval + bval-core + + + org.apache.bval + bval-jsr303 + + + org.apache.openjpa + openjpa-persistence + + + org.apache.openjpa + openjpa-kernel + + + org.apache.openjpa + openjpa-lib + + + org.apache.openjpa + openjpa-parent + + + + + org.jboss.logmanager + jboss-logmanager + 2.0.3.Final + test + + + + org.apache.openejb + tomee-webservices + 4.0.0 + + + org.apache.openejb + tomee-jaxrs + 1.7.3 + + + com.h2database + h2 + test + + + + + + + src/test/resources + + + src/test/resources-tomee-embedded + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + oracle12c + + + org.libreccm + + true + ${basedir}/src/main/resources/META-INF/persistence-ddl.xml + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + ${project.basedir}/target/wildfly-8.2.0.Final + ${project.basedir}/target/wildfly-8.2.0.Final/modules + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + ${project.build.directory}/generated-resources + + false + + + + + + + + tomee-remote-pgsql + + + org.apache.openejb + arquillian-tomee-remote + 1.7.3 + + + org.apache.openejb + apache-tomee + 1.7.3 + plus + zip + + + + + + + src/test/resources + + + src/test/resources-tomee-remote-pgsql + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + plus + 1.7.2 + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + false + + + + + + + + wildfly-managed-h2-mem + + + org.wildfly.arquillian + wildfly-arquillian-container-managed + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + 1.0.0.Alpha9 + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + false + + + + + + + + wildfly-managed-pgsql + + + org.wildfly.arquillian + wildfly-arquillian-container-managed + test + + + org.jacoco + org.jacoco.core + test + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + false + + + + + + + + wildfly-remote-h2-mem + + + org.wildfly + wildfly-arquillian-container-remote + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + 1.0.0.Alpha9 + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + false + + + + + + + + wildfly-remote-pgsql + + + org.wildfly + wildfly-arquillian-container-remote + test + + + org.jacoco + org.jacoco.core + test + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + false + + + + + + + + + diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Components.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Components.java index a553018c4..d48759b99 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Components.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Components.java @@ -34,7 +34,9 @@ import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.math.BigDecimal; import java.util.Arrays; +import java.util.Objects; import java.util.Optional; import javax.enterprise.context.RequestScoped; @@ -47,6 +49,7 @@ import javax.json.JsonObjectBuilder; import javax.transaction.Transactional; import javax.ws.rs.BadRequestException; import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.PUT; import javax.ws.rs.Path; @@ -55,6 +58,8 @@ import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; /** + * Provides RESTful endpoints for retrieving, creating, updating and deleting + * {@link ComponentModel}s of a {@link ContainerModel}. * * @author Jens Pelzetter */ @@ -71,6 +76,16 @@ public class Components { @Inject private PageModelsController controller; + /** + * Retrieve all {@link ComponentModel} of a {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * + * @return A JSON array containing the data of all {@link ComponentModel} of + * the {@link ContainerModel}. + */ @GET @Path(PageModelsApp.COMPONENTS_PATH) @Produces("application/json; charset=utf-8") @@ -82,6 +97,10 @@ public class Components { @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey) { + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + final CcmApplication app = controller.findCcmApplication( String.format("/%s/", appPath)); final PageModel pageModel = controller.findPageModel(app, @@ -100,6 +119,16 @@ public class Components { return arrayBuilder.build(); } + /** + * Retrieves a specific {@link ComponentModel}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param componentKey The key of the {@link ComponentModel}. + * + * @return A JSON object containing the data of the {@link ComponentModel}. + */ @GET @Path(PageModelsApp.COMPONENT_PATH) @Produces("application/json; charset=utf-8") @@ -112,6 +141,11 @@ public class Components { @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, @PathParam(PageModelsApp.COMPONENT_KEY) final String componentKey) { + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(componentKey); + final CcmApplication app = controller.findCcmApplication( String.format("/%s/", appPath)); final PageModel pageModel = controller.findPageModel(app, @@ -125,6 +159,27 @@ public class Components { return mapComponentModelToJson(component); } + /** + * Creates or updates a {@link ComponentModel}. + * + * If a {@link ComponentModel} with provided {@code componentKey} already + * exists in the container identified by {@code appPath}, + * {@code pageModelName} and {@code containerKey} the {@link ComponentModel} + * is updated with the data from {@code componentModelData}. + * + * Otherwise a new {@link ComponentModel} is created using the data from + * {@code componentModelData}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param componentKey The key of the {@link ComponentModel} to create + * or update. + * @param componentModelData The data for creating or updating the + * {@link ComponentModel}. + * + * @return The new or updated {@link ComponentModel}. + */ @PUT @Path(PageModelsApp.COMPONENT_PATH) @Consumes("application/json; charset=utf-8") @@ -137,7 +192,13 @@ public class Components { @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, @PathParam(PageModelsApp.COMPONENT_KEY) final String componentKey, - final JsonObject componentModelJson) { + final JsonObject componentModelData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(componentKey); + Objects.requireNonNull(componentModelData); final CcmApplication app = controller.findCcmApplication( String.format("/%s/", appPath)); @@ -160,21 +221,69 @@ public class Components { } else { - componentModel = createComponentModel(componentModelJson); + componentModel = createComponentModel(componentModelData); componentModel.setKey(componentKey); containerManager.addComponentModel(container, componentModel); } - setComponentPropertiesFromJson(componentModelJson, componentModel); + setComponentPropertiesFromJson(componentModelData, componentModel); componentRepo.save(componentModel); return mapComponentModelToJson(componentModel); } + /** + * Deletes a {@link ComponentModel}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param componentKey The key of the {@link ComponentModel} to delete. + * + */ + @DELETE + @Path(PageModelsApp.COMPONENT_PATH) + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteComponent( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(PageModelsApp.COMPONENT_KEY) final String componentKey) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(componentKey); + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + final ComponentModel component = controller + .findComponentModel(app, pageModel, container, componentKey); + + containerManager.removeComponentModel(container, component); + } + + /** + * Helper method for mapping a {@link ComponentModel} to JSON. + * + * @param componentModel The {@link ComponentModel} to map. + * + * @return The JSON representation of the + * {@link ComponentModel} {@code componentModel}. + */ private JsonObject mapComponentModelToJson( final ComponentModel componentModel) { + Objects.requireNonNull(componentModel); + final JsonObjectBuilder objectBuilder = Json .createObjectBuilder() .add("componentModelId", @@ -198,11 +307,49 @@ public class Components { componentModel.getStyleAttribute()); } + final Class clazz = componentModel.getClass(); + final BeanInfo beanInfo; + try { + beanInfo = Introspector.getBeanInfo(clazz); + } catch (IntrospectionException ex) { + throw new WebApplicationException(ex); + } + + for (final PropertyDescriptor propertyDescriptor + : beanInfo.getPropertyDescriptors()) { + + final Method readMethod = propertyDescriptor.getReadMethod(); + final Object value; + try { + value = readMethod.invoke(componentModel); + } catch (IllegalAccessException + | InvocationTargetException ex) { + throw new WebApplicationException(ex); + } + + objectBuilder.add(propertyDescriptor.getName(), + value.toString()); + + } + return objectBuilder.build(); } + /** + * Creates a new {@link ComponentModel} instance. + * + * Uses reflection and the value of {@code type} property from the JSON + * {@code data} to determine the correct class. + * + * @param data The data from which the new {@link ComponentModel} is + * created. + * + * @return The new {@link ComponentModel}. + */ private ComponentModel createComponentModel(final JsonObject data) { + Objects.requireNonNull(data); + if (!data.containsKey("type")) { throw new BadRequestException("The JSON data for creating the " + "component has no value for the type of the component to " @@ -226,9 +373,26 @@ public class Components { return componentModel; } + /** + * Helper method for finding the correct subclass of {@link ComponentModel} + * using the fully qualified name the class. + * + * @param type The fully qualified name of the subclass of + * {@link ComponentModel}. + * + * @return The subclass of {@link ComponentModel}. + * + * @throws BadRequestException If there is no subclass of + * {@link ComponentModel} with the fully + * qualified name provided by the {@code type} + * parameter. + */ @SuppressWarnings("unchecked") private Class findComponentModelClass( final String type) { + + Objects.requireNonNull(type);; + try { final Class clazz = Class.forName(type); @@ -248,6 +412,13 @@ public class Components { } } + /** + * Helper method for setting the properties of a {@link ComponentModel} from + * the JSON data. + * + * @param data The JSON data. + * @param componentModel The {@link ComponentModel}. + */ private void setComponentPropertiesFromJson( final JsonObject data, final ComponentModel componentModel) { @@ -267,6 +438,16 @@ public class Components { data)); } + /** + * Helper emthod for setting a property of a {@link ComponentModel} using a + * value from JSON data. + * + * @param componentModel The {@link ComponentModel} + * @param propertyDesc The {@link PropertyDescriptor} for the property to + * set. + * @param data The JSON data containing the new value of the + * property. + */ private void setComponentPropertyFromJson( final ComponentModel componentModel, final PropertyDescriptor propertyDesc, diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Containers.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Containers.java index 4373fa3ec..437f44b04 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Containers.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/Containers.java @@ -23,7 +23,6 @@ import org.libreccm.pagemodel.ContainerModel; import org.libreccm.pagemodel.ContainerModelRepository; import org.libreccm.pagemodel.PageModel; import org.libreccm.pagemodel.PageModelManager; -import org.libreccm.pagemodel.PageModelRepository; import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.RequiresPrivilege; import org.libreccm.web.CcmApplication; @@ -46,6 +45,8 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; /** + * Provides RESTful endpoints for managing the {@link ContainerModel}s of a + * {@link PageModel} * * @author Jens Pelzetter */ @@ -62,9 +63,18 @@ public class Containers { @Inject private PageModelManager pageModelManager; - @Inject - private PageModelRepository pageModelRepo; - + /** + * Retrieves all {@link ContainerModel}s of a {@link PageModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} of which the + * containers are retrieved. + * + * @return A JSON array containing the data of all {@link ContainerModel}s + * of the {@link PageModel} identified by {@code pageModelName} of + * the {@link CcmApplication} with the primary URL {@code appPath}. + */ @GET @Path(PageModelsApp.CONTAINERS_PATH) @Produces("application/json; charset=utf-8") @@ -91,6 +101,18 @@ public class Containers { return arrayBuilder.build(); } + /** + * Retrieve a specific {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The value of the {@link ContainerModel#key} property + * of the {@link ContainerModel} to retrieve. + * + * @return A JSON object containing the data of the {@link PageModel}. + */ @GET @Path(PageModelsApp.CONTAINER_PATH) @Produces("application/json; charset=utf-8") @@ -115,6 +137,24 @@ public class Containers { return mapContainerModelToJson(container); } + /** + * Creates or updates a {@link ContainerModel}. If there is already a + * {@link ContainerModel} for the container identified by the provided + * {@code containerKey}, {@code pageModelName} and {@code appPath} the + * {@link ContainerModel} is updated with the data from the + * {@link JsonObject} {@code containerModelData}. + * + * If there is no such {@link ContainerModel} a new {@link ContainerModel} + * is created using the data provided by {@code containerModelData}. + * + * @param appPath The path of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key identifying the {@link ContainerModel}. + * @param containerModelData The data for updating or creating the + * {@link ContainerModel}. + * + * @return The new or updated {@link ContainerModel}. + */ @PUT @Path(PageModelsApp.CONTAINER_PATH) @Consumes("application/json; charset=utf-8") @@ -126,7 +166,7 @@ public class Containers { @PathParam(PageModelsApp.APP_NAME) final String appPath, @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, - final JsonObject containerModelJson) { + final JsonObject containerModelData) { final CcmApplication app = controller.findCcmApplication( String.format("/%s/", appPath)); @@ -158,6 +198,14 @@ public class Containers { return mapContainerModelToJson(containerModel); } + /** + * Deletes the {@link ContainerModel} identified by the provided parameters. + * + * @param appPath The path of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key identifying the {@link ContainerModel} to + * delete. + */ @DELETE @Path(PageModelsApp.CONTAINER_PATH) @Transactional(Transactional.TxType.REQUIRED) @@ -181,6 +229,14 @@ public class Containers { pageModelManager.removeContainerModel(pageModel, container); } + /** + * Helper method for mapping a {@link ContainerModel} to JSON: + * + * @param containerModel The {@link ContainerModel} to map. + * + * @return A {@link JsonObject} containing the data of the + * {@link ContainerModel}. + */ private JsonObject mapContainerModelToJson( final ContainerModel containerModel) { diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModels.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModels.java index 20b19a52e..b71433ff5 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModels.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModels.java @@ -20,14 +20,14 @@ package org.libreccm.pagemodel.rs; import org.libreccm.core.CoreConstants; import org.libreccm.l10n.GlobalizationHelper; -import org.libreccm.pagemodel.ComponentModelRepository; -import org.libreccm.pagemodel.ContainerModelRepository; import org.libreccm.pagemodel.PageModel; import org.libreccm.pagemodel.PageModelRepository; import org.libreccm.security.AuthorizationRequired; import org.libreccm.security.RequiresPrivilege; import org.libreccm.web.CcmApplication; +import java.util.Objects; + import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.json.Json; @@ -45,6 +45,8 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; /** + * Provides RESTful endpoints for retrieving, creating, updating and deleting + * {@link PageModels}. * * @author Jens Pelzetter */ @@ -55,37 +57,26 @@ public class PageModels { @Inject private PageModelsController controller; - @Inject - private ComponentModelRepository componentModelRepo; - - @Inject - private ContainerModelRepository containerRepo; - @Inject private PageModelRepository pageModelRepo; @Inject private GlobalizationHelper globalizationHelper; -// @GET -// @Path("/{appPath}") -// @Produces("application/json; charset=utf-8") -// @Transactional(Transactional.TxType.REQUIRED) -// @AuthorizationRequired -// @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) -// public List> getAllPageModels( -// @PathParam("appPath") String appPath) { -// -// final CcmApplication app = findCcmApplication( -// String.format("/%s/", appPath)); -// return pageModelRepo -// .findDraftByApplication(app) -// .stream() -// .map(this::mapPageModelToDataMap) -// .collect(Collectors.toList()); -// } + /** + * Retrieves all {@link PageModel}s available for an {@link CcmApplication}. + * + * @param appPath The path of the {@code app}. + * + * @return A JSON array with the data of all {@link PageModel}s of the + * {@link CcmApplication} {@code app}. + * + * @throws NotFoundException If there is no {@link CcmApplication} with the + * primary URL {@code appPath} an + * {@link NotFoundException} thrown resulting in + * 404 response. + */ @GET -// @Path("/{appPath}") @Path(PageModelsApp.PAGE_MODELS_PATH) @Produces("application/json; charset=utf-8") @Transactional(Transactional.TxType.REQUIRED) @@ -93,6 +84,8 @@ public class PageModels { @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) public JsonArray getAllPageModels( @PathParam(PageModelsApp.APP_NAME) String appPath) { + + Objects.requireNonNull(appPath); final CcmApplication app = controller .findCcmApplication(String.format("/%s/", appPath)); @@ -106,6 +99,27 @@ public class PageModels { return arrayBuilder.build(); } + /** + * Retrieves a specific {@link PageModel}. + * + * @param appPath The path ({@link CcmApplication#primaryUrl} of the + * {@link CcmApplication} to which the + * {@link PageModel} belongs (see + * {@link PageModel#application}). + * @param pageModelName The name of the {@link PageModel} to retrieve (see + * {@link PageModel#name}). + * + * @return A JSON object containing the data of the {@link PageModel}. + * + * @throws NotFoundException If there is not {@link CcmApplication} with the + * primary URL {@code appPath} a + * {@link NotFoundException} is thrown resulting + * in a 404 response. A {@link NotFoundException} + * is also thrown if there no {@link PageModel} + * identified by {@code pageModelName} for the + * {@link CcmApplication} with the primary URL + * {@code appPath}. + */ @GET @Path(PageModelsApp.PAGE_MODEL_PATH) @Produces("application/json; charset=utf-8") @@ -115,6 +129,9 @@ public class PageModels { public JsonObject getPageModel( @PathParam(PageModelsApp.APP_NAME) final String appPath, @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); final CcmApplication app = controller .findCcmApplication(String.format("/%s/", appPath)); @@ -123,6 +140,24 @@ public class PageModels { return mapPageModelToJson(pageModel); } + /** + * Creates or updates a {@link PageModel}. + * + * If a {@link PageModel} with the name {@code pageModelName} already exists + * for the {@link CcmApplication} with the primary URL {@code appPath} the + * {@link PageModel} is updated. If there is no such {@link PageModel} a new + * {@link PageModel} is created and associated with the + * {@link CcmApplication} identified by the primary URL {@code appPath}. + * + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel}. + * @param pageModelData The data for creating or updating the + * {@link PageModel}. + * + * @return The new or updated {@link PageModel}. + */ @PUT @Path(PageModelsApp.PAGE_MODEL_PATH) @Consumes("application/json; charset=utf-8") @@ -133,7 +168,10 @@ public class PageModels { public JsonObject putPageModel( @PathParam(PageModelsApp.APP_NAME) final String appPath, @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, - final JsonObject pageModelJson) { + final JsonObject pageModelData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); final CcmApplication app = controller .findCcmApplication(String.format("/%s/", appPath)); @@ -152,6 +190,13 @@ public class PageModels { return mapPageModelToJson(controller.findPageModel(app, pageModelName)); } + /** + * Deletes a {@link PageModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to delete. + */ @DELETE @Path(PageModelsApp.PAGE_MODEL_PATH) @Transactional(Transactional.TxType.REQUIRED) @@ -160,16 +205,29 @@ public class PageModels { public void deletePageModel( @PathParam(PageModelsApp.APP_NAME) final String appPath, @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); final CcmApplication app = controller - .findCcmApplication(String.format("/%s/", appPath)); + .findCcmApplication(String.format("/%s/", appPath)); final PageModel pageModel = controller.findPageModel(app, pageModelName); pageModelRepo.delete(pageModel); } + /** + * Helper method for mapping a {@link PageModel} object to JSON: + * + * @param pageModel The {@link PageModel} to map. + * + * @return A {@link JSON} object with the data of the provided + * {@link PageModel}. + */ private JsonObject mapPageModelToJson(final PageModel pageModel) { + Objects.requireNonNull(pageModel); + return Json .createObjectBuilder() .add("description", diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsApp.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsApp.java index b71eb5eb4..82e4e0e72 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsApp.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsApp.java @@ -24,11 +24,21 @@ import java.util.HashSet; import java.util.Set; import javax.ws.rs.ApplicationPath; +import javax.ws.rs.NotFoundException; import javax.ws.rs.core.Application; /** * JAX-RS application for managing {@link PageModel}s. * + * The several paths used by the classes of this JAX-RS application are defined + * in this class as string constants to avoid problems. Some other parts which + * specific to one of the classes are might defined in that class. + * + * All methods providing RESTful endpoints will throw a + * {@link NotFoundException} if one the objects in their path is not found. If + * this is the case the application server will send a 404 response to the + * client. + * * * @author Jens Pelzetter */ @@ -48,15 +58,17 @@ public class PageModelsApp extends Application { protected static final String CONTAINERS_PATH = PAGE_MODEL_PATH + "/containers"; protected static final String CONTAINER_PATH = CONTAINERS_PATH - + "/{" - + CONTAINER_KEY + + "/{" + + CONTAINER_KEY + "}"; protected static final String COMPONENTS_PATH = CONTAINER_PATH + "/components"; protected static final String COMPONENT_PATH = COMPONENTS_PATH - + "/{" - + COMPONENT_KEY - + "}"; + + "/{" + + COMPONENT_KEY + + "}"; + + protected static final String STYLES_PATH = CONTAINER_PATH + "/styles"; @Override public Set> getClasses() { @@ -65,6 +77,9 @@ public class PageModelsApp extends Application { classes.add(PageModels.class); classes.add(Containers.class); classes.add(Components.class); + classes.add(StylesRs.class); + classes.add(StylesMediaRule.class); + classes.add(StylesRule.class); return classes; } diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsController.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsController.java index 2b43b90ed..eb35d69ed 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsController.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/PageModelsController.java @@ -35,6 +35,8 @@ import javax.transaction.Transactional; import javax.ws.rs.NotFoundException; /** + * A helper class providing some functionality used by the JAX-RS classes in + * this package. * * @author Jens Pelzetter */ @@ -53,6 +55,13 @@ class PageModelsController { @Inject private PageModelRepository pageModelRepo; + /** + * Finds a {@link CcmApplication} using its {@code primaryUrl}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * + * @return The {@link CcmApplication} with the provided primary URL. + */ @Transactional(Transactional.TxType.REQUIRED) protected CcmApplication findCcmApplication(final String appPath) { @@ -63,6 +72,17 @@ class PageModelsController { appPath))); } + /** + * Finds a {@link ComponentModel} using its {@code componentKey}. + * + * @param app The {@link CcmApplication}. + * @param pageModel The {@link PageModel}. + * @param containerModel The {@link ContainerModel}. + * @param componentKey The key the {@link ComponentModel}. + * + * @return The {@link ComponentModel} identified by the provided + * {@code componentKey}. + */ @Transactional(Transactional.TxType.REQUIRED) protected ComponentModel findComponentModel( final CcmApplication app, @@ -73,14 +93,25 @@ class PageModelsController { return componentModelRepo .findComponentByContainerAndKey(containerModel, componentKey) .orElseThrow(() -> new NotFoundException(String - .format("The Container \"%s\" of the PageModel \"%s\" of application" - + "\"%s\" does not contain a component with the key \"%s\".", - containerModel.getKey(), - pageModel.getName(), - app.getPrimaryUrl(), - componentKey))); + .format( + "The Container \"%s\" of the PageModel \"%s\" of application" + + "\"%s\" does not contain a component with the key \"%s\".", + containerModel.getKey(), + pageModel.getName(), + app.getPrimaryUrl(), + componentKey))); } + /** + * Finds a {@link ContainerModel} using its {@code containerKey}. + * + * @param app The {@link CcmApplication}. + * @param pageModel The {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * + * @return The {@link ContainerModel} identified by the provided + * {@code containerKey}. + */ @Transactional(Transactional.TxType.REQUIRED) protected ContainerModel findContainer(final CcmApplication app, final PageModel pageModel, @@ -98,8 +129,18 @@ class PageModelsController { containerKey))); } - - + /** + * Determines if a {@link PageModel} with the provided name exists for the + * provided {@link CcmApplication}. + * + * @param app The {@link CcmApplication} to which the + * {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel}. + * + * @return {@code true} if a {@link PageModel} with the name provided by the + * parameter {@code pageModelName} exists for the provided + * {@link CcmApplication} {@code app}, {@code false} otherwise. + */ @Transactional(Transactional.TxType.REQUIRED) protected boolean existsPageModel(final CcmApplication app, final String pageModelName) { @@ -107,7 +148,17 @@ class PageModelsController { .findDraftByApplicationAndName(app, pageModelName) .isPresent(); } - + + /** + * Finds a {@link PageModel} using its name. + * + * @param app The {@link CcmApplication} to which the + * {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to retrieve. + * + * @return The {@link PageModel} identified by the name + * {@code pageModelName} for the {@link CcmApplication} {@code app}. + */ @Transactional(Transactional.TxType.REQUIRED) protected PageModel findPageModel(final CcmApplication app, final String pageModelName) { @@ -120,7 +171,7 @@ class PageModelsController { "No PageModel with name \"%s\" for application \"%s\".", pageModelName, app.getPrimaryUrl()))); } - + @Transactional(Transactional.TxType.REQUIRED) protected void savePageModel(final PageModel pageModel) { pageModelRepo.save(pageModel); diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesJsonMapper.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesJsonMapper.java new file mode 100644 index 000000000..fbc351de0 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesJsonMapper.java @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2018 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.pagemodel.rs; + +import org.libreccm.pagemodel.styles.CssProperty; +import org.libreccm.pagemodel.styles.Dimension; +import org.libreccm.pagemodel.styles.MediaQuery; +import org.libreccm.pagemodel.styles.MediaRule; +import org.libreccm.pagemodel.styles.Rule; + +import java.util.List; +import java.util.Objects; + +import javax.enterprise.context.RequestScoped; +import javax.json.Json; +import javax.json.JsonArray; +import javax.json.JsonArrayBuilder; +import javax.json.JsonObject; + +/** + * Utility class for mapping the entities from the + * {@link org.libreccm.pagemodel.styles} package to JSON. + * + * @author Jens Pelzetter + */ +@RequestScoped +class StylesJsonMapper { + + /** + * Map a {@link Dimension} object to JSON. + * + * @param dimension The {@link Dimension} object to map. + * + * @return A JSON object representing the provided {@link Dimension} object. + */ + protected JsonObject mapDimensionToJson(final Dimension dimension) { + + Objects.requireNonNull(dimension); + + return Json + .createObjectBuilder() + .add("value", dimension.getValue()) + .add("unit", dimension.getUnit().toString()) + .build(); + } + + /** + * Maps a List of {@link MediaRule} objects to JSON. + * + * @param mediaRules The {@link MediaRule}s to map. + * + * @return An JSON array with the data from the {@link MediaRule} objects in + * the list. + */ + protected JsonArray mapMediaRulesToJson(final List mediaRules) { + + final JsonArrayBuilder arrayBuilder = Json.createArrayBuilder(); + Objects + .requireNonNull(mediaRules) + .stream() + .map(this::mapMediaRuleToJson) + .forEach(arrayBuilder::add); + + return arrayBuilder.build(); + } + + /** + * Maps a {@link MediaRule} object to JSON. + * + * @param mediaRule The {@link MediaRule} object to map. + * + * @return The JSON representation of the provided {@link MediaRule} object. + */ + protected JsonObject mapMediaRuleToJson(final MediaRule mediaRule) { + + Objects.requireNonNull(mediaRule); + + return Json + .createObjectBuilder() + .add("mediaRuleId", mediaRule.getMediaRuleId()) + .add("mediaQuery", mapMediaQueryToJson(mediaRule.getMediaQuery())) + .add("rules", mapRulesToJson(mediaRule.getRules())) + .build(); + } + + /** + * Maps a {@link MediaQuery} object to JSON. + * + * @param mediaQuery The {@link MediaQuery} object to map. + * + * @return The JSON representation of the provided {@link MediaQuery} + * object. + */ + protected JsonObject mapMediaQueryToJson(final MediaQuery mediaQuery) { + + Objects.requireNonNull(mediaQuery); + + return Json + .createObjectBuilder() + .add("mediaQueryId", mediaQuery.getMediaQueryId()) + .add("mediaType", mediaQuery.getMediaType().toString()) + .add("minWidth", mapDimensionToJson(mediaQuery.getMinWidth())) + .add("maxWidth", mapDimensionToJson(mediaQuery.getMaxWidth())) + .build(); + } + + /** + * Maps a list of {@link Rule} objects to JSON. + * + * @param rules The list of {@link Rule} objects to map. + * + * @return A JSON array with the JSON representations of the {@link Rule} + * objects in the list. + */ + protected JsonArray mapRulesToJson(final List rules) { + + final JsonArrayBuilder arrayBuilder = Json.createArrayBuilder(); + Objects + .requireNonNull(rules) + .stream() + .map(this::mapRuleToJson) + .forEach(arrayBuilder::add); + + return arrayBuilder.build(); + } + + /** + * Maps a {@link Rule} object to JSON. + * + * @param rule The {@link Rule} object to map. + * + * @return The JSON representation of the provided {@link RuleObject}. + */ + protected JsonObject mapRuleToJson(final Rule rule) { + + Objects.requireNonNull(rule); + + return Json + .createObjectBuilder() + .add("ruleId", rule.getRuleId()) + .add("selector", rule.getSelector()) + .add("properties", mapPropertiesToJson(rule.getProperties())) + .build(); + } + + /** + * Maps a list of {@link CssProperty} objects to JSON. + * + * @param properties The list of {@link CssProperty} objects to map. + * + * @return A JSON array containing the JSON representations of the + * {@link CssProperty} objects in the list. + */ + protected JsonArray mapPropertiesToJson(final List properties) { + + final JsonArrayBuilder arrayBuilder = Json.createArrayBuilder(); + Objects + .requireNonNull(properties) + .stream() + .map(this::mapCssPropertyToJson) + .forEach(arrayBuilder::add); + + return arrayBuilder.build(); + } + + /** + * Maps a {@link CssProperty} object to JSON. + * + * @param property The {@link CssProperty} to map. + * @return The JSON representation of the provided {@link CssProperty}. + */ + protected JsonObject mapCssPropertyToJson(final CssProperty property) { + + Objects.requireNonNull(property); + + return Json + .createObjectBuilder() + .add("propertyId", property.getPropertyId()) + .add("name", property.getName()) + .add("value", property.getValue()) + .build(); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesMediaRule.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesMediaRule.java new file mode 100644 index 000000000..99c1eb7da --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesMediaRule.java @@ -0,0 +1,622 @@ +/* + * Copyright (C) 2018 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.pagemodel.rs; + +import org.libreccm.core.CoreConstants; +import org.libreccm.pagemodel.ContainerModel; +import org.libreccm.pagemodel.styles.CssProperty; +import org.libreccm.pagemodel.styles.MediaRule; +import org.libreccm.pagemodel.styles.Rule; +import org.libreccm.pagemodel.styles.StylesManager; +import org.libreccm.pagemodel.styles.StylesRepository; +import org.libreccm.security.AuthorizationRequired; +import org.libreccm.security.RequiresPrivilege; +import org.libreccm.web.CcmApplication; + +import java.io.Serializable; +import java.util.Objects; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.json.JsonArray; +import javax.json.JsonObject; +import javax.transaction.Transactional; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; + +/** + * Provides RESTful endpoints for retrieving, creating, updating and deleting + * {@link MediaRule}s. + * + * @author Jens Pelzetter + */ +@RequestScoped +@Path(StylesRs.MEDIA_RULE_PATH) +public class StylesMediaRule implements Serializable { + + private static final long serialVersionUID = 3257114872624583807L; + + protected final static String PROPERTY_ID = "propertyId"; + protected final static String RULE_ID = "ruleId"; + + protected final static String RULES_PATH = "/rules"; + protected final static String RULE_PATH = RULES_PATH + + "/{" + + RULE_ID + + "}"; + protected final static String PROPERTIES_PATH = RULE_PATH + "/properties"; + protected final static String PROPERTY_PATH = PROPERTIES_PATH + + "/{" + + PROPERTY_ID + + "}"; + + @Inject + private StylesJsonMapper stylesJsonMapper; + + @Inject + private StylesManager stylesManager; + + @Inject + private StylesRepository stylesRepo; + + @Inject + private StylesRs stylesRs; + + /** + * Retrieves all {@link Rule}s of a {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * + * @return A JSON array with the JSON representations of all {@link Rule}s + * belonging the {@link MediaRule} identified by the provided path. + */ + @GET + @Path(RULES_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonArray getRules( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + return stylesJsonMapper.mapRulesToJson(mediaRule.getRules()); + } + + /** + * Retrieves a specific {@link Rule} from a {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleIdParam The ID of the {@link Rule} to retrieve. + * + * @return The JSON representation of the {@link Rule} identified by the + * provided path. + */ + @GET + @Path(RULE_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject getRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) String ruleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + return stylesJsonMapper.mapRuleToJson(findRule(mediaRule, + ruleIdParam)); + } + + /** + * Creates a new {@link Rule} for a {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleData The data from which the new {@link Rule} is + * created. + * + * @return The JSON representation of the new {@link Rule}. + */ + @POST + @Path(RULES_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject createRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + final JsonObject ruleData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleData); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = new Rule(); + rule.setSelector(ruleData.getString("selector")); + stylesManager.addRuleToMediaRule(rule, mediaRule); + + return stylesJsonMapper.mapRuleToJson(rule); + } + + /** + * Updates an existing {@link Rule} + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleIdParam The ID of the {@link Rule} to update. + * @param ruleData The data from which used to update the + * {@link Rule}. + * + * @return The JSON representation of the updated {@link Rule}. + */ + @PUT + @Path(RULE_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject updateRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) String ruleIdParam, + final JsonObject ruleData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(ruleData); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = findRule(mediaRule, ruleIdParam); + rule.setSelector(ruleData.getString("selector")); + stylesManager.addRuleToMediaRule(rule, mediaRule); + + return stylesJsonMapper.mapRuleToJson(rule); + } + + @DELETE + @Path(RULE_PATH) + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) String ruleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = findRule(mediaRule, ruleIdParam); + + stylesManager.removeRuleFromMediaRule(rule, mediaRule); + stylesRepo.deleteRule(rule); + } + + /** + * Retrieves all {@link CssProperty} objects assigned to {@link Rule} which + * is assigned to {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleIdParam The ID of the {@link Rule} from which the + * {@link CssProperty} objects are retrieved. + * + * @return A JSON array with the JSON representations of the + * {@link CssProperty} objects. + */ + @GET + @Path(PROPERTIES_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonArray getProperties( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) String ruleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = findRule(mediaRule, ruleIdParam); + + return stylesJsonMapper.mapPropertiesToJson(rule.getProperties()); + } + + /** + * Retrieve a {@link CssProperty} assigned to {@link Rule} which is assigned + * to {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleIdParam The ID of the {@link Rule} from which the + * {@link CssProperty} is retrieved. + * @param propertyIdParam The ID of the {@link CssProperty} to retrieve. + * + * @return The JSON representation of the {@link CssProperty} identified by + * the provided path. + */ + @GET + @Path(PROPERTY_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject getProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) final String ruleIdParam, + @PathParam(PROPERTY_ID) final String propertyIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyIdParam); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = findRule(mediaRule, ruleIdParam); + final CssProperty property = findProperty(rule, propertyIdParam); + + return stylesJsonMapper.mapCssPropertyToJson(property); + } + + /** + * Creates a new {@link CssProperty} for a {@link Rule} of a + * {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleIdParam The ID of the {@link Rule} for which the new + * {@link CssProperty} is created. + * @param propertyData The data from which the new {@link CssProperty} + * is created. + * + * @return The JSON representation of the new {@link CssProperty}. + */ + @POST + @Path(PROPERTIES_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject createProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) String ruleIdParam, + final JsonObject propertyData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyData); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = findRule(mediaRule, ruleIdParam); + + final CssProperty property = new CssProperty(); + setCssPropertyData(property, propertyData); + stylesManager.addCssPropertyToRule(property, rule); + + return stylesJsonMapper.mapCssPropertyToJson(property); + } + + /** + * Updates an existing {@link CssProperty} of {@link Rule} of a + * {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleIdParam The ID of the {@link Rule} to which the + * {@link CssProperty} belongs. + * @param propertyIdParam The ID of the {@link CssProperty} to update. + * @param propertyData The data which is used to update the + * {@link CssProperty}. + * + * @return The JSON representation of the updated {@link CssProperty}. + */ + @PUT + @Path(PROPERTY_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject updateProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) String ruleIdParam, + @PathParam(PROPERTY_ID) final String propertyIdParam, + final JsonObject propertyData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyIdParam); + Objects.requireNonNull(propertyData); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = findRule(mediaRule, ruleIdParam); + + final CssProperty property = findProperty(rule, propertyIdParam); + setCssPropertyData(property, propertyData); + stylesRepo.saveCssProperty(property); + + return stylesJsonMapper.mapCssPropertyToJson(property); + } + + /** + * Deletes a {@link CssProperty} of a {@link Rule} assigned to a + * {@link MediaRule}. + * + * @param appPath The path of the {@link CcmApplication} to which + * the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which + * the {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule}. + * @param ruleIdParam The ID of the {@link Rule} to which the + * {@link CssProperty} belongs. + * @param propertyIdParam The ID of the {@link CssProperty} to delete. + */ + @DELETE + @Path(PROPERTY_PATH) + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.MEDIA_RULE_ID) final String mediaRuleIdParam, + @PathParam(RULE_ID) String ruleIdParam, + @PathParam(PROPERTY_ID) final String propertyIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyIdParam); + + final MediaRule mediaRule = stylesRs.findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + + final Rule rule = findRule(mediaRule, ruleIdParam); + + final CssProperty property = findProperty(rule, propertyIdParam); + stylesManager.removeCssPropertyFromRule(property, rule); + stylesRepo.deleteCssProperty(property); + } + + /** + * Helper method for finding a {@link CssProperty}. + * + * @param rule The {@link Rule} to which the {@link CssProperty} + * belongs. + * @param propertyIdParam The ID of the {@link CssProperty} to find. + * + * @return The {@link CssProperty}. + */ + private CssProperty findProperty(final Rule rule, + final String propertyIdParam) { + + final long propertyId; + try { + propertyId = Long.parseLong(propertyIdParam); + } catch (NumberFormatException ex) { + throw new WebApplicationException(ex); + } + + return rule + .getProperties() + .stream() + .filter(property -> propertyId == property.getPropertyId()) + .findAny() + .orElseThrow(() -> new NotFoundException()); + } + + /** + * Helper method for finding a {@link Rule} assigned to {@link MediaRule}. + * + * @param mediaRule The {@link MediaRule}. + * @param ruleIdParam The ID of {@link Rule} to find. + * + * @return The {@link Rule}. + */ + private Rule findRule(final MediaRule mediaRule, + final String ruleIdParam) { + + final long ruleId; + try { + ruleId = Long.parseLong(ruleIdParam); + } catch (NumberFormatException ex) { + throw new WebApplicationException(ex); + } + + Objects.requireNonNull(mediaRule); + + return mediaRule + .getRules() + .stream() + .filter(rule -> ruleId == rule.getRuleId()) + .findAny() + .orElseThrow(() -> new NotFoundException()); + } + + /** + * Helper method for updating the values of the properties of + * {@link CssProperty} object from its JSON representation. + * + * @param property The {@link CssProperty}. + * @param propertyData The {@link JsonObject} containing the data. + */ + private void setCssPropertyData(final CssProperty property, + final JsonObject propertyData) { + + Objects.requireNonNull(property); + Objects.requireNonNull(propertyData); + + property.setName(propertyData.getString("name")); + property.setValue(propertyData.getString("value")); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRs.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRs.java new file mode 100644 index 000000000..255789262 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRs.java @@ -0,0 +1,666 @@ +/* + * Copyright (C) 2018 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.pagemodel.rs; + +import org.libreccm.core.CoreConstants; +import org.libreccm.pagemodel.ContainerModel; +import org.libreccm.pagemodel.PageModel; +import org.libreccm.pagemodel.styles.Dimension; +import org.libreccm.pagemodel.styles.MediaRule; +import org.libreccm.pagemodel.styles.MediaType; +import org.libreccm.pagemodel.styles.Rule; +import org.libreccm.pagemodel.styles.Styles; +import org.libreccm.pagemodel.styles.StylesManager; +import org.libreccm.pagemodel.styles.StylesRepository; +import org.libreccm.pagemodel.styles.Unit; +import org.libreccm.security.AuthorizationRequired; +import org.libreccm.security.RequiresPrivilege; +import org.libreccm.web.CcmApplication; + +import java.util.Objects; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.json.JsonArray; +import javax.json.JsonObject; +import javax.transaction.Transactional; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; + +/** + * Provides RESTful endpoints for managing the (CSS) styles of a + * {@link ContainerModel}. + * + * @author Jens Pelzetter + */ +@RequestScoped +@Path(PageModelsApp.STYLES_PATH) +public class StylesRs { + + protected static final String MEDIA_RULE_ID = "mediaRuleId"; + protected static final String RULE_ID = "ruleId"; + + protected static final String MEDIA_RULES_PATH = "/media-rules"; + protected static final String MEDIA_RULE_PATH = MEDIA_RULES_PATH + + "/{" + + MEDIA_RULE_ID + + "}"; + protected static final String RULES_PATH = "/rules"; + protected static final String RULE_PATH = RULES_PATH + + "/{" + + RULE_ID + + "}"; + + @Inject + private PageModelsController controller; + + @Inject + private StylesJsonMapper stylesJsonMapper; + + @Inject + private StylesManager stylesManager; + + @Inject + private StylesRepository stylesRepo; + + /** + * Retrieves all {@link MediaRule}s from the {@link Styles} entity of a + * {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * + * @return The JSON Array with the JSON representations of all + * {@link MediaRule}s of the {@link ContainerModel} identified by + * the provided path. + */ + @GET + @Path(MEDIA_RULES_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonArray getMediaRules( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + + final Styles styles = container.getStyles(); + + return stylesJsonMapper.mapMediaRulesToJson(styles.getMediaRules()); + + } + + /** + * Retrieves a specific {@link MediaRule} from the {@link Styles} entity of + * a {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param mediaRuleIdParam The ID of the {@link MediaRule} to retrieve. + * + * @return The JSON representation of the {@link MediaRule}. + */ + @GET + @Path(MEDIA_RULE_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject getMediaRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(MEDIA_RULE_ID) final String mediaRuleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + + return stylesJsonMapper + .mapMediaRuleToJson(findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam)); + } + + /** + * Creates a new {@link MediaRule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param mediaRuleData The data for the new {@link MediaRule}. + * + * @return The JSON representation of the new {@link MediaRule}. + */ + @POST + @Path(MEDIA_RULES_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject createMediaRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + final JsonObject mediaRuleData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleData); + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + final Styles styles = container.getStyles(); + + final MediaRule mediaRule = new MediaRule(); + setMediaRuleProperties(mediaRuleData, mediaRule); + stylesManager.addMediaRuleToStyles(mediaRule, styles); + + return stylesJsonMapper.mapMediaRuleToJson(mediaRule); + } + + /** + * Update a {@link MediaRule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param mediaRuleIdParam The ID of the {@link MediaRule} to update. + * @param mediaRuleData The data for updating the {@link MediaRule}. + * + * @return The JSON representation of the updated {@link MediaRule}. + */ + @PUT + @Path(MEDIA_RULE_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject updateMediaRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(MEDIA_RULE_ID) final String mediaRuleIdParam, + final JsonObject mediaRuleData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + Objects.requireNonNull(mediaRuleData); + + final MediaRule mediaRule = findMediaRule(appPath, + pageModelName, + containerKey, + mediaRuleIdParam); + setMediaRuleProperties(mediaRuleData, mediaRule); + stylesRepo.saveMediaRule(mediaRule); + + return stylesJsonMapper.mapMediaRuleToJson(mediaRule); + } + + /** + * Deletes a {@link MediaRule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param mediaRuleIdParam The ID of the {@link MediaRule} to delete. + */ + @DELETE + @Path(MEDIA_RULE_PATH) + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteMediaRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(MEDIA_RULE_ID) final String mediaRuleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(mediaRuleIdParam); + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + + final Styles styles = container.getStyles(); + + final MediaRule mediaRule = findMediaRule(pageModel, + container, + mediaRuleIdParam); + stylesManager.removeMediaRuleFromStyles(mediaRule, styles); + } + + /** + * Retrieves all {@link Rule}s from the {@link Styles} entity of a + * {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * + * @return A JSON array with the JSON representation of all {@link Rule}s of + * the {@link ContainerModel}. + */ + @GET + @Path(RULES_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonArray getRules( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + + final Styles styles = container.getStyles(); + + return stylesJsonMapper.mapRulesToJson(styles.getRules()); + } + + /** + * Retrieves a specific {@link Rule} from the {@link Styles} entity of a + * {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param ruleIdParam The ID of the {@link Rule} to retrieve. + * + * @return The JSON representation of the {@link Rule}. + */ + @GET + @Path(RULE_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject getRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(RULE_ID) final String ruleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + + return stylesJsonMapper + .mapRuleToJson(findRule(appPath, + pageModelName, + containerKey, + ruleIdParam)); + } + + /** + * Creates a new {@link Rule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param ruleData The data for the new {@link Rule}. + * + * @return The JSON representation of the new {@link Rule}. + */ + @POST + @Path(RULES_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject createRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + final JsonObject ruleData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleData); + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + final Styles styles = container.getStyles(); + + final Rule rule = new Rule(); + rule.setSelector(ruleData.getString("selector")); + stylesManager.addRuleToStyles(rule, styles); + + return stylesJsonMapper.mapRuleToJson(rule); + } + + /** + * Updates an existing {@link Rule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param ruleIdParam The ID of the {@link Rule} to update. + * @param ruleData The data for updating the {@link Rule}. + * + * @return The JSON representation of the updated {@link Rule}. + */ + @PUT + @Path(RULE_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject updateRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(RULE_ID) final String ruleIdParam, + final JsonObject ruleData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(ruleData); + + final Rule rule = findRule(appPath, + pageModelName, + containerKey, + ruleIdParam); + rule.setSelector(ruleData.getString("selector")); + stylesRepo.saveRule(rule); + return stylesJsonMapper.mapRuleToJson(rule); + } + + /** + * Deletes a {@link Rule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param ruleIdParam The ID of the {@link Rule} to delete. + */ + @DELETE + @Path(RULE_PATH) + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteRule( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(RULE_ID) final String ruleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + + final Styles styles = container.getStyles(); + + final Rule rule = findRule(pageModel, container, ruleIdParam); + stylesManager.removeRuleFromStyles(rule, styles); + } + + /** + * An utility method for finding a {@link MediaRule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param mediaRuleIdParam The ID of the {@link MediaRule} to find. + * + * @return The {@link MediaRule} with the provided {@code mediaRuleId}. + */ + protected MediaRule findMediaRule(final String appPath, + final String pageModelName, + final String containerKey, + final String mediaRuleIdParam) { + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + + return findMediaRule(pageModel, container, mediaRuleIdParam); + } + + /** + * An utility method for finding a {@link MediaRule}. + * + * @param pageModel The {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param container The {@link ContainerModel} to which the + * {@link MediaRule} belongs. + * @param mediaRuleIdParam The ID of the {@link MediaRule} to find. + * + * @return The {@link MediaRule} with the ID {@code mediaRuleIdParam}. + */ + private MediaRule findMediaRule(final PageModel pageModel, + final ContainerModel container, + final String mediaRuleIdParam) { + + final Styles styles = container.getStyles(); + + final long mediaRuleId; + try { + mediaRuleId = Long.parseLong(mediaRuleIdParam); + } catch (NumberFormatException ex) { + throw new WebApplicationException(String.format( + "The provided mediaRuleId \"%s\" numeric.", mediaRuleIdParam)); + } + + return styles + .getMediaRules() + .stream() + .filter(mediaRule -> mediaRuleId == mediaRule.getMediaRuleId()) + .findAny() + .orElseThrow(() -> new NotFoundException(String.format( + "No MediaRule with ID %d available in the Styles for " + + "Container \"%s\" of PageModel \"%s\".", + mediaRuleId, + container.getKey(), + pageModel.getName()))); + } + + /** + * Utility method for finding a {@link Rule}. + * + * @param appPath The primary URL of the {@link CcmApplication}. + * @param pageModelName The name of the {@link PageModel}. + * @param containerKey The key of the {@link ContainerModel}. + * @param ruleIdParam The ID of the {@link Rule} to find. + * + * @return The {@link Rule} identified by {@code ruleIdParam}. + */ + protected Rule findRule(final String appPath, + final String pageModelName, + final String containerKey, + final String ruleIdParam) { + + final CcmApplication app = controller.findCcmApplication( + String.format("/%s/", appPath)); + + final PageModel pageModel = controller.findPageModel(app, + pageModelName); + + final ContainerModel container = controller.findContainer(app, + pageModel, + containerKey); + + return findRule(pageModel, container, ruleIdParam); + } + + /** + * An utility method for finding a {@link Rule}. + * + * @param pageModel The {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param container The {@link ContainerModel} to which the {@link Rule} + * belongs. + * @param ruleIdParam The ID of the {@link Rule} to find. + * + * @return The {@link Rule} with the ID {@code ruleIdParam}. + */ + private Rule findRule(final PageModel pageModel, + final ContainerModel container, + final String ruleIdParam) { + + final Styles styles = container.getStyles(); + + final long ruleId; + try { + ruleId = Long.parseLong(ruleIdParam); + } catch (NumberFormatException ex) { + throw new WebApplicationException(String.format( + "The provided mediaRuleId \"%s\" numeric.", ruleIdParam)); + } + + return styles + .getRules() + .stream() + .filter(rule -> ruleId == rule.getRuleId()) + .findAny() + .orElseThrow(() -> new NotFoundException(String.format( + "No Rule with ID %d available in the Styles for " + + "Container \"%s\" of PageModel \"%s\".", + ruleId, + container.getKey(), + pageModel.getName()))); + } + + /** + * Helper method for setting the values of the properties of a + * {@link MediaRule} using the data from a JSON object. + * + * @param mediaRuleData The JSON object providing the data. + * @param mediaRule The {@link MediaRule}. + */ + private void setMediaRuleProperties(final JsonObject mediaRuleData, + final MediaRule mediaRule) { + + Objects.requireNonNull(mediaRuleData); + Objects.requireNonNull(mediaRule); + + final JsonObject mediaQueryData = mediaRuleData + .getJsonObject("mediaQuery"); + final JsonObject maxWidthData = mediaQueryData + .getJsonObject("maxWidth"); + final JsonObject minWidthData = mediaQueryData + .getJsonObject("minWidth"); + + final Dimension maxWidth = new Dimension(); + maxWidth.setUnit(Unit.valueOf(maxWidthData.getString("unit"))); + maxWidth.setValue(maxWidthData.getJsonNumber("value").doubleValue()); + final MediaType mediaType = MediaType.valueOf(mediaQueryData + .getString("mediaType")); + + final Dimension minWidth = new Dimension(); + minWidth.setUnit(Unit.valueOf(minWidthData.getString("unit"))); + minWidth.setValue(minWidthData.getJsonNumber("minWidth").doubleValue()); + + mediaRule.getMediaQuery().setMaxWidth(maxWidth); + mediaRule.getMediaQuery().setMediaType(mediaType); + mediaRule.getMediaQuery().setMinWidth(minWidth); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRule.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRule.java new file mode 100644 index 000000000..c396f0437 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/StylesRule.java @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2018 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.pagemodel.rs; + +import org.libreccm.core.CoreConstants; +import org.libreccm.pagemodel.ContainerModel; +import org.libreccm.pagemodel.styles.CssProperty; +import org.libreccm.pagemodel.styles.Rule; +import org.libreccm.pagemodel.styles.StylesManager; +import org.libreccm.pagemodel.styles.StylesRepository; +import org.libreccm.security.AuthorizationRequired; +import org.libreccm.security.RequiresPrivilege; +import org.libreccm.web.CcmApplication; + +import java.io.Serializable; +import java.util.Objects; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.json.JsonArray; +import javax.json.JsonObject; +import javax.transaction.Transactional; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.NotFoundException; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; + +/** + * Provides RESTful endpoints for retrieving, creating, updating and deleting + * {@link Rule} objects. + * + * @author Jens Pelzetter + */ +@RequestScoped +@Path(StylesRs.RULE_PATH) +public class StylesRule implements Serializable { + + private static final long serialVersionUID = -8447970787677773230L; + + protected final static String PROPERTY_ID = "propertyId"; + + protected final static String PROPERTIES_PATH = "/properties"; + protected final static String PROPERTY_PATH = PROPERTIES_PATH + + "/{" + + PROPERTY_ID + + "}"; + + @Inject + private StylesJsonMapper stylesJsonMapper; + + @Inject + private StylesManager stylesManager; + + @Inject + private StylesRepository stylesRepo; + + @Inject + private StylesRs stylesRs; + + /** + * Retrieves all {@link CssProperty} objects of a {@link Rule} assigned to + * the {@link Styles} entity of a {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which the + * {@link Rule} belongs. + * @param ruleIdParam The ID of the {@link Rule} from which the + * {@link CssProperty} objects are retrieved. + * + * @return A JSON array with the JSON representation of the + * {@link CssProperty} objects of the {@link Rule} identified by the + * provided path. + */ + @GET + @Path(PROPERTIES_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonArray getProperties( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.RULE_ID) final String ruleIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + + final Rule rule = stylesRs.findRule(appPath, + pageModelName, + containerKey, + ruleIdParam); + return stylesJsonMapper.mapPropertiesToJson(rule.getProperties()); + } + + /** + * Retrieves a specific {@link CssProperty} from a {@link Rule} assigned to + * the {@link Styles} entity of a {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which the + * {@link Rule} belongs. + * @param ruleIdParam The ID of the {@link Rule} to which the + * {@link CssProperty} is assigned. + * @param propertyIdParam The ID of the {@link CssProperty} to retrieve. + * + * @return The JSON representation of the {@link CssProperty}. + */ + @GET + @Path(PROPERTY_PATH) + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject getProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.RULE_ID) final String ruleIdParam, + @PathParam(PROPERTY_ID) final String propertyIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyIdParam); + + final Rule rule = stylesRs.findRule(appPath, + pageModelName, + containerKey, + ruleIdParam); + + return stylesJsonMapper + .mapCssPropertyToJson(findProperty(rule, + propertyIdParam)); + } + + /** + * Creates a new {@link CssProperty} for a {@link Rule} assigned to the + * {@link Styles} entity of a {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which the + * {@link Rule} belongs. + * @param ruleIdParam The ID of the {@link Rule} to which the + * {@link CssProperty} is assigned. + * @param propertyData The data used to create the new {@link CssProperty}. + * + * @return The JSON representation of the new {@link CssProperty}. + */ + @POST + @Path(PROPERTIES_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject createProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.RULE_ID) final String ruleIdParam, + final JsonObject propertyData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyData); + + final Rule rule = stylesRs.findRule(appPath, + pageModelName, + containerKey, + ruleIdParam); + + final CssProperty property = new CssProperty(); + setCssPropertyData(property, propertyData); + stylesManager.addCssPropertyToRule(property, rule); + + return stylesJsonMapper.mapCssPropertyToJson(property); + } + + /** + * Updates an existing {@link CssProperty} for a {@link Rule} assigned to + * the {@link Styles} entity of a {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which the + * {@link Rule} belongs. + * @param ruleIdParam The ID of the {@link Rule} to which the + * {@link CssProperty} is assigned. + * @param propertyIdParam The ID of the {@link CssProperty} to update. + * @param propertyData The data used to update the {@link CssProperty}. + * + * @return The JSON representation of the updated {@link CssProperty}. + */ + @PUT + @Path(PROPERTY_PATH) + @Consumes("application/json; charset=utf-8") + @Produces("application/json; charset=utf-8") + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public JsonObject updateProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.RULE_ID) final String ruleIdParam, + @PathParam(PROPERTY_ID) final String propertyIdParam, + final JsonObject propertyData) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyIdParam); + Objects.requireNonNull(propertyData); + + final Rule rule = stylesRs.findRule(appPath, + pageModelName, + containerKey, + ruleIdParam); + + final CssProperty property = findProperty(rule, propertyIdParam); + setCssPropertyData(property, propertyData); + stylesRepo.saveCssProperty(property); + + return stylesJsonMapper.mapCssPropertyToJson(property); + } + + /** + * Deletes{@link CssProperty} for a {@link Rule} assigned to the + * {@link Styles} entity of a {@link ContainerModel}. + * + * @param appPath The primary URL of the {@link CcmApplication} to + * which the {@link PageModel} belongs. + * @param pageModelName The name of the {@link PageModel} to which the + * {@link ContainerModel} belongs. + * @param containerKey The key of the {@link ContainerModel} to which the + * {@link Rule} belongs. + * @param ruleIdParam The ID of the {@link Rule} to which the + * {@link CssProperty} is assigned. + * @param propertyIdParam The ID of the {@link CssProperty} to delete. + */ + @DELETE + @Path(PROPERTY_PATH) + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteProperty( + @PathParam(PageModelsApp.APP_NAME) final String appPath, + @PathParam(PageModelsApp.PAGE_MODEL_NAME) final String pageModelName, + @PathParam(PageModelsApp.CONTAINER_KEY) final String containerKey, + @PathParam(StylesRs.RULE_ID) final String ruleIdParam, + @PathParam(PROPERTY_ID) final String propertyIdParam) { + + Objects.requireNonNull(appPath); + Objects.requireNonNull(pageModelName); + Objects.requireNonNull(containerKey); + Objects.requireNonNull(ruleIdParam); + Objects.requireNonNull(propertyIdParam); + + final Rule rule = stylesRs.findRule(appPath, + pageModelName, + containerKey, + ruleIdParam); + + final CssProperty property = findProperty(rule, propertyIdParam); + stylesManager.removeCssPropertyFromRule(property, rule); + stylesRepo.deleteCssProperty(property); + } + + /** + * Helper method for finding a {@link CssProperty} assigned to {@link Rule}. + * + * @param rule The {@link Rule}. + * @param propertyIdParam The ID of the {@link CssProperty} to find. + * + * @return The {@link CssProperty} identified by {@code propertyIdParam}. + */ + private CssProperty findProperty(final Rule rule, + final String propertyIdParam) { + + Objects.requireNonNull(rule); + Objects.requireNonNull(propertyIdParam); + + final long propertyId; + try { + propertyId = Long.parseLong(propertyIdParam); + } catch (NumberFormatException ex) { + throw new WebApplicationException(ex); + } + + return rule + .getProperties() + .stream() + .filter(property -> propertyId == property.getPropertyId()) + .findAny() + .orElseThrow(() -> new NotFoundException()); + } + + /** + * Helper method for updating a {@link CssProperty} object with data from + * its JSON representation. + * + * @param property The {@link CssProperty}. + * @param propertyData The data. + */ + private void setCssPropertyData(final CssProperty property, + final JsonObject propertyData) { + + Objects.requireNonNull(property); + Objects.requireNonNull(propertyData); + + property.setName(propertyData.getString("name")); + property.setValue(propertyData.getString("value")); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/rs/package-info.java b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/package-info.java new file mode 100644 index 000000000..a18589a62 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/rs/package-info.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2018 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 + */ + +/** + * The classes in this package provide a RESTful API as backend for PageModel + * editors. + * + */ +package org.libreccm.pagemodel.rs; diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/CssProperty.java b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/CssProperty.java index d4d0bfe16..001f4c957 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/CssProperty.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/CssProperty.java @@ -41,14 +41,23 @@ public class CssProperty implements Serializable { private static final long serialVersionUID = -4697757123207731769L; + /** + * ID of the CSS property + */ @Id @Column(name = "PROPERTY_ID") @GeneratedValue(strategy = GenerationType.AUTO) private long propertyId; + /** + * The name of the property. + */ @Column(name = "NAME", length = 256) private String name; + /** + * The value of the property. + */ @Column(name = "PROPERTY_VALUE", length = 4096) private String value; diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/Dimension.java b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/Dimension.java index 2b4a68a9e..b8d4011fd 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/Dimension.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/Dimension.java @@ -36,17 +36,17 @@ public class Dimension implements Serializable { private static final long serialVersionUID = 44299305931240403L; @Column(name = "DIMENSION_VALUE") - private float value; + private double value; @Column(name = "UNIT") @Enumerated(EnumType.STRING) private Unit unit; - public float getValue() { + public double getValue() { return value; } - public void setValue(final float value) { + public void setValue(final double value) { this.value = value; } @@ -61,7 +61,9 @@ public class Dimension implements Serializable { @Override public int hashCode() { int hash = 7; - hash = 37 * hash + Float.floatToIntBits(value); + hash = 37 * hash + + (int) (Double.doubleToLongBits(value) + ^ (Double.doubleToLongBits(value) >>> 32)); hash = 37 * hash + Objects.hashCode(unit); return hash; } @@ -82,8 +84,8 @@ public class Dimension implements Serializable { return false; } - if (Float.floatToIntBits(value) != Float - .floatToIntBits(other.getValue())) { + if (Double.doubleToLongBits(value) + != Double.doubleToLongBits(other.getValue())) { return false; } return unit == other.getUnit(); @@ -113,4 +115,5 @@ public class Dimension implements Serializable { public String toCss() { return String.format("%s%s", value, unit.toString().toLowerCase()); } + } diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/MediaRule.java b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/MediaRule.java index c58621ce6..adb10c478 100644 --- a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/MediaRule.java +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/MediaRule.java @@ -56,7 +56,7 @@ public class MediaRule implements Serializable { @OneToOne @JoinColumn(name = "MEDIA_QUERY_ID") - @Cascade(CascadeType.ALL) + @Cascade(CascadeType.ALL) private MediaQuery mediaQuery; @OneToMany diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesManager.java b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesManager.java new file mode 100644 index 000000000..8f38345aa --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesManager.java @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2018 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.pagemodel.styles; + +import org.libreccm.core.CoreConstants; +import org.libreccm.security.AuthorizationRequired; +import org.libreccm.security.RequiresPrivilege; + +import java.io.Serializable; +import java.util.Objects; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.transaction.Transactional; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +public class StylesManager implements Serializable { + + private static final long serialVersionUID = -2906584926633549611L; + + @Inject + private StylesRepository stylesRepo; + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + + public void addCssPropertyToRule(final CssProperty property, + final Rule rule) { + + Objects.requireNonNull(property); + Objects.requireNonNull(rule); + + rule.addProperty(property); + stylesRepo.saveRule(rule); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void removeCssPropertyFromRule(final CssProperty property, + final Rule rule) { + + Objects.requireNonNull(property); + Objects.requireNonNull(rule); + + rule.removeProperties(property); + stylesRepo.saveRule(rule); + stylesRepo.deleteCssProperty(property); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void addMediaRuleToStyles(final MediaRule mediaRule, + final Styles styles) { + + Objects.requireNonNull(styles); + Objects.requireNonNull(mediaRule); + + styles.addMediaRule(mediaRule); + stylesRepo.saveStyles(styles); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void removeMediaRuleFromStyles(final MediaRule mediaRule, + final Styles styles) { + + Objects.requireNonNull(styles); + Objects.requireNonNull(mediaRule); + + styles.removeMediaRule(mediaRule); + stylesRepo.saveStyles(styles); + stylesRepo.deleteMediaRule(mediaRule); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void addRuleToMediaRule(final Rule rule, final MediaRule mediaRule) { + + Objects.requireNonNull(rule); + Objects.requireNonNull(mediaRule); + + mediaRule.addRule(rule); + stylesRepo.saveMediaRule(mediaRule); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void removeRuleFromMediaRule(final Rule rule, + final MediaRule mediaRule) { + + Objects.requireNonNull(rule); + Objects.requireNonNull(mediaRule); + + mediaRule.removeRule(rule); + stylesRepo.saveMediaRule(mediaRule); + stylesRepo.deleteRule(rule); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void addRuleToStyles(final Rule rule, final Styles styles) { + + Objects.requireNonNull(rule); + Objects.requireNonNull(styles); + + styles.addRule(rule); + stylesRepo.saveStyles(styles); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void removeRuleFromStyles(final Rule rule, final Styles styles) { + + Objects.requireNonNull(rule); + Objects.requireNonNull(styles); + + styles.removeRule(rule); + stylesRepo.deleteRule(rule); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesRepository.java b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesRepository.java new file mode 100644 index 000000000..596de2f90 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/pagemodel/styles/StylesRepository.java @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2018 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.pagemodel.styles; + +import org.libreccm.core.CoreConstants; +import org.libreccm.security.AuthorizationRequired; +import org.libreccm.security.RequiresPrivilege; + +import java.io.Serializable; +import java.util.Objects; + +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; +import javax.persistence.EntityManager; +import javax.transaction.Transactional; + +/** + * + * @author Jens Pelzetter + */ +@RequestScoped +public class StylesRepository implements Serializable { + + private static final long serialVersionUID = 8350984709496516542L; + + @Inject + private EntityManager entityManager; + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void saveCssProperty(final CssProperty cssProperty) { + + Objects.requireNonNull(cssProperty); + + if (cssProperty.getPropertyId() == 0) { + entityManager.persist(cssProperty); + } else { + entityManager.merge(cssProperty); + } + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteCssProperty(final CssProperty cssProperty) { + + Objects.requireNonNull(cssProperty); + + entityManager.remove(cssProperty); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void saveMediaQuery(final MediaQuery mediaQuery) { + + Objects.requireNonNull(mediaQuery); + + if (mediaQuery.getMediaQueryId() == 0) { + entityManager.persist(mediaQuery); + } else { + entityManager.merge(mediaQuery); + } + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteMediaQuery(final MediaQuery mediaQuery){ + + Objects.requireNonNull(mediaQuery); + + entityManager.remove(mediaQuery); + + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void saveMediaRule(final MediaRule mediaRule) { + + Objects.requireNonNull(mediaRule); + + if (mediaRule.getMediaRuleId() == 0) { + entityManager.persist(mediaRule); + } else { + entityManager.merge(mediaRule); + } + + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteMediaRule(final MediaRule mediaRule) { + + Objects.requireNonNull(mediaRule); + + entityManager.remove(mediaRule); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void saveRule(final Rule rule) { + + Objects.requireNonNull(rule); + + if (rule.getRuleId() == 0) { + entityManager.persist(rule); + } else { + entityManager.merge(rule); + } + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteRule(final Rule rule) { + + Objects.requireNonNull(rule); + + entityManager.remove(rule); + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void saveStyles(final Styles styles) { + + Objects.requireNonNull(styles); + + if (styles.getStyleId() == 0) { + entityManager.persist(styles); + } else { + entityManager.merge(styles); + } + } + + @Transactional(Transactional.TxType.REQUIRED) + @AuthorizationRequired + @RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN) + public void deleteStyles(final Styles styles) { + + Objects.requireNonNull(styles); + + entityManager.remove(styles); + + } + +} diff --git a/ccm-docrepo/pom.xml.releaseBackup b/ccm-docrepo/pom.xml.releaseBackup new file mode 100644 index 000000000..840aa8e69 --- /dev/null +++ b/ccm-docrepo/pom.xml.releaseBackup @@ -0,0 +1,637 @@ + + + 4.0.0 + + + UTF-8 + + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-docrepo + 7.0.0-SNAPSHOT + + LibreCCM DocRepo + + http://www.libreccm.org/moudles/ccm-docrepo + + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-validator + provided + + + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + + org.apache.shiro + shiro-core + + + org.apache.shiro + shiro-web + + + + junit + junit + 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-docrepo + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + src/main/resources/persistence-build.xml + true + + + + + gen-ddl + + process-classes + + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + + license + + + + + + false + + + + + + + + + wildfly-managed-h2-mem + + + org.wildfly + wildfly-arquillian-container-managed + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-managed-pgsql + + + org.wildfly + wildfly-arquillian-container-managed + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-remote-h2-mem + + + org.wildfly + wildfly-arquillian-container-remote + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-remote-pgsql + + + org.wildfly + wildfly-arquillian-container-remote + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + + diff --git a/ccm-editor/pom.xml.releaseBackup b/ccm-editor/pom.xml.releaseBackup new file mode 100644 index 000000000..145ba133d --- /dev/null +++ b/ccm-editor/pom.xml.releaseBackup @@ -0,0 +1,81 @@ + + + + 4.0.0 + + + UTF-8 + ${maven.build.timestamp} + yyyy-MM-dd'T'HH:mm:ss'Z'Z + + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-editor + 7.0.0-SNAPSHOT + jar + + LibreCCM Editor + + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + + + ccm-editor + + + + src/main/resources + + + src/main/typescript + + + + + + com.github.eirslett + frontend-maven-plugin + + + + Install node.js and NPM + + install-node-and-npm + + + v6.12.3 + + + + npm install + + npm + + + + grunt build + + grunt + + + + + + + + + + diff --git a/ccm-shortcuts/pom.xml.releaseBackup b/ccm-shortcuts/pom.xml.releaseBackup new file mode 100644 index 000000000..ba248afff --- /dev/null +++ b/ccm-shortcuts/pom.xml.releaseBackup @@ -0,0 +1,709 @@ + + + 4.0.0 + + + UTF-8 + ${maven.build.timestamp} + yyyy-MM-dd'T'HH:mm:ss'Z'Z + + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-shortcuts + + + LibreCCM Shortcuts + + http://www.libreccm.org/modules/ccm-shortcuts + + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.hibernate + hibernate-entitymanager + provided + + + + org.hibernate + hibernate-envers + provided + + + + org.hibernate + hibernate-validator + provided + + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + + org.apache.shiro + shiro-core + + + org.apache.shiro + shiro-web + + + + 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-shortcuts + + + + src/main/resources + true + + + + + + src/test/resources + + + ${project.build.directory}/generated-resources + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + false + + + + + org.jacoco + jacoco-maven-plugin + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.5 + + + com.github.spotbugs + spotbugs-maven-plugin + 3.1.0-RC8 + + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + + license + + + + + + false + + + + + + + + wildfly-managed-h2-mem + + + org.wildfly + wildfly-arquillian-container-managed + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + 1.0.0.Alpha8 + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + + false + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-managed-pgsql + + + org.wildfly + wildfly-arquillian-container-managed + + test + + + org.jacoco + org.jacoco.core + + test + + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + + false + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-remote-h2-mem + + + org.wildfly + wildfly-arquillian-container-remote + test + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + org.jacoco + org.jacoco.core + test + + + org.jboss.arquillian.extension + arquillian-jacoco + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-h2-mem + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + + false + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + wildfly-remote-pgsql + + + org.wildfly + wildfly-arquillian-container-remote + + test + + + org.jacoco + org.jacoco.core + + test + + + + net.sf.saxon + Saxon-HE + + + + + + + src/test/resources + + + src/test/resources-wildfly-remote-pgsql + + + ${project.build.directory}/generated-resources + + + + + + de.jpdigital + hibernate50-ddl-maven-plugin + + + h2 + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + org.apache.maven.plugins + maven-surefire-plugin + + always + 999 + true + + org.jboss.logmanager.LogManager + + + false + false + + org.libreccm.tests.categories.UnitTest, + org.libreccm.tests.categories.IntegrationTest + + + + + + + + + diff --git a/ccm-testutils/pom.xml.releaseBackup b/ccm-testutils/pom.xml.releaseBackup new file mode 100644 index 000000000..366c2b6cd --- /dev/null +++ b/ccm-testutils/pom.xml.releaseBackup @@ -0,0 +1,211 @@ + + + 4.0.0 + + + UTF-8 + + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-testutils + + + LibreCCM Test Utilities + http://www.libreccm.org/modules/ccm-testutils + + + + junit + junit + + + + org.hamcrest + hamcrest-core + + + org.hamcrest + hamcrest-library + + + + nl.jqno.equalsverifier + equalsverifier + + + + com.h2database + h2 + + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + + + + net.sourceforge.findbugs + annotations + provided + + + + org.jboss.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + + + + + + ccm-testutils + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.4.1 + + + enforce-maven + + enforce + + + + + 3.3.1 + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /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/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.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + + license + + + + + + false + + + + + + diff --git a/ccm-theme-foundry/pom.xml.releaseBackup b/ccm-theme-foundry/pom.xml.releaseBackup new file mode 100644 index 000000000..4faeee8b3 --- /dev/null +++ b/ccm-theme-foundry/pom.xml.releaseBackup @@ -0,0 +1,39 @@ + + + + 4.0.0 + + + UTF-8 + ${maven.build.timestamp} + yyyy-MM-dd'T'HH:mm:ss'Z'Z + + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm + ccm-theme-foundry + 7.0.0-SNAPSHOT + jar + + LibreCCM Foundry Theming Engine + + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + + + ccm-theme-foundry + + + diff --git a/ccm-xafilesystemadapter/pom.xml.releaseBackup b/ccm-xafilesystemadapter/pom.xml.releaseBackup new file mode 100644 index 000000000..0fb8a1844 --- /dev/null +++ b/ccm-xafilesystemadapter/pom.xml.releaseBackup @@ -0,0 +1,236 @@ + + + + 4.0.0 + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + + + org.libreccm.files + ccm-xafilesystemadapter + 1.0.0-SNAPSHOT + + ccm-xafilesystemadapter + + + + Lesser GPL 2.1 + http://www.gnu.org/licenses/old-licenses/lgpl-2.1 + + + + + UTF-8 + ${maven.build.timestamp} + yyyy-MM-dd'T'HH:mm:ss'Z'Z + + + + + + javax + javaee-api + + + + + org.libreccm + ccm-core + 7.0.0-SNAPSHOT + provided + + + + net.java.xadisk + xadisk + provided + + + + junit + junit + test + + + + + ccm-xafilesystemadapter + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-maven-version + + enforce + + + + + 1.8.0 + + + 3.3 + + + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-surefire-plugin + + org.libreccm.tests.categories.UnitTest + false + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + 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.20 + + false + + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.4 + + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/java/basic.xml + /rulesets/java/braces.xml + /rulesets/java/clone.xml + /rulesets/java/codesize.xml + /rulesets/java/design.xml + /rulesets/java/empty.xml + /rulesets/java/finalizers.xml + /rulesets/java/imports.xml + /rulesets/java/junit.xml + /rulesets/java/naming.xml + /rulesets/java/optimizations.xml + /rulesets/java/strictexception.xml + /rulesets/java/strings.xml + /rulesets/java/sunsecure.xml + /rulesets/java/typeresolution.xml + /rulesets/java/unnecessary.xml + /rulesets/java/unusedcode.xml + + + + + org.codehaus.mojo + jdepend-maven-plugin + 2.0 + + + org.codehaus.mojo + taglist-maven-plugin + 2.4 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + dependencies + + license + + + + + + false + + + + + + diff --git a/pom.xml.releaseBackup b/pom.xml.releaseBackup new file mode 100644 index 000000000..7e060b929 --- /dev/null +++ b/pom.xml.releaseBackup @@ -0,0 +1,777 @@ + + + + 4.0.0 + + + UTF-8 + + + + + 3.3.1 + + + org.libreccm + libreccm-parent + 7.0.0-SNAPSHOT + pom + + LibreCCM + http://www.libreccm.org + + + libreccm-site + LibreCCM + http://www.libreccm.org/project-sites/ + + + + + LibreCCM Foundation + + + + + LGPLv2 or newer + http://www.gnu.org/licenses/lgpl-2.0.html + + + + + scm:svn:https://svn.libreccm.org/ccm/ccm_ng + + + + + + ccm-core + + + ccm-testutils + ccm-xafilesystemadapter + + + ccm-editor + + + ccm-cms + + ccm-cms-types-agenda + ccm-cms-types-bookmark + ccm-cms-types-decisiontree + ccm-cms-types-externallink + ccm-cms-types-faqitem + ccm-cms-types-glossaryitem + ccm-cms-types-minutes + + + ccm-docrepo + ccm-shortcuts + + + ccm-theme-foundry + + + ccm-bundle-devel + ccm-bundle-devel-wildfly-web + ccm-bundle-devel-wildfly + ccm-bundle-devel-wildfly-swarm + + + ccm-archetype-module + ccm-cms-archetype-contenttype + + + + true + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + + summary + license + scm + dependency-management + plugin-management + + + + + + org.codehaus.mojo + versions-maven-plugin + 2.4 + + file:///${session.executionRootDirectory}/maven-version-rules.xml + + + + + dependency-updates-report + plugin-updates-report + property-updates-report + + + + + + + + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.1.0 + + + org.apache.maven.plugins + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + true + true + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-ear-plugin + 2.10.1 + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.0-M1 + + + org.apache.maven.plugins + maven-pmd-plugin + 3.8 + + true + utf-8 + 1.8 + + /rulesets/basic.xml + /rulesets/braces.xml + /rulesets/codesize.xml + /rulesets/clone.xml + /rulesets/coupling.xml + /rulesets/design.xml + /rulesets/finalizers.xml + /rulesets/imports.xml + /rulesets/javabeans.xml + /rulesets/junit.xml + /rulesets/naming.xml + /rulesets/optimizations.xml + /rulesets/strictexception.xml + /rulesets/strings.xml + /rulesets/sunsecure.xml + /rulesets/unusedcode.xml + + + + + package + + pmd + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.9 + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20.1 + + + org.apache.maven.plugins + maven-site-plugin + 3.6 + + + org.apache.maven.plugins + maven-war-plugin + 3.2.0 + + + + + com.github.eirslett + frontend-maven-plugin + 1.6 + + + com.github.spotbugs + spotbugs-maven-plugin + 3.1.0-RC8 + + true + true + + + + package + + findbugs + + + + + + com.vaadin + vaadin-maven-plugin + 8.1.7 + + + de.jpdigital + hibernate50-ddl-maven-plugin + 2.1.0 + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + org.codehaus.mojo + findbugs-maven-plugin + 3.0.5 + + true + true + + + + package + + findbugs + + + + + + org.codehaus.mojo + versions-maven-plugin + 2.5 + + + org.jacoco + jacoco-maven-plugin + 0.7.9 + + + org.wildfly.plugins + wildfly-maven-plugin + 1.2.1.Final + + + org.wildfly.swarm + wildfly-swarm-plugin + 2017.11.0 + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-maven-version + + enforce + + + + + 1.8.0 + + + 3.3.1 + + + + + + + + + org.wildfly.plugins + wildfly-maven-plugin + + true + + + + + org.codehaus.mojo + versions-maven-plugin + + file:///${session.executionRootDirectory}/maven-version-rules.xml + + + + + org.apache.maven.plugins + maven-release-plugin + + true + https://svn.libreccm.org/ccm/ccm_ng-releases + + + + + + + + + + + javax + javaee-api + 7.0 + + + + + org.hibernate + hibernate-entitymanager + 5.0.10.Final + + + + + org.hibernate + hibernate-envers + 5.0.10.Final + + + + + org.hibernate + hibernate-validator + 5.4.1.Final + + + org.hibernate + hibernate-validator-cdi + 5.4.1.Final + + + javax.el + javax.el-api + 3.0.0 + + + org.glassfish + javax.el + 3.0.1-b08 + + + + + org.hibernate + hibernate-search-orm + 5.5.4.Final + + + + + org.flywaydb + flyway-core + 4.0.3 + + + + + org.apache.shiro + shiro-core + 1.2.5 + + + org.apache.shiro + shiro-web + 1.3.2 + + + + + org.primefaces + primefaces + 6.1 + + + + + + com.vaadin + vaadin-bom + 8.1.7 + import + pom + + + + + + + + + + org.apache.logging.log4j + log4j-bom + 2.9.1 + pom + import + + + + + org.apache.lucene + lucene-core + 2.4.1 + + + + org.apache.pdfbox + pdfbox + 1.4.0 + + + + + + commons-beanutils + commons-beanutils + 1.9.3 + + + commons-cli + commons-cli + 1.4 + + + commons-codec + commons-codec + 1.10 + + + commons-collections + commons-collections + 3.2.2 + + + commons-fileupload + commons-fileupload + 1.3.3 + + + commons-httpclient + commons-httpclient + 3.1 + + + commons-io + commons-io + 2.5 + + + commons-lang + commons-lang + 2.6 + + + commons-logging + commons-logging + 1.2 + + + commons-primitives + commons-primitives + 1.0 + + + + + org.glassfish + javax.json + 1.1.2 + + + + net.sf.saxon + Saxon-HE + 9.8.0-5 + + + + org.bouncycastle + bcmail-jdk16 + 1.46 + + + + org.imgscalr + imgscalr-lib + 4.2 + + + + org.jsoup + jsoup + 1.10.3 + + + + org.apache.maven + maven-artifact + 3.3.9 + + + + net.sf.jtidy + jtidy + r938 + + + + oro + oro + 2.0.8 + + + + org.bouncycastle + bcprov-jdk16 + 1.46 + + + + poi + poi-2.5-final + 20040302 + + + + net.java.xadisk + xadisk + 1.2.2 + + + + net.sourceforge.findbugs + annotations + 1.3.2 + + + + xml-resolver + xml-resolver + 1.2 + + + + com.fasterxml.jackson + jackson-bom + 2.9.0 + import + pom + + + + + org.codehaus.woodstox + woodstox-core-asl + 4.4.1 + + + + + + junit + junit + 4.12 + + + + + org.jboss.arquillian + arquillian-bom + 1.1.12.Final + import + pom + + + org.jboss.arquillian.extension + arquillian-transaction-bom + 1.0.3.Final + pom + import + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + 1.0.0.Alpha7 + + + org.jboss.arquillian.extension + arquillian-jacoco + 1.0.0.Alpha9 + + + org.wildfly + wildfly-arquillian-container-managed + 8.2.1.Final + test + + + org.wildfly.arquillian + wildfly-arquillian-container-managed + 2.0.2.Final + test + + + org.wildfly + wildfly-arquillian-container-remote + 8.2.1.Final + test + + + + + org.jacoco + org.jacoco.core + 0.7.9 + test + + + + + org.hamcrest + hamcrest-core + 1.3 + + + org.hamcrest + hamcrest-library + 1.3 + test + + + + + nl.jqno.equalsverifier + equalsverifier + + 2.2 + + + + + com.h2database + h2 + 1.4.196 + + + + + + diff --git a/release.properties b/release.properties new file mode 100644 index 000000000..b2c12f131 --- /dev/null +++ b/release.properties @@ -0,0 +1,80 @@ +#release configuration +#Fri Feb 02 16:41:34 CET 2018 +project.scm.org.libreccm\:libreccm-parent.tag=HEAD +project.scm.org.librecms\:ccm-cms.empty=true +project.dev.org.librecms\:ccm-cms-types-minutes=7.0.0-SNAPSHOT +project.rel.org.libreccm\:ccm-bundle-devel-wildfly=7.0.0-alpha.1 +scm.commentPrefix=[maven-release-plugin] +project.rel.org.librecms\:ccm-cms-types-bookmark=7.0.0-alpha.1 +project.dev.org.libreccm\:ccm-bundle-devel=7.0.0-SNAPSHOT +project.scm.org.libreccm\:ccm-bundle-devel.empty=true +project.rel.org.librecms\:ccm-cms-types-decisiontree=7.0.0-alpha.1 +project.scm.org.libreccm\:ccm-shortcuts.empty=true +project.rel.org.librecms\:ccm-cms-types-glossaryitem=7.0.0-alpha.1 +pushChanges=true +project.rel.org.libreccm\:ccm-theme-foundry=7.0.0-alpha.1 +project.scm.org.libreccm\:ccm-archetype-module.empty=true +projectVersionPolicyId=default +exec.snapshotReleasePluginAllowed=false +project.dev.org.libreccm\:ccm-bundle-devel-wildfly-web=7.0.0-SNAPSHOT +project.rel.org.librecms\:ccm-cms-types-agenda=7.0.0-alpha.1 +project.dev.org.librecms\:ccm-cms-types-faqitem=7.0.0-SNAPSHOT +project.rel.org.libreccm\:ccm-core=7.0.0-alpha.1 +project.scm.org.libreccm\:ccm-editor.empty=true +project.scm.org.libreccm.files\:ccm-xafilesystemadapter.empty=true +project.dev.org.libreccm\:ccm-archetype-module=7.0.0-SNAPSHOT +project.scm.org.librecms\:ccm-cms-types-bookmark.empty=true +completedPhase=end-release +project.rel.org.librecms\:ccm-cms=7.0.0-alpha.1 +project.rel.org.librecms\:ccm-cms-types-minutes=7.0.0-alpha.1 +remoteTagging=true +project.scm.org.libreccm\:ccm-testutils.empty=true +project.dev.org.librecms\:ccm-cms-archetype-contenttype=7.0.0-SNAPSHOT +project.dev.org.librecms\:ccm-cms=7.0.0-SNAPSHOT +project.dev.org.libreccm\:ccm-shortcuts=7.0.0-SNAPSHOT +project.rel.org.librecms\:ccm-cms-types-externallink=7.0.0-alpha.1 +project.rel.org.libreccm\:ccm-bundle-devel-wildfly-web=7.0.0-alpha.1 +project.dev.org.libreccm\:ccm-bundle-devel-wildfly=7.0.0-SNAPSHOT +project.rel.org.libreccm\:ccm-docrepo=7.0.0-alpha.1 +project.rel.org.libreccm\:ccm-bundle-devel-wildfly-swarm=7.0.0-alpha.1 +project.dev.org.librecms\:ccm-cms-types-glossaryitem=7.0.0-SNAPSHOT +project.rel.org.librecms\:ccm-cms-types-faqitem=7.0.0-alpha.1 +project.dev.org.libreccm\:ccm-core=7.0.0-SNAPSHOT +project.dev.org.libreccm\:ccm-bundle-devel-wildfly-swarm=7.0.0-SNAPSHOT +project.scm.org.libreccm\:ccm-bundle-devel-wildfly.empty=true +project.rel.org.librecms\:ccm-cms-archetype-contenttype=7.0.0-alpha.1 +project.scm.org.librecms\:ccm-cms-types-agenda.empty=true +project.rel.org.libreccm\:ccm-testutils=7.0.0-alpha.1 +project.scm.org.librecms\:ccm-cms-types-minutes.empty=true +project.scm.org.librecms\:ccm-cms-archetype-contenttype.empty=true +project.scm.org.libreccm\:ccm-bundle-devel-wildfly-web.empty=true +project.dev.org.librecms\:ccm-cms-types-decisiontree=7.0.0-SNAPSHOT +project.scm.org.librecms\:ccm-cms-types-glossaryitem.empty=true +project.dev.org.libreccm\:ccm-theme-foundry=7.0.0-SNAPSHOT +project.rel.org.libreccm\:ccm-archetype-module=7.0.0-alpha.1 +project.scm.org.libreccm\:ccm-docrepo.empty=true +preparationGoals=clean verify +project.rel.org.libreccm\:ccm-bundle-devel=7.0.0-alpha.1 +project.dev.org.librecms\:ccm-cms-types-bookmark=7.0.0-SNAPSHOT +project.scm.org.libreccm\:ccm-theme-foundry.empty=true +project.scm.org.librecms\:ccm-cms-types-decisiontree.empty=true +project.scm.org.librecms\:ccm-cms-types-faqitem.empty=true +scm.tag=libreccm-7.0.0-alpha.1 +project.dev.org.librecms\:ccm-cms-types-externallink=7.0.0-SNAPSHOT +project.scm.org.libreccm\:ccm-core.empty=true +scm.tagNameFormat=@{project.artifactId}-@{project.version} +project.dev.org.libreccm\:ccm-editor=7.0.0-SNAPSHOT +project.dev.org.libreccm\:libreccm-parent=7.0.0-SNAPSHOT +project.scm.org.libreccm\:ccm-bundle-devel-wildfly-swarm.empty=true +project.scm.org.librecms\:ccm-cms-types-externallink.empty=true +project.dev.org.libreccm.files\:ccm-xafilesystemadapter=7.0.0-SNAPSHOT +scm.tagBase=https\://svn.libreccm.org/ccm/ccm_ng-releases +project.dev.org.librecms\:ccm-cms-types-agenda=7.0.0-SNAPSHOT +project.dev.org.libreccm\:ccm-testutils=7.0.0-SNAPSHOT +project.dev.org.libreccm\:ccm-docrepo=7.0.0-SNAPSHOT +project.rel.org.libreccm\:ccm-shortcuts=7.0.0-alpha.1 +scm.url=scm\:svn\:https\://svn.libreccm.org/ccm/ccm_ng +project.scm.org.libreccm\:libreccm-parent.developerConnection=scm\:svn\:https\://svn.libreccm.org/ccm/ccm_ng +project.rel.org.libreccm\:libreccm-parent=7.0.0-alpha.1 +project.rel.org.libreccm.files\:ccm-xafilesystemadapter=7.0.0-alpha.1 +project.rel.org.libreccm\:ccm-editor=7.0.0-alpha.1