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