commit a749e9d63b952ac2830aac91a296544dd6946ab8 Author: jensp Date: Sun Apr 26 18:08:49 2015 +0000 Initial checkin of JPA branch git-svn-id: https://svn.libreccm.org/ccm/jpa@3360 8810af33-2d31-482b-a856-94f89814c4df diff --git a/.svnignore b/.svnignore new file mode 100644 index 000000000..cf9144eaa --- /dev/null +++ b/.svnignore @@ -0,0 +1,2 @@ +nb-configuration.xml +target diff --git a/ccm-core/pom.xml b/ccm-core/pom.xml new file mode 100644 index 000000000..a97ced0c4 --- /dev/null +++ b/ccm-core/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + + UTF-8 + 3.0.0-SNAPSHOT + + + + org.libreccm + libreccm-parent + 3.0.0-SNAPSHOT + + + org.libreccm + ccm-core + 6.7.0-SNAPSHOT + + 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 + + + + junit + junit + test + + + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + + + + + \ No newline at end of file diff --git a/ccm-core/src/main/java/org/libreccm/core/CcmObject.java b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java new file mode 100644 index 000000000..5d7c25f3b --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/core/CcmObject.java @@ -0,0 +1,117 @@ +/* + * 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.core; + +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.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; + +/** + * + * @author Jens Pelzetter jens@jp-digital.de + */ +@Entity +@Table(name = "ccm_objects") +@Inheritance(strategy = InheritanceType.JOINED) +public class CcmObject implements Serializable { + + private static final long serialVersionUID = 201504261329L; + + @Id + @Column(name = "object_id") + @GeneratedValue(strategy = GenerationType.AUTO) + private long objectId; + + private String displayName; + + //private Map ownedCategories; + //private Map assignedCategories; + public long getObjectId() { + return objectId; + } + + public void setObjectId(long objectId) { + this.objectId = objectId; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 61 * hash + (int) (objectId ^ (objectId >>> 32)); + hash = 61 * hash + Objects.hashCode(displayName); + return hash; + } + + @Override + public boolean equals(final Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CcmObject other = (CcmObject) obj; + if (!other.canEqual(this)) { + return false; + } + + if (objectId != other.getObjectId()) { + return false; + } + return Objects.equals(displayName, other.getDisplayName()); + } + + public boolean canEqual(final Object obj) { + return obj instanceof CcmObject; + } + + @Override + public final String toString() { + return toString(""); + } + + public String toString(final String data) { + return String.format( + "%s{ " + + "objectId = %d; displayName = \"%s\"" + + "%s" + + " }", + super.toString(), + objectId, + displayName, + data); + } + +} diff --git a/ccm-core/src/main/java/org/libreccm/core/Resource.java b/ccm-core/src/main/java/org/libreccm/core/Resource.java new file mode 100644 index 000000000..f141ce936 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/core/Resource.java @@ -0,0 +1,47 @@ +/* + * 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.core; + +import java.io.Serializable; + +import javax.persistence.Entity; +import javax.persistence.Table; + +/** + * + * @author Jens Pelzetter jens@jp-digital.de + */ +@Entity +@Table(name = "resources") +public class Resource extends CcmObject implements Serializable { + + private static final long serialVersionUID = 201502291330L; + + private long resourceId; + + public long getResourceId() { + return resourceId; + } + + public void setResourceId(long resourceId) { + this.resourceId = resourceId; + } + + +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..698bfa7a1 --- /dev/null +++ b/pom.xml @@ -0,0 +1,394 @@ + + + + 4.0.0 + + + UTF-8 + 3.0.0-SNAPSHOT + + + org.libreccm + libreccm-parent + 3.0.0-SNAPSHOT + pom + + LibreCCM 3.0.0 + http://www.libreccm.org + + + LibreCCM Foundation + + + + + LPLv2 or newer + http://www.gnu.org/licenses/lgpl-2.0.html + + + + + ccm-core + + + + true + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.8 + + + + summary + license + scm + dependency-management + plugin-management + + + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + 1.7 + 1.7 + true + true + ${project.build.sourceEncoding} + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.3 + + + org.apache.maven.plugins + maven-jar-plugin + 2.6 + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + + org.apache.maven.plugins + maven-site-plugin + 3.4 + + + org.apache.maven.plugins + maven-pmd-plugin + 3.4 + + true + utf-8 + 1.6 + + /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.codehaus.mojo + findbugs-maven-plugin + 3.0.1 + + true + true + + + + package + + findbugs + + + + + + + + + + + + + + javax + javaee-api + 7.0 + + + + + org.hibernate + hibernate-entitymanager + 4.3.8.Final + + + + + org.hibernate + hibernate-envers + 4.3.8.Final + + + + + + + + + org.apache.logging.log4j + log4j-bom + 2.2 + pom + import + + + + + org.apache.lucene + lucene-core + 2.4.1 + + + + org.apache.pdfbox + pdfbox + 1.4.0 + + + + + + commons-beanutils + commons-beanutils + 1.9.2 + + + commons-cli + commons-cli + 1.2 + + + commons-codec + commons-codec + 1.10 + + + commons-collections + commons-collections + 3.2.1 + + + commons-fileupload + commons-fileupload + 1.3.1 + + + commons-httpclient + commons-httpclient + 3.1 + + + commons-io + commons-io + 2.4 + + + commons-lang + commons-lang + 2.6 + + + commons-logging + commons-logging + 1.2 + + + commons-primitives + commons-primitives + 1.0 + + + + + net.sf.saxon + Saxon-HE + 9.6.0-5 + + + + org.bouncycastle + bcmail-jdk16 + 1.46 + + + + + org.imgscalr + imgscalr-lib + 4.2 + + + + org.jsoup + jsoup + 1.8.2 + + + + oro + oro + 2.0.8 + + + + poi + poi-2.5-final + 20040302 + + + + xml-resolver + xml-resolver + 1.2 + + + + + + junit + junit + 4.12 + + + + + org.jboss.arquillian + arquillian-bom + 1.1.7.Final + import + pom + + + org.jboss.arquillian.extension + arquillian-transaction-bom + 1.0.1.Final + pom + import + + + org.jboss.arquillian.extension + arquillian-persistence-dbunit + 1.0.0.Alpha7 + + + + + + org.hamcrest + hamcrest-core + 1.3 + + + org.hamcrest + hamcrest-library + 1.3 + test + + + + + nl.jqno.equalsverifier + equalsverifier + 1.7.2 + + + + + +