SciProject Content Type
* Moved all classes into unique package for SciProject. * Association classespull/1/head
parent
9b93d73977
commit
19ae08b1e4
|
|
@ -3,7 +3,7 @@
|
||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package org.scientificcms.contenttypes;
|
package org.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
import org.hibernate.envers.Audited;
|
import org.hibernate.envers.Audited;
|
||||||
import org.librecms.assets.ContactableEntity;
|
import org.librecms.assets.ContactableEntity;
|
||||||
|
|
@ -19,7 +19,7 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import static org.scientificcms.contenttypes.SciProjectConstants.*;
|
import static org.scientificcms.contenttypes.sciproject.SciProjectConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -28,7 +28,7 @@ import static org.scientificcms.contenttypes.SciProjectConstants.*;
|
||||||
@Entity
|
@Entity
|
||||||
@Audited
|
@Audited
|
||||||
@Table(name = "PROJECT_CONTACTS", schema = DB_SCHEMA)
|
@Table(name = "PROJECT_CONTACTS", schema = DB_SCHEMA)
|
||||||
public class SciProjectContact implements Serializable{
|
public class Contact implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
/*
|
||||||
|
* 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.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
|
import org.hibernate.envers.Audited;
|
||||||
|
import org.libreccm.core.CcmObjects;
|
||||||
|
import org.librecms.assets.Person;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import static org.scientificcms.contenttypes.sciproject.SciProjectConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Audited
|
||||||
|
@Table(name = "PROJECT_MEMBERSHIPS", schema = DB_SCHEMA)
|
||||||
|
public class Membership implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "MEMBERSHIP_ID")
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long membershipId;
|
||||||
|
|
||||||
|
@Column(name = "MEMBER_ROLE", length = 255, nullable = true)
|
||||||
|
private String role;
|
||||||
|
|
||||||
|
@Column(name = "STATUS")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private MembershipStatus status;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "PROJECT_ID")
|
||||||
|
private SciProject project;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "MEMBER_ID")
|
||||||
|
private Person member;
|
||||||
|
|
||||||
|
public long getMembershipId() {
|
||||||
|
return membershipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setMembershipId(final long membershipId) {
|
||||||
|
this.membershipId = membershipId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(final String role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MembershipStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(final MembershipStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciProject getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setProject(final SciProject project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Person getMember() {
|
||||||
|
return member;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setMember(final Person member) {
|
||||||
|
this.member = member;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 7;
|
||||||
|
hash = 37 * hash
|
||||||
|
+ (int) (membershipId ^ (membershipId >>> 32));
|
||||||
|
hash = 37 * hash + Objects.hashCode(role);
|
||||||
|
hash = 37 * hash + Objects.hashCode(status);
|
||||||
|
hash = 37 * hash + CcmObjects.hashCodeUsingUuid(project);
|
||||||
|
hash = 37 * hash + CcmObjects.hashCodeUsingUuid(member);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Membership)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Membership other = (Membership) obj;
|
||||||
|
if (!other.canEqual(this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (membershipId != other.getMembershipId()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(role, other.getRole())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CcmObjects.equalsUsingUuid(project, other.getProject())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!CcmObjects.equalsUsingUuid(member, other.getMember())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (status != other.getStatus()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
||||||
|
return obj instanceof Membership;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* 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.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public enum MembershipStatus {
|
||||||
|
|
||||||
|
ACTIVE,
|
||||||
|
ASSOCIATED,
|
||||||
|
FORMER,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package org.scientificcms.contenttypes;
|
package org.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.ui.SciProjectPropertiesStep;
|
import com.arsdigita.cms.contenttypes.ui.SciProjectPropertiesStep;
|
||||||
import com.arsdigita.cms.ui.authoring.PageCreateForm;
|
import com.arsdigita.cms.ui.authoring.PageCreateForm;
|
||||||
|
|
@ -30,7 +30,7 @@ import javax.persistence.JoinTable;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import static org.scientificcms.contenttypes.SciProjectConstants.*;
|
import static org.scientificcms.contenttypes.sciproject.SciProjectConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -110,6 +110,9 @@ public class SciProject extends ContentItem implements Serializable {
|
||||||
private LocalizedString fundingVolume;
|
private LocalizedString fundingVolume;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "project")
|
@OneToMany(mappedBy = "project")
|
||||||
private List<SciProjectContact> contacts;
|
private List<Contact> contacts;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "project")
|
||||||
|
private List<Membership> members;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
* To change this template file, choose Tools | Templates
|
* To change this template file, choose Tools | Templates
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
package org.scientificcms.contenttypes;
|
package org.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Add your license here, for example LGPL
|
* Add your license here, for example LGPL
|
||||||
*/
|
*/
|
||||||
package org.scientificcms.contenttypes;
|
package org.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
import org.libreccm.modules.CcmModule;
|
import org.libreccm.modules.CcmModule;
|
||||||
import org.libreccm.modules.InitEvent;
|
import org.libreccm.modules.InitEvent;
|
||||||
|
|
@ -0,0 +1,194 @@
|
||||||
|
/*
|
||||||
|
* 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.scientificcms.contenttypes.sciproject;
|
||||||
|
|
||||||
|
import org.hibernate.envers.Audited;
|
||||||
|
import org.libreccm.core.CcmObjects;
|
||||||
|
import org.librecms.assets.Organization;
|
||||||
|
|
||||||
|
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.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import static org.scientificcms.contenttypes.sciproject.SciProjectConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Audited
|
||||||
|
@Table(name = "SPONSORING", schema = DB_SCHEMA)
|
||||||
|
public class Sponsoring implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "SPONSORING_ID")
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
|
private long sponsoringId;
|
||||||
|
|
||||||
|
@Column(name = "FUNDING_CODE", length = 512, nullable = true)
|
||||||
|
private String fundingCode;
|
||||||
|
|
||||||
|
@Column(name = "SPONSOR_ORDER")
|
||||||
|
private long order;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "PROJECT_ID")
|
||||||
|
private SciProject project;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "SPONSOR_ID")
|
||||||
|
private Organization sponsor;
|
||||||
|
|
||||||
|
public long getSponsoringId() {
|
||||||
|
return sponsoringId;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSponsoringId(final long sponsoringId) {
|
||||||
|
this.sponsoringId = sponsoringId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFundingCode() {
|
||||||
|
return fundingCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFundingCode(final String fundingCode) {
|
||||||
|
this.fundingCode = fundingCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setOrder(final long order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciProject getProject() {
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setProject(final SciProject project) {
|
||||||
|
this.project = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Organization getSponsor() {
|
||||||
|
return sponsor;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSponsor(final Organization sponsor) {
|
||||||
|
this.sponsor = sponsor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
|
||||||
|
int hash = 3;
|
||||||
|
hash = 53 * hash
|
||||||
|
+ (int) (sponsoringId ^ (sponsoringId >>> 32));
|
||||||
|
hash = 53 * hash + Objects.hashCode(fundingCode);
|
||||||
|
hash = 53 * hash + (int) (order ^ (order >>> 32));
|
||||||
|
hash = 53 * hash + CcmObjects.hashCodeUsingUuid(project);
|
||||||
|
hash = 53 * hash + CcmObjects.hashCodeUsingUuid(sponsor);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
|
||||||
|
if (this == obj) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof Sponsoring)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final Sponsoring other = (Sponsoring) obj;
|
||||||
|
if (!other.canEqual(this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (sponsoringId != other.getSponsoringId()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(fundingCode, other.getFundingCode())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!CcmObjects.equalsUsingUuid(project, other.getProject())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!CcmObjects.equalsUsingUuid(sponsor, other.getSponsor())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return order == other.getOrder();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
||||||
|
return obj instanceof Sponsoring;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
|
||||||
|
return toString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(final String data) {
|
||||||
|
|
||||||
|
final String projectStr;
|
||||||
|
if (project == null) {
|
||||||
|
projectStr = "";
|
||||||
|
} else {
|
||||||
|
projectStr = String.format("objectId = %d,"
|
||||||
|
+ "uuid = \"%s\", "
|
||||||
|
+ "name = \"%s\"",
|
||||||
|
project.getObjectId(),
|
||||||
|
project.getUuid(),
|
||||||
|
project.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
final String sponsorStr;
|
||||||
|
if (sponsor == null) {
|
||||||
|
sponsorStr = "";
|
||||||
|
} else {
|
||||||
|
sponsorStr = String.format("objectId = %d, "
|
||||||
|
+ "uuid = \"%s\", "
|
||||||
|
+ "name = \"%s\"",
|
||||||
|
sponsor.getObjectId(),
|
||||||
|
sponsor.getUuid(),
|
||||||
|
sponsor.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%s{ "
|
||||||
|
+ "sponsoringId = %d, "
|
||||||
|
+ "fundingCode = \"%s\", "
|
||||||
|
+ "order = %d, "
|
||||||
|
+ "project = { %s }, "
|
||||||
|
+ "sponsor = { %s }%s"
|
||||||
|
+ " }",
|
||||||
|
super.toString(),
|
||||||
|
sponsoringId,
|
||||||
|
fundingCode,
|
||||||
|
order,
|
||||||
|
projectStr,
|
||||||
|
sponsorStr,
|
||||||
|
data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue