1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.statement.entity; |
17 | |
|
18 | |
import java.util.List; |
19 | |
|
20 | |
import javax.persistence.CascadeType; |
21 | |
import javax.persistence.Column; |
22 | |
import javax.persistence.Entity; |
23 | |
import javax.persistence.EnumType; |
24 | |
import javax.persistence.Enumerated; |
25 | |
import javax.persistence.JoinColumn; |
26 | |
import javax.persistence.JoinTable; |
27 | |
import javax.persistence.ManyToMany; |
28 | |
import javax.persistence.ManyToOne; |
29 | |
import javax.persistence.NamedQueries; |
30 | |
import javax.persistence.NamedQuery; |
31 | |
import javax.persistence.OneToMany; |
32 | |
import javax.persistence.Table; |
33 | |
|
34 | |
import org.kuali.student.common.entity.AttributeOwner; |
35 | |
import org.kuali.student.common.entity.MetaEntity; |
36 | |
import org.kuali.student.core.statement.dto.StatementOperatorTypeKey; |
37 | |
|
38 | |
@Entity |
39 | |
@Table(name = "KSST_STMT") |
40 | |
@NamedQueries( { |
41 | |
@NamedQuery(name = "Statement.getStatementsForStatementType", query = "SELECT ls FROM Statement ls WHERE ls.statementType.id = :statementTypeKey"), |
42 | |
@NamedQuery(name = "Statement.getStatements", query = "SELECT ls FROM Statement ls WHERE ls.id IN (:statementIdList)"), |
43 | |
@NamedQuery(name = "Statement.getStatementsForReqComponent", query = "SELECT ls FROM Statement ls JOIN ls.requiredComponents req WHERE req.id = :reqComponentId"), |
44 | |
@NamedQuery(name = "Statement.getParentStatement", query = "SELECT DISTINCT stmt FROM Statement stmt JOIN stmt.children children WHERE children.id = :childId") |
45 | |
}) |
46 | 0 | public class Statement extends MetaEntity implements AttributeOwner<StatementAttribute>{ |
47 | |
|
48 | |
@Column(name="NAME") |
49 | |
private String name; |
50 | |
|
51 | |
@ManyToOne(cascade=CascadeType.ALL) |
52 | |
@JoinColumn(name = "RT_DESCR_ID") |
53 | |
private StatementRichText descr; |
54 | |
|
55 | |
@Column(name="ST") |
56 | |
private String state; |
57 | |
|
58 | |
@Column(name="OPERATOR") |
59 | |
@Enumerated(EnumType.STRING) |
60 | |
private StatementOperatorTypeKey operator; |
61 | |
|
62 | |
@OneToMany(cascade = {CascadeType.ALL}) |
63 | |
@JoinTable(name = "KSST_STMT_JN_STMT", joinColumns = @JoinColumn(name = "STMT_ID"), inverseJoinColumns = @JoinColumn(name = "CHLD_STMT_ID")) |
64 | |
private List<Statement> children; |
65 | |
|
66 | |
@ManyToMany |
67 | |
@JoinTable(name = "KSST_STMT_JN_REQ_COM", joinColumns = @JoinColumn(name = "STMT_ID"), inverseJoinColumns = @JoinColumn(name = "REQ_COM_ID")) |
68 | |
private List<ReqComponent> requiredComponents; |
69 | |
|
70 | |
@ManyToOne |
71 | |
@JoinColumn(name = "STMT_TYPE_ID") |
72 | |
private StatementType statementType; |
73 | |
|
74 | |
@OneToMany(cascade = CascadeType.ALL) |
75 | |
@JoinColumn(name = "OWNER") |
76 | |
private List<StatementAttribute> attributes; |
77 | |
|
78 | |
@OneToMany(mappedBy = "statement") |
79 | |
private List<RefStatementRelation> refStatementRelations; |
80 | |
|
81 | |
public List<Statement> getChildren() { |
82 | 0 | return children; |
83 | |
} |
84 | |
|
85 | |
public void setChildren(List<Statement> children) { |
86 | 0 | this.children = children; |
87 | 0 | } |
88 | |
|
89 | |
public List<ReqComponent> getRequiredComponents() { |
90 | 0 | return requiredComponents; |
91 | |
} |
92 | |
|
93 | |
public void setRequiredComponents(List<ReqComponent> requiredComponents) { |
94 | 0 | this.requiredComponents = requiredComponents; |
95 | 0 | } |
96 | |
|
97 | |
public StatementType getStatementType() { |
98 | 0 | return statementType; |
99 | |
} |
100 | |
|
101 | |
public void setStatementType(StatementType statementType) { |
102 | 0 | this.statementType = statementType; |
103 | 0 | } |
104 | |
|
105 | |
public StatementOperatorTypeKey getOperator() { |
106 | 0 | return operator; |
107 | |
} |
108 | |
|
109 | |
public void setOperator(StatementOperatorTypeKey operator) { |
110 | 0 | this.operator = operator; |
111 | 0 | } |
112 | |
|
113 | |
public String getName() { |
114 | 0 | return name; |
115 | |
} |
116 | |
|
117 | |
public void setName(String name) { |
118 | 0 | this.name = name; |
119 | 0 | } |
120 | |
|
121 | |
public StatementRichText getDescr() { |
122 | 0 | return descr; |
123 | |
} |
124 | |
|
125 | |
public void setDescr(StatementRichText descr) { |
126 | 0 | this.descr = descr; |
127 | 0 | } |
128 | |
|
129 | |
@Override |
130 | |
public List<StatementAttribute> getAttributes() { |
131 | 0 | return attributes; |
132 | |
} |
133 | |
|
134 | |
@Override |
135 | |
public void setAttributes(List<StatementAttribute> attributes) { |
136 | 0 | this.attributes=attributes; |
137 | 0 | } |
138 | |
|
139 | |
public String getState() { |
140 | 0 | return state; |
141 | |
} |
142 | |
|
143 | |
public void setState(String state) { |
144 | 0 | this.state = state; |
145 | 0 | } |
146 | |
|
147 | |
public List<RefStatementRelation> getRefStatementRelations() { |
148 | 0 | return refStatementRelations; |
149 | |
} |
150 | |
|
151 | |
public void setRefStatementRelations( |
152 | |
List<RefStatementRelation> refStatementRelations) { |
153 | 0 | this.refStatementRelations = refStatementRelations; |
154 | 0 | } |
155 | |
|
156 | |
@Override |
157 | |
public String toString() { |
158 | 0 | return "Statement[id=" + getId() + ", statementType=" |
159 | |
+ (statementType == null ? "null" : statementType.getId()) |
160 | |
+ ", operator=" + operator + "]"; |
161 | |
} |
162 | |
} |