| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| RuleExpressionDef |
|
| 1.625;1.625 |
| 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 java.util.LinkedHashMap; | |
| 19 | ||
| 20 | import javax.persistence.Column; | |
| 21 | import javax.persistence.Entity; | |
| 22 | import javax.persistence.Id; | |
| 23 | import javax.persistence.Table; | |
| 24 | ||
| 25 | import org.apache.commons.lang.ObjectUtils; | |
| 26 | import org.kuali.rice.core.jpa.annotations.Sequence; | |
| 27 | import org.kuali.rice.kew.bo.KewPersistableBusinessObjectBase; | |
| 28 | ||
| 29 | /** | |
| 30 | * BO for rule expressions | |
| 31 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 32 | */ | |
| 33 | @Entity | |
| 34 | @Table(name="KREW_RULE_EXPR_T") | |
| 35 | @Sequence(name="KREW_RULE_EXPR_S", property="id") | |
| 36 | 0 | public class RuleExpressionDef extends KewPersistableBusinessObjectBase { |
| 37 | ||
| 38 | /** | |
| 39 | * Primary key | |
| 40 | */ | |
| 41 | @Id | |
| 42 | @Column(name="RULE_EXPR_ID") | |
| 43 | private Long id; | |
| 44 | /** | |
| 45 | * The type of the expression | |
| 46 | */ | |
| 47 | @Column(name="TYP") | |
| 48 | private String type; | |
| 49 | /** | |
| 50 | * The content of the expression | |
| 51 | */ | |
| 52 | @Column(name="RULE_EXPR", nullable=true) | |
| 53 | private String expression; | |
| 54 | /** | |
| 55 | * @return the id | |
| 56 | */ | |
| 57 | public Long getId() { | |
| 58 | 0 | return this.id; |
| 59 | } | |
| 60 | /** | |
| 61 | * @param id the id to set | |
| 62 | */ | |
| 63 | public void setId(Long id) { | |
| 64 | 0 | this.id = id; |
| 65 | 0 | } |
| 66 | /** | |
| 67 | * @return the type | |
| 68 | */ | |
| 69 | public String getType() { | |
| 70 | 0 | return this.type; |
| 71 | } | |
| 72 | /** | |
| 73 | * @param type the type to set | |
| 74 | */ | |
| 75 | public void setType(String type) { | |
| 76 | 0 | this.type = type; |
| 77 | 0 | } |
| 78 | /** | |
| 79 | * @return the expression | |
| 80 | */ | |
| 81 | public String getExpression() { | |
| 82 | 0 | return this.expression; |
| 83 | } | |
| 84 | /** | |
| 85 | * @param expression the expression to set | |
| 86 | */ | |
| 87 | public void setExpression(String expression) { | |
| 88 | 0 | this.expression = expression; |
| 89 | 0 | } |
| 90 | ||
| 91 | /** | |
| 92 | * Returns whether the object is an <i>equivalent</i> rule expression, i.e. | |
| 93 | * the type and expression are the same. This is necessary for rule duplicate | |
| 94 | * detection. | |
| 95 | * @see java.lang.Object#equals(java.lang.Object) | |
| 96 | */ | |
| 97 | @Override | |
| 98 | public boolean equals(Object obj) { | |
| 99 | 0 | if (obj == null) return false; |
| 100 | 0 | if (!(obj instanceof RuleExpressionDef)) return false; |
| 101 | 0 | RuleExpressionDef arg = (RuleExpressionDef) obj; |
| 102 | 0 | return ObjectUtils.equals(type, arg.getType()) && ObjectUtils.equals(expression, arg.getExpression()); |
| 103 | } | |
| 104 | /** | |
| 105 | * This overridden method ... | |
| 106 | * | |
| 107 | * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper() | |
| 108 | */ | |
| 109 | @Override | |
| 110 | protected LinkedHashMap toStringMapper() { | |
| 111 | 0 | LinkedHashMap map = new LinkedHashMap(); |
| 112 | 0 | map.put("type", type); |
| 113 | 0 | map.put("expression", expression); |
| 114 | 0 | return map; |
| 115 | } | |
| 116 | ||
| 117 | ||
| 118 | } |