From c909a644965716c9fa12ece4b291e9cf0c68fefd Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Sat, 23 Nov 2019 19:21:16 +0100 Subject: [PATCH] ProfileItem --- ccm-cms-profile/pom.xml | 314 ++++++++++++++++++ .../profilesite/ProfileSiteConstants.java | 20 ++ .../librecms/profilesite/ProfileSiteItem.java | 157 +++++++++ 3 files changed, 491 insertions(+) create mode 100644 ccm-cms-profile/pom.xml create mode 100644 ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteConstants.java create mode 100644 ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteItem.java diff --git a/ccm-cms-profile/pom.xml b/ccm-cms-profile/pom.xml new file mode 100644 index 000000000..5593e0d0c --- /dev/null +++ b/ccm-cms-profile/pom.xml @@ -0,0 +1,314 @@ + + + + + 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-profile + 7.0.0-SNAPSHOT + + LibreCMS Profile site + + + + javax + javaee-api + jar + provided + + + + org.libreccm + ccm-core + ${project.parent.version} + provided + + + + org.librecms + ccm-cms + ${project.parent.version} + provided + + + + org.hibernate + hibernate-core + 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.shrinkwrap.resolver + shrinkwrap-resolver-impl-maven + test + + + + com.h2database + h2 + test + + + + + + + ccm-cms-profile + + + + 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 + hibernate53-ddl-maven-plugin + + + h2 + oracle12c + postgresql9 + + + org.libreccm + + true + + + + + gen-ddl + + process-classes + + + + + + + + + src/main/resources + true + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + 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 + + + org.apache.maven.plugins + maven-surefire-report-plugin + + + org.jacoco + jacoco-maven-plugin + + + org.codehaus.mojo + findbugs-maven-plugin + + + + org.apache.maven.plugins + maven-pmd-plugin + + true + utf-8 + 1.8 + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + + dependencies + licenses + + + + + false + + + + + + + + + + diff --git a/ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteConstants.java b/ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteConstants.java new file mode 100644 index 000000000..695e2e2e2 --- /dev/null +++ b/ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteConstants.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.librecms.profilesite; + +/** + * + * @author Jens Pelzetter + */ +public class ProfileSiteConstants { + + public static final String DB_SCHEMA = "cms_profile"; + + private ProfileSiteConstants() { + // Nothing + } + +} diff --git a/ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteItem.java b/ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteItem.java new file mode 100644 index 000000000..9bba81913 --- /dev/null +++ b/ccm-cms-profile/src/main/java/org/librecms/profilesite/ProfileSiteItem.java @@ -0,0 +1,157 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.librecms.profilesite; + +import org.hibernate.annotations.Type; +import org.librecms.assets.Person; +import org.librecms.contentsection.ContentItem; + +import java.util.Objects; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +import static org.librecms.profilesite.ProfileSiteConstants.*; + +/** + * + * @author Jens Pelzetter + */ +@Entity +@Table(name = "PROFILE_SITES", schema = DB_SCHEMA) +public class ProfileSiteItem extends ContentItem { + + private static final long serialVersionUID = 1L; + + @OneToOne + @JoinColumn(name = "OWNER_ID") + private Person owner; + + @Column(name = "POSITION") + @Basic + @Lob + @Type(type = "org.hibernate.type.TextType") + private String position; + + @Column(name = "INTERESTS") + @Basic + @Lob + @Type(type = "org.hibernate.type.TextType") + private String interests; + + @Column(name = "MISC") + @Basic + @Lob + @Type(type = "org.hibernate.type.TextType") + private String misc; + + public Person getOwner() { + return owner; + } + + public void setOwner(final Person owner) { + this.owner = owner; + } + + public String getPosition() { + return position; + } + + public void setPosition(final String position) { + this.position = position; + } + + public String getInterests() { + return interests; + } + + public void setInterests(final String interests) { + this.interests = interests; + } + + public String getMisc() { + return misc; + } + + public void setMisc(final String misc) { + this.misc = misc; + } + + @Override + public int hashCode() { + int hash = super.hashCode(); + if (owner != null) { + hash = 37 * hash + Objects.hashCode(owner.getUuid()); + } + hash = 37 * hash + Objects.hashCode(position); + hash = 37 * hash + Objects.hashCode(interests); + hash = 37 * hash + Objects.hashCode(misc); + return hash; + } + + @Override + public boolean equals(final Object obj) { + if (!super.equals(obj)) { + return false; + } + + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ProfileSiteItem)) { + return false; + } + final ProfileSiteItem other = (ProfileSiteItem) obj; + if (!other.canEqual(this)) { + return false; + } + if (owner != null + && other.getOwner() != null + && !Objects.equals( + owner.getUuid(), other.getOwner().getUuid() + )) { + return false; + } + if (!Objects.equals(position, other.getPosition())) { + return false; + } + if (!Objects.equals(interests, other.getInterests())) { + return false; + } + return Objects.equals(misc, other.getMisc()); + } + + @Override + public boolean canEqual(final Object obj) { + return obj instanceof ProfileSiteItem; + } + + @Override + public String toString(final String data) { + return super.toString( + String.format( + ", owner = %s, " + + "position = \"%s\", " + + "interests = \"%s\", " + + "misc = \"%s\"%s", + Objects.toString(owner), + position, + interests, + misc, + data + ) + ); + } + +}