CCM NG: org.libreccm.core package: Annotations for JAXB
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3462 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
1745c25dcc
commit
3019397905
|
|
@ -87,6 +87,19 @@
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<!--<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>jaxb2-maven-plugin</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>schemagen</id>
|
||||||
|
<goals>
|
||||||
|
<goal>schemagen</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>-->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,7 @@ public abstract class AbstractEntityRepository<K, E> {
|
||||||
|
|
||||||
public abstract Class<E> getEntityClass();
|
public abstract Class<E> getEntityClass();
|
||||||
|
|
||||||
public abstract boolean isNew(final E entity) {
|
public abstract boolean isNew(final E entity);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save(final E entity) {
|
public void save(final E entity) {
|
||||||
if (isNew(entity)) {
|
if (isNew(entity)) {
|
||||||
|
|
@ -36,7 +34,7 @@ public abstract class AbstractEntityRepository<K, E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<E> findById(final K entityId) {
|
public E findById(final K entityId) {
|
||||||
return entityManager.find(getEntityClass(), entityId);
|
return entityManager.find(getEntityClass(), entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import org.libreccm.categorization.Categorization;
|
import org.libreccm.categorization.Categorization;
|
||||||
import org.libreccm.categorization.Category;
|
import org.libreccm.categorization.Category;
|
||||||
import org.libreccm.categorization.DomainOwnership;
|
import org.libreccm.categorization.DomainOwnership;
|
||||||
|
|
@ -38,6 +40,7 @@ import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -60,7 +63,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "ccm_objects")
|
@Table(name = "ccm_objects")
|
||||||
@Inheritance(strategy = InheritanceType.JOINED)
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
@XmlRootElement(name = "ccm-object", namespace = "http://core.libreccm.org")
|
@XmlRootElement(name = "ccm-object", namespace = XML_NS)
|
||||||
//False warning (?). Because this class has been migrated from the old PDL style
|
//False warning (?). Because this class has been migrated from the old PDL style
|
||||||
//persistence system we can't yet refactor it to make PMD happy. Also I think
|
//persistence system we can't yet refactor it to make PMD happy. Also I think
|
||||||
//this is a false warning.
|
//this is a false warning.
|
||||||
|
|
@ -77,28 +80,35 @@ public class CcmObject implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "object_id")
|
@Column(name = "object_id")
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
@XmlElement(name = "object-id")
|
@XmlElement(name = "object-id", namespace = XML_NS)
|
||||||
private long objectId;
|
private long objectId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A human readable name identifying this {@code CcmObject}
|
* A human readable name identifying this {@code CcmObject}
|
||||||
*/
|
*/
|
||||||
@Column(name = "display_name")
|
@Column(name = "display_name")
|
||||||
|
@XmlElement(name = "display-name", namespace = XML_NS)
|
||||||
private String displayName;
|
private String displayName;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "object")
|
@OneToMany(mappedBy = "object")
|
||||||
|
@XmlElementWrapper(name = "permissions", namespace = XML_NS)
|
||||||
|
@XmlElement(name = "permission", namespace = XML_NS)
|
||||||
private List<Permission> permissions;
|
private List<Permission> permissions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Category Domains owned by this {@code CcmObject}.
|
* Category Domains owned by this {@code CcmObject}.
|
||||||
*/
|
*/
|
||||||
@OneToMany(mappedBy = "owner")
|
@OneToMany(mappedBy = "owner")
|
||||||
|
@XmlElementWrapper(name = "domains", namespace = XML_NS)
|
||||||
|
@XmlElement(name = "domain", namespace = XML_NS)
|
||||||
private List<DomainOwnership> domains;
|
private List<DomainOwnership> domains;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Categories which have been assigned to this {@code CcmObject}.
|
* Categories which have been assigned to this {@code CcmObject}.
|
||||||
*/
|
*/
|
||||||
@OneToMany(mappedBy = "categorizedObject")
|
@OneToMany(mappedBy = "categorizedObject")
|
||||||
|
@XmlElementWrapper(name = "categories", namespace = XML_NS)
|
||||||
|
@XmlElement(name = "category", namespace = XML_NS)
|
||||||
private List<Categorization> categories;
|
private List<Categorization> categories;
|
||||||
|
|
||||||
public CcmObject() {
|
public CcmObject() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some constants for the Core package
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public final class CoreConstants {
|
||||||
|
|
||||||
|
private CoreConstants() {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String XML_NS = "http://core.libreccm.org";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Email;
|
import org.hibernate.validator.constraints.Email;
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
|
||||||
|
|
@ -26,6 +28,8 @@ import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An embeddable entity for storing email addresses.
|
* An embeddable entity for storing email addresses.
|
||||||
|
|
@ -41,19 +45,23 @@ import javax.persistence.Embeddable;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Embeddable
|
@Embeddable
|
||||||
|
@XmlRootElement(name = "email-address", namespace = XML_NS)
|
||||||
public class EmailAddress implements Serializable {
|
public class EmailAddress implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4076089589412432766L;
|
private static final long serialVersionUID = -4076089589412432766L;
|
||||||
|
|
||||||
@Column(name = "email_address", length = 512, nullable = false)
|
@Column(name = "email_address", length = 512, nullable = false)
|
||||||
|
@XmlElement(name = "address", namespace = XML_NS, required = true)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@Email
|
@Email
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
@Column(name = "bouncing")
|
@Column(name = "bouncing")
|
||||||
|
@XmlElement(name = "bouncing", namespace = XML_NS)
|
||||||
private boolean bouncing;
|
private boolean bouncing;
|
||||||
|
|
||||||
@Column(name = "verified")
|
@Column(name = "verified")
|
||||||
|
@XmlElement(name = "verified", namespace = XML_NS)
|
||||||
private boolean verified;
|
private boolean verified;
|
||||||
|
|
||||||
public String getAddress() {
|
public String getAddress() {
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,11 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
|
@ -27,6 +30,9 @@ import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An association class for the association between a group and it members.
|
* An association class for the association between a group and it members.
|
||||||
|
|
@ -35,6 +41,8 @@ import javax.persistence.Table;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "group_memberships")
|
@Table(name = "group_memberships")
|
||||||
|
@XmlRootElement(name = "group-membership",
|
||||||
|
namespace = XML_NS)
|
||||||
public class GroupMembership implements Serializable {
|
public class GroupMembership implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1897274442468035089L;
|
private static final long serialVersionUID = 1897274442468035089L;
|
||||||
|
|
@ -42,12 +50,15 @@ public class GroupMembership implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "membership_id")
|
@Column(name = "membership_id")
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
@XmlElement(name = "membership-id", namespace = XML_NS)
|
||||||
private long membershipId;
|
private long membershipId;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@XmlTransient
|
||||||
private UserGroup group;
|
private UserGroup group;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
@XmlTransient
|
||||||
private User user;
|
private User user;
|
||||||
|
|
||||||
public long getMembershipId() {
|
public long getMembershipId() {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.security.acl.Group;
|
import java.security.acl.Group;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -32,6 +34,9 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal basic class for {@link User} and {@link Group}.
|
* Internal basic class for {@link User} and {@link Group}.
|
||||||
|
|
@ -40,6 +45,7 @@ import javax.validation.constraints.Size;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "parties")
|
@Table(name = "parties")
|
||||||
|
@XmlRootElement(name = "party", namespace = XML_NS)
|
||||||
public class Party extends CcmObject implements Serializable {
|
public class Party extends CcmObject implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6303836654273293979L;
|
private static final long serialVersionUID = 6303836654273293979L;
|
||||||
|
|
@ -49,11 +55,15 @@ public class Party extends CcmObject implements Serializable {
|
||||||
joinColumns = {
|
joinColumns = {
|
||||||
@JoinColumn(name = "party_id")})
|
@JoinColumn(name = "party_id")})
|
||||||
@Size(min = 1)
|
@Size(min = 1)
|
||||||
|
@XmlElementWrapper(name = "email-addresses", namespace = XML_NS)
|
||||||
|
@XmlElement(name = "email-address", namespace = XML_NS)
|
||||||
private List<EmailAddress> emailAddresses;
|
private List<EmailAddress> emailAddresses;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "grantee")
|
@OneToMany(mappedBy = "grantee")
|
||||||
//Can't shorten this variable name without reducing descriptiveness
|
//Can't shorten this variable name without reducing descriptiveness
|
||||||
@SuppressWarnings("PMD.LongVariable")
|
@SuppressWarnings("PMD.LongVariable")
|
||||||
|
@XmlElementWrapper(name = "granted-permissions", namespace = XML_NS)
|
||||||
|
@XmlElement(name = "granted-permission", namespace = XML_NS)
|
||||||
private List<Permission> grantedPermissions;
|
private List<Permission> grantedPermissions;
|
||||||
|
|
||||||
public Party() {
|
public Party() {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -33,6 +35,9 @@ import javax.persistence.OneToOne;
|
||||||
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.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -44,6 +49,7 @@ import javax.persistence.TemporalType;
|
||||||
@SuppressWarnings({"PMD.CyclomaticComplexity",
|
@SuppressWarnings({"PMD.CyclomaticComplexity",
|
||||||
"PMD.StdCyclomaticComplexity",
|
"PMD.StdCyclomaticComplexity",
|
||||||
"PMD.ModifiedCyclomaticComplexity"})
|
"PMD.ModifiedCyclomaticComplexity"})
|
||||||
|
@XmlRootElement(name = "permission", namespace = XML_NS)
|
||||||
public class Permission implements Serializable {
|
public class Permission implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2368935232499907547L;
|
private static final long serialVersionUID = -2368935232499907547L;
|
||||||
|
|
@ -51,6 +57,7 @@ public class Permission implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "permission_id")
|
@Column(name = "permission_id")
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
@XmlElement(name = "permission-id", namespace = XML_NS)
|
||||||
private long permissionId;
|
private long permissionId;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
|
@ -59,6 +66,7 @@ public class Permission implements Serializable {
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "granted_privilege_id")
|
@JoinColumn(name = "granted_privilege_id")
|
||||||
|
@XmlElement(name = "privilege", namespace = XML_NS)
|
||||||
private Privilege grantedPrivilege;
|
private Privilege grantedPrivilege;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
|
|
@ -67,13 +75,16 @@ public class Permission implements Serializable {
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "creation_user_id")
|
@JoinColumn(name = "creation_user_id")
|
||||||
|
@XmlElement(name = "creation-user", namespace = XML_NS)
|
||||||
private User creationUser;
|
private User creationUser;
|
||||||
|
|
||||||
@Column(name = "creation_date")
|
@Column(name = "creation_date")
|
||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
@XmlElement(name = "creation-date", namespace = XML_NS)
|
||||||
private Date creationDate;
|
private Date creationDate;
|
||||||
|
|
||||||
@Column(name = "creation_ip")
|
@Column(name = "creation_ip")
|
||||||
|
@XmlElement(name = "creation-ip", namespace = XML_NS)
|
||||||
private String creationIp;
|
private String creationIp;
|
||||||
|
|
||||||
public long getPermissionId() {
|
public long getPermissionId() {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -25,6 +27,8 @@ import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An embeddable entity representing a person's name.
|
* An embeddable entity representing a person's name.
|
||||||
|
|
@ -32,25 +36,31 @@ import javax.persistence.Embeddable;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Embeddable
|
@Embeddable
|
||||||
|
@XmlRootElement(name = "person-name", namespace = XML_NS)
|
||||||
public class PersonName implements Serializable {
|
public class PersonName implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5805626320605809172L;
|
private static final long serialVersionUID = -5805626320605809172L;
|
||||||
|
|
||||||
@Column(name = "title_pre", length = 512)
|
@Column(name = "title_pre", length = 512)
|
||||||
|
@XmlElement(name = "title-pre", namespace = XML_NS)
|
||||||
private String titlePre;
|
private String titlePre;
|
||||||
|
|
||||||
@Column(name = "given_name", length = 512)
|
@Column(name = "given_name", length = 512)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
|
@XmlElement(name = "given-name", namespace = XML_NS)
|
||||||
private String givenName;
|
private String givenName;
|
||||||
|
|
||||||
@Column(name = "middle_name", length = 512)
|
@Column(name = "middle_name", length = 512)
|
||||||
|
@XmlElement(name = "middle-name", namespace = XML_NS)
|
||||||
private String middleName;
|
private String middleName;
|
||||||
|
|
||||||
@Column(name = "family_name", length = 512)
|
@Column(name = "family_name", length = 512)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
|
@XmlElement(name = "family-name", namespace = XML_NS)
|
||||||
private String familyName;
|
private String familyName;
|
||||||
|
|
||||||
@Column(name = "title_post", length = 512)
|
@Column(name = "title_post", length = 512)
|
||||||
|
@XmlElement(name = "title-post", namespace = XML_NS)
|
||||||
private String titlePost;
|
private String titlePost;
|
||||||
|
|
||||||
public String getTitlePre() {
|
public String getTitlePre() {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -27,6 +29,8 @@ import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -34,6 +38,7 @@ import javax.persistence.Table;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "ccm_privileges")
|
@Table(name = "ccm_privileges")
|
||||||
|
@XmlRootElement(name = "privilege", namespace = XML_NS)
|
||||||
public class Privilege implements Serializable {
|
public class Privilege implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -3986038536996049440L;
|
private static final long serialVersionUID = -3986038536996049440L;
|
||||||
|
|
@ -41,11 +46,13 @@ public class Privilege implements Serializable {
|
||||||
@Id
|
@Id
|
||||||
@Column(name = "privilege_id")
|
@Column(name = "privilege_id")
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
@XmlElement(name = "privilege-id", namespace = XML_NS)
|
||||||
private long privilegeId;
|
private long privilegeId;
|
||||||
|
|
||||||
@Column(name = "privilege", length = 255, nullable = false)
|
@Column(name = "privilege", length = 255, nullable = false)
|
||||||
//Field is named like this in the old PDL class, don't want to change it now
|
//Field is named like this in the old PDL class, don't want to change it now
|
||||||
@SuppressWarnings("PMD.AvoidFieldNameMatchingTypeName")
|
@SuppressWarnings("PMD.AvoidFieldNameMatchingTypeName")
|
||||||
|
@XmlElement(name = "privilege", namespace = XML_NS)
|
||||||
private String privilege;
|
private String privilege;
|
||||||
|
|
||||||
public long getPrivilegeId() {
|
public long getPrivilegeId() {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -37,6 +39,10 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -44,6 +50,7 @@ import javax.persistence.OneToMany;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "users")
|
@Table(name = "users")
|
||||||
|
@XmlRootElement(name = "user", namespace = XML_NS)
|
||||||
//Supressing a few warnings from PMD because they misleading here.
|
//Supressing a few warnings from PMD because they misleading here.
|
||||||
//User is perfectly fine class name, and the complexity is not to high...
|
//User is perfectly fine class name, and the complexity is not to high...
|
||||||
@SuppressWarnings({"PMD.ShortClassName",
|
@SuppressWarnings({"PMD.ShortClassName",
|
||||||
|
|
@ -60,31 +67,41 @@ public class User extends Party implements Serializable {
|
||||||
joinTable = @JoinTable(name = "user_names",
|
joinTable = @JoinTable(name = "user_names",
|
||||||
joinColumns = {
|
joinColumns = {
|
||||||
@JoinColumn(name = " user_id")}))
|
@JoinColumn(name = " user_id")}))
|
||||||
|
@XmlElement(name = "person-name", namespace = XML_NS)
|
||||||
private PersonName name;
|
private PersonName name;
|
||||||
|
|
||||||
@Column(name = "screen_name", length = 255, nullable = false)
|
@Column(name = "screen_name", length = 255, nullable = false)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
|
@XmlElement(name = "screen-name", namespace = XML_NS)
|
||||||
private String screenName;
|
private String screenName;
|
||||||
|
|
||||||
@Column(name = "banned")
|
@Column(name = "banned")
|
||||||
|
@XmlElement(name = "banned", namespace = XML_NS)
|
||||||
private boolean banned;
|
private boolean banned;
|
||||||
|
|
||||||
@Column(name = "sso_login", length = 512)
|
@Column(name = "sso_login", length = 512)
|
||||||
|
@XmlElement(name = "sso-login", namespace = XML_NS)
|
||||||
private String ssoLogin;
|
private String ssoLogin;
|
||||||
|
|
||||||
@Column(name = "password", length = 2048)
|
@Column(name = "password", length = 2048)
|
||||||
|
@XmlTransient
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@Column(name = "salt", length = 2048)
|
@Column(name = "salt", length = 2048)
|
||||||
|
@XmlTransient
|
||||||
private String salt;
|
private String salt;
|
||||||
|
|
||||||
@Column(name = "password_question", length = 2048)
|
@Column(name = "password_question", length = 2048)
|
||||||
|
@XmlElement(name = "password-question", namespace = XML_NS)
|
||||||
private String passwordQuestion;
|
private String passwordQuestion;
|
||||||
|
|
||||||
@Column(name = "password_answer", length = 2048)
|
@Column(name = "password_answer", length = 2048)
|
||||||
|
@XmlElement(name = "password-answer", namespace = XML_NS)
|
||||||
private String passwordAnswer;
|
private String passwordAnswer;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "user")
|
@OneToMany(mappedBy = "user")
|
||||||
|
@XmlElementWrapper(name = "group-memberships")
|
||||||
|
@XmlElement(name = "group-membership", namespace = XML_NS)
|
||||||
private List<GroupMembership> groupMemberships;
|
private List<GroupMembership> groupMemberships;
|
||||||
|
|
||||||
public User() {
|
public User() {
|
||||||
|
|
|
||||||
|
|
@ -18,36 +18,50 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.NotBlank;
|
import org.hibernate.validator.constraints.NotBlank;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "user_groups")
|
@Table(name = "user_groups")
|
||||||
|
@XmlRootElement(name = "user-group", namespace = XML_NS)
|
||||||
public class UserGroup extends Party implements Serializable {
|
public class UserGroup extends Party implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5555063356689597270L;
|
private static final long serialVersionUID = -5555063356689597270L;
|
||||||
|
|
||||||
@Column(name = "name", length = 512, nullable = false)
|
@Column(name = "name", length = 512, nullable = false)
|
||||||
@NotBlank
|
@NotBlank
|
||||||
|
@XmlElement(name = "name", namespace = XML_NS)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "sourceGroup")
|
@OneToMany(mappedBy = "sourceGroup")
|
||||||
|
@XmlElementWrapper(name = "roles", namespace = XML_NS)
|
||||||
|
@XmlElement(name ="role", namespace = XML_NS)
|
||||||
private List<Role> roles;
|
private List<Role> roles;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "group")
|
@OneToMany(mappedBy = "group")
|
||||||
|
@XmlElementWrapper(name = "group-memberships", namespace = XML_NS)
|
||||||
|
@XmlElement(name = "group-membership", namespace = XML_NS)
|
||||||
private List<GroupMembership> members;
|
private List<GroupMembership> members;
|
||||||
|
|
||||||
public UserGroup() {
|
public UserGroup() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This package provides some base classes for LibreCCM.
|
||||||
|
*/
|
||||||
|
@XmlSchema(xmlns = {@XmlNs(prefix = "ccmcore",
|
||||||
|
namespaceURI = "http://core.libreccm.org")})
|
||||||
|
@XmlAccessorType(XmlAccessType.NONE)
|
||||||
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
import javax.xml.bind.annotation.XmlNs;
|
||||||
|
import javax.xml.bind.annotation.XmlSchema;
|
||||||
|
|
||||||
Loading…
Reference in New Issue