1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.organization.entity; |
17 | |
|
18 | |
import java.util.Date; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.persistence.CascadeType; |
22 | |
import javax.persistence.Column; |
23 | |
import javax.persistence.Entity; |
24 | |
import javax.persistence.JoinColumn; |
25 | |
import javax.persistence.ManyToOne; |
26 | |
import javax.persistence.NamedQueries; |
27 | |
import javax.persistence.NamedQuery; |
28 | |
import javax.persistence.OneToMany; |
29 | |
import javax.persistence.Table; |
30 | |
import javax.persistence.Temporal; |
31 | |
import javax.persistence.TemporalType; |
32 | |
import javax.persistence.UniqueConstraint; |
33 | |
|
34 | |
import org.kuali.student.core.entity.AttributeOwner; |
35 | |
import org.kuali.student.core.entity.MetaEntity; |
36 | |
|
37 | |
@Entity |
38 | |
@Table(name = "KSOR_ORG_PERS_RELTN", uniqueConstraints={@UniqueConstraint(columnNames={"ORG_PERS_RELTN_TYPE","ORG","PERS_ID"})}) |
39 | |
@NamedQueries( { |
40 | |
@NamedQuery(name = "OrgPersonRelation.getAllOrgPersonRelationsByOrg", query = "SELECT distinct opr FROM OrgPersonRelation opr WHERE opr.org.id = :orgId"), |
41 | |
@NamedQuery(name = "OrgPersonRelation.getAllOrgPersonRelationsByPerson", query = "SELECT distinct opr FROM OrgPersonRelation opr WHERE opr.personId = :personId"), |
42 | |
@NamedQuery(name = "OrgPersonRelation.getOrgPersonRelationsByIdList", query = "SELECT opr FROM OrgPersonRelation opr WHERE opr.id IN (:idList)"), |
43 | |
@NamedQuery(name = "OrgPersonRelation.getOrgPersonRelationsByPerson", query = "SELECT opr FROM OrgPersonRelation opr WHERE opr.personId = :personId AND opr.org.id = :orgId"), |
44 | |
@NamedQuery(name = "OrgPersonRelation.getOrgMembershipCount", query = "SELECT COUNT(opr) FROM OrgPersonRelation opr WHERE opr.org.id= :orgId")}) |
45 | 25 | public class OrgPersonRelation extends MetaEntity implements |
46 | |
AttributeOwner<OrgPersonRelationAttribute> { |
47 | |
|
48 | |
@ManyToOne |
49 | |
@JoinColumn(name = "ORG") |
50 | |
private Org org; |
51 | |
|
52 | |
|
53 | |
@Column(name = "PERS_ID") |
54 | |
private String personId; |
55 | |
|
56 | |
@ManyToOne |
57 | |
@JoinColumn(name = "ORG_PERS_RELTN_TYPE") |
58 | |
private OrgPersonRelationType orgPersonRelationType; |
59 | |
|
60 | |
@Temporal(TemporalType.TIMESTAMP) |
61 | |
@Column(name = "EFF_DT") |
62 | |
private Date effectiveDate; |
63 | |
|
64 | |
@Temporal(TemporalType.TIMESTAMP) |
65 | |
@Column(name = "EXPIR_DT") |
66 | |
private Date expirationDate; |
67 | |
|
68 | |
@OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") |
69 | |
private List<OrgPersonRelationAttribute> attributes; |
70 | |
|
71 | |
@Column(name = "ST") |
72 | |
private String state; |
73 | |
|
74 | |
@Override |
75 | |
public List<OrgPersonRelationAttribute> getAttributes() { |
76 | 16 | return attributes; |
77 | |
} |
78 | |
|
79 | |
@Override |
80 | |
public void setAttributes(List<OrgPersonRelationAttribute> attributes) { |
81 | 2 | this.attributes = attributes; |
82 | 2 | } |
83 | |
|
84 | |
public Org getOrg() { |
85 | 15 | return org; |
86 | |
} |
87 | |
|
88 | |
public void setOrg(Org org) { |
89 | 1 | this.org = org; |
90 | 1 | } |
91 | |
|
92 | |
public String getPersonId() { |
93 | 16 | return personId; |
94 | |
} |
95 | |
|
96 | |
public void setPersonId(String personId) { |
97 | 1 | this.personId = personId; |
98 | 1 | } |
99 | |
|
100 | |
public Date getEffectiveDate() { |
101 | 13 | return effectiveDate; |
102 | |
} |
103 | |
|
104 | |
public void setEffectiveDate(Date effectiveDate) { |
105 | 1 | this.effectiveDate = effectiveDate; |
106 | 1 | } |
107 | |
|
108 | |
public Date getExpirationDate() { |
109 | 13 | return expirationDate; |
110 | |
} |
111 | |
|
112 | |
public void setExpirationDate(Date expirationDate) { |
113 | 1 | this.expirationDate = expirationDate; |
114 | 1 | } |
115 | |
|
116 | |
public OrgPersonRelationType getType() { |
117 | 17 | return orgPersonRelationType; |
118 | |
} |
119 | |
|
120 | |
public void setType(OrgPersonRelationType type) { |
121 | 1 | this.orgPersonRelationType = type; |
122 | 1 | } |
123 | |
|
124 | |
public String getState() { |
125 | 13 | return state; |
126 | |
} |
127 | |
|
128 | |
public void setState(String state) { |
129 | 1 | this.state = state; |
130 | 1 | } |
131 | |
|
132 | |
} |