CCM NG: Some more JPA entities
git-svn-id: https://svn.libreccm.org/ccm/jpa@3386 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
307999c68b
commit
4e98aa55af
|
|
@ -43,6 +43,11 @@
|
||||||
<artifactId>hibernate-entitymanager</artifactId>
|
<artifactId>hibernate-entitymanager</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -39,11 +40,11 @@ import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The category entity represents a single category. Each category is part
|
* The category entity represents a single category. Each category is part of a
|
||||||
* of a {@link Domain}. A category can be assigned to multiple
|
* {@link Domain}. A category can be assigned to multiple {@link CcmObject}s.
|
||||||
* {@link CcmObject}s.
|
|
||||||
*
|
*
|
||||||
* In the old structure the properties of this class were split between the
|
* In the old structure the properties of this class were split between the
|
||||||
* {@code Category} entity from {@code ccm-core} and the {@code Term} entity
|
* {@code Category} entity from {@code ccm-core} and the {@code Term} entity
|
||||||
|
|
@ -66,10 +67,12 @@ public class Category extends CcmObject implements Serializable {
|
||||||
private String uniqueId;
|
private String uniqueId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the category. This is used as URL stub, therefore only
|
* The name of the category. This is used as URL stub, therefore only the
|
||||||
* the characters a to z, A to Z and 0 to 9 are allowed.
|
* characters a to z, A to Z and 0 to 9 are allowed.
|
||||||
*/
|
*/
|
||||||
@Column(name = "name", nullable = false)
|
@Column(name = "name", nullable = false)
|
||||||
|
@NotBlank
|
||||||
|
@Pattern(regexp = "[\\w-.]*")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -111,8 +114,8 @@ public class Category extends CcmObject implements Serializable {
|
||||||
private boolean visible;
|
private boolean visible;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines if the category is abstract. It is not possible to add
|
* Defines if the category is abstract. It is not possible to add objects to
|
||||||
* objects to an abstract category.
|
* an abstract category.
|
||||||
*/
|
*/
|
||||||
@Column(name = "abstract_category")
|
@Column(name = "abstract_category")
|
||||||
private boolean abstractCategory;
|
private boolean abstractCategory;
|
||||||
|
|
@ -224,8 +227,8 @@ public class Category extends CcmObject implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an <strong>unmodifiable</strong> list of the sub categories of
|
* Retrieves an <strong>unmodifiable</strong> list of the sub categories of
|
||||||
* this category. To manage the assigned objects use the methods provided
|
* this category. To manage the assigned objects use the methods provided by
|
||||||
* by the {@link CategoryManager}.
|
* the {@link CategoryManager}.
|
||||||
*
|
*
|
||||||
* @return An unmodifiable list of sub categories of this category.
|
* @return An unmodifiable list of sub categories of this category.
|
||||||
*/
|
*/
|
||||||
|
|
@ -332,23 +335,23 @@ public class Category extends CcmObject implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(final String data) {
|
public String toString(final String data) {
|
||||||
return String.format(", uniqueId = %s, "
|
return super.toString(String.format(", uniqueId = %s, "
|
||||||
+ "name = \"%s\", "
|
+ "name = \"%s\", "
|
||||||
+ "title = %s, "
|
+ "title = %s, "
|
||||||
+ "enabled = %b, "
|
+ "enabled = %b, "
|
||||||
+ "visible = %b, "
|
+ "visible = %b, "
|
||||||
+ "abstractCategory = %b, "
|
+ "abstractCategory = %b, "
|
||||||
+ "parentCategory = %s, "
|
+ "parentCategory = %s, "
|
||||||
+ "categoryOrder = %d%s",
|
+ "categoryOrder = %d%s",
|
||||||
uniqueId,
|
uniqueId,
|
||||||
name,
|
name,
|
||||||
title.toString(),
|
title.toString(),
|
||||||
enabled,
|
enabled,
|
||||||
visible,
|
visible,
|
||||||
abstractCategory,
|
abstractCategory,
|
||||||
parentCategory,
|
parentCategory,
|
||||||
categoryOrder,
|
categoryOrder,
|
||||||
data);
|
data));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.categorization;
|
package org.libreccm.categorization;
|
||||||
|
|
||||||
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
import org.hibernate.validator.constraints.URL;
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
|
|
@ -39,6 +41,7 @@ import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A domain is collection of categories designed a specific purpose. This
|
* A domain is collection of categories designed a specific purpose. This
|
||||||
|
|
@ -65,6 +68,8 @@ public class Domain extends CcmObject implements Serializable {
|
||||||
* {@code MYNAV}.
|
* {@code MYNAV}.
|
||||||
*/
|
*/
|
||||||
@Column(name = "domain_key", nullable = false, unique = true, length = 255)
|
@Column(name = "domain_key", nullable = false, unique = true, length = 255)
|
||||||
|
@NotBlank
|
||||||
|
@Pattern(regexp = "[\\w-.]*")
|
||||||
private String domainKey;
|
private String domainKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -80,6 +85,8 @@ public class Domain extends CcmObject implements Serializable {
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
@Column(name = "uri", nullable = false, unique = true, length = 2048)
|
@Column(name = "uri", nullable = false, unique = true, length = 2048)
|
||||||
|
@NotBlank
|
||||||
|
@URL
|
||||||
private URI uri;
|
private URI uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -109,6 +116,7 @@ public class Domain extends CcmObject implements Serializable {
|
||||||
* A version string for the {@code Domain}.
|
* A version string for the {@code Domain}.
|
||||||
*/
|
*/
|
||||||
@Column(name = "version", nullable = false)
|
@Column(name = "version", nullable = false)
|
||||||
|
@NotBlank
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,148 @@
|
||||||
|
/*
|
||||||
|
* 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 org.hibernate.validator.constraints.NotBlank;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An embeddable entity representing a person's name.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Embeddable
|
||||||
|
public class PersonName implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5805626320605809172L;
|
||||||
|
|
||||||
|
@Column(name = "title_pre", length = 512)
|
||||||
|
private String titlePre;
|
||||||
|
|
||||||
|
@Column(name = "given_name", length = 512)
|
||||||
|
@NotBlank
|
||||||
|
private String givenName;
|
||||||
|
|
||||||
|
@Column(name = "middle_name", length = 512)
|
||||||
|
private String middleName;
|
||||||
|
|
||||||
|
@Column(name = "family_name", length = 512)
|
||||||
|
@NotBlank
|
||||||
|
private String familyName;
|
||||||
|
|
||||||
|
@Column(name = "title_post", length = 512)
|
||||||
|
private String titlePost;
|
||||||
|
|
||||||
|
public String getTitlePre() {
|
||||||
|
return titlePre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitlePre(final String titlePre) {
|
||||||
|
this.titlePre = titlePre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGivenName() {
|
||||||
|
return givenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGivenName(final String givenName) {
|
||||||
|
this.givenName = givenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMiddleName() {
|
||||||
|
return middleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMiddleName(String middleName) {
|
||||||
|
this.middleName = middleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFamilyName() {
|
||||||
|
return familyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFamilyName(final String familyName) {
|
||||||
|
this.familyName = familyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitlePost() {
|
||||||
|
return titlePost;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitlePost(final String titlePost) {
|
||||||
|
this.titlePost = titlePost;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 37 * hash + Objects.hashCode(this.titlePre);
|
||||||
|
hash = 37 * hash + Objects.hashCode(this.givenName);
|
||||||
|
hash = 37 * hash + Objects.hashCode(this.middleName);
|
||||||
|
hash = 37 * hash + Objects.hashCode(this.familyName);
|
||||||
|
hash = 37 * hash + Objects.hashCode(this.titlePost);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final PersonName other = (PersonName) obj;
|
||||||
|
if (!Objects.equals(this.titlePre, other.getTitlePre())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.givenName, other.getGivenName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.middleName, other.getMiddleName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.familyName, other.getFamilyName())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(this.titlePost, other.getTitlePost());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ "
|
||||||
|
+ "titlePre = \"%s\", "
|
||||||
|
+ "givenName = \"%s\", "
|
||||||
|
+ "middleName = \"%s\", "
|
||||||
|
+ "familyName = \"%s\", "
|
||||||
|
+ "titlePost = \"%s\""
|
||||||
|
+ " }",
|
||||||
|
super.toString(),
|
||||||
|
titlePre,
|
||||||
|
givenName,
|
||||||
|
middleName,
|
||||||
|
familyName,
|
||||||
|
titlePost);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
/*
|
||||||
|
* 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 org.hibernate.validator.constraints.Email;
|
||||||
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embeddable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An embeddable entity for storing email addresses.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Embeddable
|
||||||
|
public class EmailAddress implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -4076089589412432766L;
|
||||||
|
|
||||||
|
@Column(name = "email_address", length = 512, nullable = false)
|
||||||
|
@NotBlank
|
||||||
|
@Email
|
||||||
|
private String eMailAddress;
|
||||||
|
|
||||||
|
@Column(name = "bouncing")
|
||||||
|
private boolean bouncing;
|
||||||
|
|
||||||
|
@Column(name = "verified")
|
||||||
|
private boolean verified;
|
||||||
|
|
||||||
|
public String getEmailAddress() {
|
||||||
|
return eMailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailAddress(final String eMailAddress) {
|
||||||
|
this.eMailAddress = eMailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBouncing() {
|
||||||
|
return bouncing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBouncing(final boolean bouncing) {
|
||||||
|
this.bouncing = bouncing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVerified() {
|
||||||
|
return verified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerified(final boolean verified) {
|
||||||
|
this.verified = verified;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%s{ "
|
||||||
|
+ "eMailAddress = \"%s\", "
|
||||||
|
+ "bouncing = %b, "
|
||||||
|
+ "verified = %b }",
|
||||||
|
super.toString(),
|
||||||
|
eMailAddress,
|
||||||
|
bouncing,
|
||||||
|
verified);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* 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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "groups")
|
||||||
|
public class Group extends Party implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5555063356689597270L;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* 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.security.acl.Group;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.persistence.ElementCollection;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Internal basic class for {@link User} and {@link Group}.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "parties")
|
||||||
|
public class Party extends CcmObject implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6303836654273293979L;
|
||||||
|
|
||||||
|
@ElementCollection
|
||||||
|
@Size(min = 1)
|
||||||
|
private List<EmailAddress> eMailAddresses;
|
||||||
|
|
||||||
|
public List<EmailAddress> getEmailAddresses() {
|
||||||
|
return Collections.unmodifiableList(eMailAddresses);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setEmailAddresses(final List<EmailAddress> eMailAddresses) {
|
||||||
|
this.eMailAddresses = eMailAddresses;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addEmailAddress(final EmailAddress emailAddress) {
|
||||||
|
eMailAddresses.add(emailAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeEmailAddress(final EmailAddress emailAddress) {
|
||||||
|
eMailAddresses.remove(emailAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = super.hashCode();
|
||||||
|
hash = 41 * hash + Objects.hashCode(this.eMailAddresses);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Party other = (Party) obj;
|
||||||
|
if (!other.canEqual(this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Objects.equals(this.eMailAddresses, other.getEmailAddresses());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
return obj instanceof Party;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -39,8 +39,18 @@ import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The {@code Resource} class is a base class for several other classes, for
|
||||||
|
* example the {@link Application} class.
|
||||||
|
*
|
||||||
|
* Resources can be nested, a resource can have multiple child resources.
|
||||||
|
*
|
||||||
|
* This class is an adopted variant of the class
|
||||||
|
* {@code com.arsdigita.kernel.Resource} from the old structure. This class is
|
||||||
|
* maybe removed in future releases. Therefore it is strictly recommend not to
|
||||||
|
* use this class directly.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter jens@jp-digital.de
|
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "resources")
|
@Table(name = "resources")
|
||||||
|
|
@ -48,6 +58,9 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7345482620613842781L;
|
private static final long serialVersionUID = 7345482620613842781L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A localisable title for the {@code Resource}.
|
||||||
|
*/
|
||||||
@Embedded
|
@Embedded
|
||||||
@AssociationOverride(
|
@AssociationOverride(
|
||||||
name = "values",
|
name = "values",
|
||||||
|
|
@ -56,6 +69,9 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
@JoinColumn(name = "object_id")}))
|
@JoinColumn(name = "object_id")}))
|
||||||
private LocalizedString title;
|
private LocalizedString title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A localisable description for the {@code Resource}.
|
||||||
|
*/
|
||||||
@Embedded
|
@Embedded
|
||||||
@AssociationOverride(
|
@AssociationOverride(
|
||||||
name = "values",
|
name = "values",
|
||||||
|
|
@ -64,13 +80,23 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
@JoinColumn(name = "object_id")}))
|
@JoinColumn(name = "object_id")}))
|
||||||
private LocalizedString description;
|
private LocalizedString description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date on which the resource was created.
|
||||||
|
*/
|
||||||
@Column(name = "created")
|
@Column(name = "created")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date created;
|
private Date created;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The child resources of this resource.
|
||||||
|
*/
|
||||||
@OneToMany(mappedBy = "parent")
|
@OneToMany(mappedBy = "parent")
|
||||||
private List<Resource> childs;
|
private List<Resource> childs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The parent resources of this resource. If the resource is a root resource
|
||||||
|
* the property will be null.
|
||||||
|
*/
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
private Resource parent;
|
private Resource parent;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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 <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "users")
|
||||||
|
public class User extends Party implements Serializable {
|
||||||
|
private static final long serialVersionUID = 892038270064849732L;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
9
pom.xml
9
pom.xml
|
|
@ -240,6 +240,15 @@
|
||||||
<version>4.3.8.Final</version>
|
<version>4.3.8.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Hibernate Validator used as implemenation of the Bean
|
||||||
|
Validation API -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>5.1.3.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
*********************
|
*********************
|
||||||
Libraries used by CCM
|
Libraries used by CCM
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue