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 | 0 | 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 | 0 | return attributes; |
76 | |
} |
77 | |
|
78 | |
@Override |
79 | |
public void setAttributes(List<OrgPersonRelationAttribute> attributes) { |
80 | 0 | this.attributes = attributes; |
81 | 0 | } |
82 | |
|
83 | |
public Org getOrg() { |
84 | 0 | return org; |
85 | |
} |
86 | |
|
87 | |
public void setOrg(Org org) { |
88 | 0 | this.org = org; |
89 | 0 | } |
90 | |
|
91 | |
public String getPersonId() { |
92 | 0 | return personId; |
93 | |
} |
94 | |
|
95 | |
public void setPersonId(String personId) { |
96 | 0 | this.personId = personId; |
97 | 0 | } |
98 | |
|
99 | |
public Date getEffectiveDate() { |
100 | 0 | return effectiveDate; |
101 | |
} |
102 | |
|
103 | |
public void setEffectiveDate(Date effectiveDate) { |
104 | 0 | this.effectiveDate = effectiveDate; |
105 | 0 | } |
106 | |
|
107 | |
public Date getExpirationDate() { |
108 | 0 | return expirationDate; |
109 | |
} |
110 | |
|
111 | |
public void setExpirationDate(Date expirationDate) { |
112 | 0 | this.expirationDate = expirationDate; |
113 | 0 | } |
114 | |
|
115 | |
public OrgPersonRelationType getType() { |
116 | 0 | return orgPersonRelationType; |
117 | |
} |
118 | |
|
119 | |
public void setType(OrgPersonRelationType type) { |
120 | 0 | this.orgPersonRelationType = type; |
121 | 0 | } |
122 | |
|
123 | |
public String getState() { |
124 | 0 | return state; |
125 | |
} |
126 | |
|
127 | |
public void setState(String state) { |
128 | 0 | this.state = state; |
129 | 0 | } |
130 | |
|
131 | |
} |