Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RuleExpressionDef |
|
| 1.7142857142857142;1.714 |
1 | /* | |
2 | * Copyright 2007 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.kuali.rice.kew.rule; | |
17 | ||
18 | import org.apache.commons.lang.ObjectUtils; | |
19 | import org.hibernate.annotations.GenericGenerator; | |
20 | import org.hibernate.annotations.Parameter; | |
21 | import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; | |
22 | ||
23 | import javax.persistence.*; | |
24 | ||
25 | /** | |
26 | * BO for rule expressions | |
27 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
28 | */ | |
29 | @Entity | |
30 | @Table(name="KREW_RULE_EXPR_T") | |
31 | //@Sequence(name="KREW_RULE_EXPR_S", property="id") | |
32 | 0 | public class RuleExpressionDef extends PersistableBusinessObjectBase { |
33 | ||
34 | /** | |
35 | * Primary key | |
36 | */ | |
37 | @Id | |
38 | @GeneratedValue(generator="KREW_RULE_EXPR_S") | |
39 | @GenericGenerator(name="KREW_RULE_EXPR_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ | |
40 | @Parameter(name="sequence_name",value="KREW_RULE_EXPR_S"), | |
41 | @Parameter(name="value_column",value="id") | |
42 | }) | |
43 | @Column(name="RULE_EXPR_ID") | |
44 | private Long id; | |
45 | /** | |
46 | * The type of the expression | |
47 | */ | |
48 | @Column(name="TYP") | |
49 | private String type; | |
50 | /** | |
51 | * The content of the expression | |
52 | */ | |
53 | @Column(name="RULE_EXPR", nullable=true) | |
54 | private String expression; | |
55 | /** | |
56 | * @return the id | |
57 | */ | |
58 | public Long getId() { | |
59 | 0 | return this.id; |
60 | } | |
61 | /** | |
62 | * @param id the id to set | |
63 | */ | |
64 | public void setId(Long id) { | |
65 | 0 | this.id = id; |
66 | 0 | } |
67 | /** | |
68 | * @return the type | |
69 | */ | |
70 | public String getType() { | |
71 | 0 | return this.type; |
72 | } | |
73 | /** | |
74 | * @param type the type to set | |
75 | */ | |
76 | public void setType(String type) { | |
77 | 0 | this.type = type; |
78 | 0 | } |
79 | /** | |
80 | * @return the expression | |
81 | */ | |
82 | public String getExpression() { | |
83 | 0 | return this.expression; |
84 | } | |
85 | /** | |
86 | * @param expression the expression to set | |
87 | */ | |
88 | public void setExpression(String expression) { | |
89 | 0 | this.expression = expression; |
90 | 0 | } |
91 | ||
92 | /** | |
93 | * Returns whether the object is an <i>equivalent</i> rule expression, i.e. | |
94 | * the type and expression are the same. This is necessary for rule duplicate | |
95 | * detection. | |
96 | * @see java.lang.Object#equals(java.lang.Object) | |
97 | */ | |
98 | @Override | |
99 | public boolean equals(Object obj) { | |
100 | 0 | if (obj == null) return false; |
101 | 0 | if (!(obj instanceof RuleExpressionDef)) return false; |
102 | 0 | RuleExpressionDef arg = (RuleExpressionDef) obj; |
103 | 0 | return ObjectUtils.equals(type, arg.getType()) && ObjectUtils.equals(expression, arg.getExpression()); |
104 | } | |
105 | } |