diff --git a/ccm-core/pom.xml b/ccm-core/pom.xml
index a97ced0c4..ab9a1f04c 100644
--- a/ccm-core/pom.xml
+++ b/ccm-core/pom.xml
@@ -59,7 +59,208 @@
hamcrest-library
test
-
+
+ ccm-core
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.3
+
+ 1.7
+ 1.7
+ true
+ true
+ ${project.build.sourceEncoding}
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.18.1
+
+ de.jpdigital.research.accessibilitystudy.tests.UnitTest
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.7.4.201502262128
+
+
+ default-prepare-agent
+
+ prepare-agent
+
+
+
+ default-report
+ prepare-package
+
+ report
+
+
+
+ default-check
+
+ check
+
+
+
+
+ BUNDLE
+
+
+ COMPLEXITY
+ COVEREDRATIO
+ 0.60
+
+
+
+
+
+
+
+
+
+ de.jpdigital
+ hibernate4-ddl-maven-plugin
+
+
+ h2
+ mysql5_innodb
+ postgresql9
+
+
+ de.jpdigital.webpagebuilder2.data
+
+ true
+
+
+
+
+ gen-ddl
+
+ process-classes
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.10.2
+
+ true
+ true
+
+ http://docs.oracle.com/javase/7/docs/api/
+ http://docs.oracle.com/javaee/7/api/
+ http://docs.jboss.org/hibernate/orm/4.3/javadocs/
+
+ private
+ true
+ UTF-8
+ UTF-8
+ UTF-8
+ true
+ true
+ true
+ true
+ false
+ org.jboss.apiviz.APIviz
+
+ org.jboss.apiviz
+ apiviz
+ 1.3.2.GA
+
+ true
+
+ -sourceclasspath ${project.build.outputDirectory}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 2.5
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ 2.18.1
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.7.4.201502262128
+
+
+ org.codehaus.mojo
+ findbugs-maven-plugin
+ 3.0.1
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.4
+
+ true
+ utf-8
+ 1.7
+
+ /rulesets/java/basic.xml
+ /rulesets/java/braces.xml
+ /rulesets/java/clone.xml
+ /rulesets/java/codesize.xml
+ /rulesets/java/design.xml
+ /rulesets/java/empty.xml
+ /rulesets/java/finalizers.xml
+ /rulesets/java/imports.xml
+ /rulesets/java/javabeans.xml
+ /rulesets/java/junit.xml
+ /rulesets/java/naming.xml
+ /rulesets/java/optimizations.xml
+ /rulesets/java/strictexception.xml
+ /rulesets/java/strings.xml
+ /rulesets/java/sunsecure.xml
+ /rulesets/java/typeresolution.xml
+ /rulesets/java/unnecessary.xml
+ /rulesets/java/unusedcode.xml
+
+
+
+
+ org.codehaus.mojo
+ javancss-maven-plugin
+ 2.1
+
+
+ org.apache.maven.plugins
+ maven-project-info-reports-plugin
+ 2.8
+
+
+
+
+ license
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java b/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java
new file mode 100644
index 000000000..395a7973d
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2015 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.libreccm.categorization;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.libreccm.core.CcmObject;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@Entity
+@Table(name = "categorizations")
+public class Categorization implements Serializable {
+
+ private static final long serialVersionUID = 201504301320L;
+
+ @Id
+ @Column(name = "categorization_id")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private long categorizationId;
+
+ @ManyToOne
+ private Category category;
+
+ @ManyToOne
+ private CcmObject categorizedObject;
+
+ @Column(name = "category_order")
+ private long categoryOrder;
+
+ @Column(name = "object_order")
+ private long objectOrder;
+
+
+
+}
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Category.java b/ccm-core/src/main/java/org/libreccm/categorization/Category.java
index 022a81e4d..7ef3ed7f4 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Category.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Category.java
@@ -21,9 +21,16 @@ package org.libreccm.categorization;
import org.libreccm.core.CcmObject;
import java.io.Serializable;
+import java.util.List;
+import javax.persistence.AssociationOverride;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
import javax.persistence.Table;
+import org.libreccm.l10n.LocalizedString;
/**
*
@@ -35,4 +42,43 @@ public class Category extends CcmObject implements Serializable {
private static final long serialVersionUID = -7250208963391878547L;
+ @Column(name = "unique_id", nullable = false)
+ private String uniqueId;
+
+ @Column(name = "name", nullable = false)
+ private String name;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "category_titles",
+ joinColumns = {
+ @JoinColumn(name = "object_id")}
+ ))
+ private LocalizedString title;
+
+ @Embedded
+ @AssociationOverride(
+ name = "values",
+ joinTable = @JoinTable(name = "category_descriptions",
+ joinColumns = {
+ @JoinColumn(name = "object_id")}
+ ))
+ private LocalizedString description;
+
+ @Column(name = "enabled")
+ private boolean enabled;
+
+ @Column(name = "visible")
+ private boolean visible;
+
+ @Column(name = "abstract_category")
+ private boolean abstractCategory;
+
+
+ private List owners;
+ private List objects;
+ private List subCategories;
+ private Category parentCategory;
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
index 833f179c4..8ea2ec894 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
@@ -56,7 +56,7 @@ public class Domain extends CcmObject implements Serializable {
@Embedded
@AssociationOverride(
name = "values",
- joinTable = @JoinTable(name = "category_titles",
+ joinTable = @JoinTable(name = "domain_titles",
joinColumns = {
@JoinColumn(name = "object_id")}))
private LocalizedString title;
@@ -64,7 +64,7 @@ public class Domain extends CcmObject implements Serializable {
@Embedded
@AssociationOverride(
name = "values",
- joinTable = @JoinTable(name = "category_descriptions",
+ joinTable = @JoinTable(name = "domain_descriptions",
joinColumns = {
@JoinColumn(name = "object_id")}))
private LocalizedString description;
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnership.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnership.java
new file mode 100644
index 000000000..5503ceac7
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnership.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright (C) 2015 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.libreccm.categorization;
+
+import java.io.Serializable;
+import java.util.Objects;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import org.libreccm.core.CcmObject;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+@Entity
+@Table(name = "domain_ownerships;")
+public class DomainOwnership implements Serializable {
+
+ private static final long serialVersionUID = 201504301305L;
+
+ @Id
+ @Column(name = "ownership_id")
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ private long ownershipId;
+
+ @ManyToOne(optional = false)
+ private CcmObject owner;
+
+ @ManyToOne(optional = false)
+ private Domain domain;
+
+ @Column(name = "context")
+ private String context;
+
+ @Column(name = "owner_order")
+ private long ownerOrder;
+
+ @Column(name = "domain_order")
+ private long domainOrder;
+
+ public long getOwnershipId() {
+ return ownershipId;
+ }
+
+ public void setOwnershipId(final long ownershipId) {
+ this.ownershipId = ownershipId;
+ }
+
+ public CcmObject getOwner() {
+ return owner;
+ }
+
+ protected void setOwner(final CcmObject owner) {
+ this.owner = owner;
+ }
+
+ public Domain getDomain() {
+ return domain;
+ }
+
+ protected void setDomain(final Domain domain) {
+ this.domain = domain;
+ }
+
+ public String getContext() {
+ return context;
+ }
+
+ public void setContext(final String context) {
+ this.context = context;
+ }
+
+ public long getDomainOrder() {
+ return domainOrder;
+ }
+
+ public void setDomainOrder(final long domainOrder) {
+ this.domainOrder = domainOrder;
+ }
+
+ public long getOwnerOrder() {
+ return ownerOrder;
+ }
+
+ public void setOwnerOrder(final long ownerOrder) {
+ this.ownerOrder = ownerOrder;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 59 * hash + (int) (ownershipId ^ (ownershipId >>> 32));
+ hash = 59 * hash + Objects.hashCode(owner);
+ hash = 59 * hash + Objects.hashCode(domain);
+ hash = 59 * hash + Objects.hashCode(context);
+ hash = 59 * hash + (int) (domainOrder ^ (domainOrder >>> 32));
+ hash = 59 * hash + (int) (ownerOrder ^ (ownerOrder >>> 32));
+ return hash;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DomainOwnership other = (DomainOwnership) obj;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+
+ if (ownershipId != other.getOwnershipId()) {
+ return false;
+ }
+ if (!Objects.equals(owner, other.getOwner())) {
+ return false;
+ }
+ if (!Objects.equals(domain, other.getDomain())) {
+ return false;
+ }
+ if (!Objects.equals(context, other.getContext())) {
+ return false;
+ }
+ if (domainOrder != other.getDomainOrder()) {
+ return false;
+ }
+
+ return ownerOrder == other.getOwnerOrder();
+ }
+
+ public boolean canEqual(final Object obj) {
+ return obj instanceof DomainOwnership;
+ }
+
+ @Override
+ public String toString() {
+ return toString("");
+ }
+
+ public String toString(final String data) {
+ return String.format("%s{ "
+ + "ownershipId = %d, "
+ + "owner = %s, "
+ + "domain = %s, "
+ + "context = \"%s\", "
+ + "domainOrder = %d"
+ + "ownerOrder = %d"
+ + "%s }",
+ super.toString(),
+ ownershipId,
+ owner.toString(),
+ domain.toString(),
+ context,
+ domainOrder,
+ ownerOrder,
+ data);
+ }
+}
diff --git a/ccm-core/src/main/java/org/libreccm/core/CcmObject.java b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java
index cbc099e1f..bebddf257 100644
--- a/ccm-core/src/main/java/org/libreccm/core/CcmObject.java
+++ b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java
@@ -32,7 +32,7 @@ import javax.persistence.Table;
/**
*
- * @author Jens Pelzetter jens@jp-digital.de
+ * @author Jens Pelzetter
*/
@Entity
@Table(name = "ccm_objects")
@@ -46,6 +46,7 @@ public class CcmObject implements Serializable {
@GeneratedValue(strategy = GenerationType.AUTO)
private long objectId;
+ @Column(name = "display_name")
private String displayName;
//private Map ownedCategories;
diff --git a/ccm-core/src/main/java/org/libreccm/jpautils/UriConverter.java b/ccm-core/src/main/java/org/libreccm/jpautils/UriConverter.java
new file mode 100644
index 000000000..9001a01f9
--- /dev/null
+++ b/ccm-core/src/main/java/org/libreccm/jpautils/UriConverter.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2015 LibreCCM Foundation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+package org.libreccm.jpautils;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+/**
+ * A converter for converting URI properties to String. JPA does not support
+ * URI as type and will store them as LOBs without this converter. The converter
+ * is automatically applied to all URI properties.
+ *
+ * @author Jens Pelzetter
+ */
+@Converter(autoApply = true)
+public class UriConverter implements AttributeConverter {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param attribute {@inheritDoc}
+ * @return {@inheritDoc}
+ */
+ @Override
+ public String convertToDatabaseColumn(final URI attribute) {
+ return attribute.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param dbData {@inheritDoc}
+ * @return {@inheritDoc}
+ */
+ @Override
+ public URI convertToEntityAttribute(final String dbData) {
+ try {
+ return new URI(dbData);
+ } catch (URISyntaxException ex) {
+ throw new IllegalArgumentException(
+ String.format("Failed to convert String value '%s' from "
+ + "database to an URI.",
+ dbData),
+ ex);
+ }
+ }
+
+}