| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
package org.kuali.rice.kew.rule; |
| 18 |
|
|
| 19 |
|
import org.apache.commons.lang.ObjectUtils; |
| 20 |
|
import org.apache.commons.lang.builder.HashCodeBuilder; |
| 21 |
|
import org.hibernate.annotations.GenericGenerator; |
| 22 |
|
import org.hibernate.annotations.Parameter; |
| 23 |
|
import org.kuali.rice.core.api.reflect.ObjectDefinition; |
| 24 |
|
import org.kuali.rice.core.api.reflect.ObjectDefinition; |
| 25 |
|
import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; |
| 26 |
|
import org.kuali.rice.kew.actionrequest.ActionRequestValue; |
| 27 |
|
import org.kuali.rice.kew.exception.WorkflowException; |
| 28 |
|
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 29 |
|
import org.kuali.rice.kew.util.KEWConstants; |
| 30 |
|
import org.kuali.rice.kim.bo.Group; |
| 31 |
|
import org.kuali.rice.kim.bo.entity.KimPrincipal; |
| 32 |
|
import org.kuali.rice.kim.service.KIMServiceLocator; |
| 33 |
|
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase; |
| 34 |
|
|
| 35 |
|
import javax.persistence.*; |
| 36 |
|
import java.util.List; |
| 37 |
|
|
| 38 |
|
|
| 39 |
|
|
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
@link |
| 44 |
|
|
| 45 |
|
@author |
| 46 |
|
|
| 47 |
|
@Entity |
| 48 |
|
@Table(name="KREW_RULE_RSP_T") |
| 49 |
|
|
|
|
|
| 0% |
Uncovered Elements: 124 (124) |
Complexity: 48 |
Complexity Density: 0.75 |
|
| 50 |
|
public class RuleResponsibility extends PersistableBusinessObjectBase { |
| 51 |
|
|
| 52 |
|
private static final long serialVersionUID = -1565688857123316797L; |
| 53 |
|
@Id |
| 54 |
|
@GeneratedValue(generator="KREW_RSP_S") |
| 55 |
|
@GenericGenerator(name="KREW_RSP_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
| 56 |
|
@Parameter(name="sequence_name",value="KREW_RSP_S"), |
| 57 |
|
@Parameter(name="value_column",value="id") |
| 58 |
|
}) |
| 59 |
|
@Column(name="RULE_RSP_ID") |
| 60 |
|
private Long ruleResponsibilityKey; |
| 61 |
|
@Column(name="RSP_ID") |
| 62 |
|
private Long responsibilityId; |
| 63 |
|
@Column(name="RULE_ID", insertable=false, updatable=false) |
| 64 |
|
private Long ruleBaseValuesId; |
| 65 |
|
@Column(name="ACTN_RQST_CD") |
| 66 |
|
private String actionRequestedCd; |
| 67 |
|
@Column(name="NM") |
| 68 |
|
private String ruleResponsibilityName; |
| 69 |
|
@Column(name="TYP") |
| 70 |
|
private String ruleResponsibilityType; |
| 71 |
|
@Column(name="PRIO") |
| 72 |
|
private Integer priority; |
| 73 |
|
@Column(name="APPR_PLCY") |
| 74 |
|
private String approvePolicy; |
| 75 |
|
|
| 76 |
|
@ManyToOne(fetch=FetchType.EAGER) |
| 77 |
|
@JoinColumn(name="RULE_ID") |
| 78 |
|
private RuleBaseValues ruleBaseValues; |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 83 |
0
|
public KimPrincipal getPrincipal() ... |
| 84 |
|
{ |
| 85 |
0
|
if (isUsingWorkflowUser()) { |
| 86 |
0
|
return KEWServiceLocator.getIdentityHelperService().getPrincipal(ruleResponsibilityName); |
| 87 |
|
} |
| 88 |
0
|
return null; |
| 89 |
|
} |
| 90 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 91 |
0
|
public Group getGroup() {... |
| 92 |
0
|
if (isUsingGroup()) { |
| 93 |
0
|
return KIMServiceLocator.getIdentityManagementService().getGroup(ruleResponsibilityName); |
| 94 |
|
} |
| 95 |
0
|
return null; |
| 96 |
|
} |
| 97 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 98 |
0
|
public String getRole() {... |
| 99 |
0
|
if (isUsingRole()) { |
| 100 |
0
|
return ruleResponsibilityName; |
| 101 |
|
} |
| 102 |
0
|
return null; |
| 103 |
|
} |
| 104 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 105 |
0
|
public String getResolvedRoleName() {... |
| 106 |
0
|
if (isUsingRole()) { |
| 107 |
0
|
return getRole().substring(getRole().indexOf("!") + 1, getRole().length()); |
| 108 |
|
} |
| 109 |
0
|
return null; |
| 110 |
|
} |
| 111 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 112 |
0
|
public String getRoleAttributeName() {... |
| 113 |
0
|
return getRole().substring(0, getRole().indexOf("!")); |
| 114 |
|
} |
| 115 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 116 |
0
|
public RoleAttribute resolveRoleAttribute() throws WorkflowException {... |
| 117 |
0
|
if (isUsingRole()) { |
| 118 |
0
|
String attributeName = getRoleAttributeName(); |
| 119 |
0
|
return (RoleAttribute) GlobalResourceLoader.getResourceLoader().getObject(new ObjectDefinition(attributeName)); |
| 120 |
|
} |
| 121 |
0
|
return null; |
| 122 |
|
} |
| 123 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 124 |
0
|
public boolean isUsingRole() {... |
| 125 |
0
|
return (ruleResponsibilityName != null && ruleResponsibilityType != null && ruleResponsibilityType.equals(KEWConstants.RULE_RESPONSIBILITY_ROLE_ID)); |
| 126 |
|
} |
| 127 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 128 |
0
|
public boolean isUsingWorkflowUser() {... |
| 129 |
0
|
return (ruleResponsibilityName != null && !ruleResponsibilityName.trim().equals("") && ruleResponsibilityType != null && ruleResponsibilityType.equals(KEWConstants.RULE_RESPONSIBILITY_WORKFLOW_ID)); |
| 130 |
|
} |
| 131 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 132 |
0
|
public boolean isUsingGroup() {... |
| 133 |
0
|
return (ruleResponsibilityName != null && !ruleResponsibilityName.trim().equals("") && ruleResponsibilityType != null && ruleResponsibilityType.equals(KEWConstants.RULE_RESPONSIBILITY_GROUP_ID)); |
| 134 |
|
} |
| 135 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 136 |
0
|
public Long getRuleBaseValuesId() {... |
| 137 |
0
|
return ruleBaseValuesId; |
| 138 |
|
} |
| 139 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 140 |
0
|
public void setRuleBaseValuesId(Long ruleBaseValuesId) {... |
| 141 |
0
|
this.ruleBaseValuesId = ruleBaseValuesId; |
| 142 |
|
} |
| 143 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 144 |
0
|
public RuleBaseValues getRuleBaseValues() {... |
| 145 |
0
|
return ruleBaseValues; |
| 146 |
|
} |
| 147 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 148 |
0
|
public void setRuleBaseValues(RuleBaseValues ruleBaseValues) {... |
| 149 |
0
|
this.ruleBaseValues = ruleBaseValues; |
| 150 |
|
} |
| 151 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 152 |
0
|
public String getActionRequestedCd() {... |
| 153 |
0
|
return actionRequestedCd; |
| 154 |
|
} |
| 155 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 156 |
0
|
public void setActionRequestedCd(String actionRequestedCd) {... |
| 157 |
0
|
this.actionRequestedCd = actionRequestedCd; |
| 158 |
|
} |
| 159 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 160 |
0
|
public Long getRuleResponsibilityKey() {... |
| 161 |
0
|
return ruleResponsibilityKey; |
| 162 |
|
} |
| 163 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 164 |
0
|
public void setRuleResponsibilityKey(Long ruleResponsibilityId) {... |
| 165 |
0
|
this.ruleResponsibilityKey = ruleResponsibilityId; |
| 166 |
|
} |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 167 |
0
|
public Integer getPriority() {... |
| 168 |
0
|
return priority; |
| 169 |
|
} |
| 170 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 171 |
0
|
public void setPriority(Integer priority) {... |
| 172 |
0
|
this.priority = priority; |
| 173 |
|
} |
| 174 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 175 |
0
|
public String getApprovePolicy() {... |
| 176 |
0
|
return approvePolicy; |
| 177 |
|
} |
| 178 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 179 |
0
|
public void setApprovePolicy(String approvePolicy) {... |
| 180 |
0
|
this.approvePolicy = approvePolicy; |
| 181 |
|
} |
| 182 |
|
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 8 |
Complexity Density: 0.53 |
|
| 183 |
0
|
public Object copy(boolean preserveKeys) {... |
| 184 |
0
|
RuleResponsibility ruleResponsibilityClone = new RuleResponsibility(); |
| 185 |
0
|
ruleResponsibilityClone.setApprovePolicy(getApprovePolicy()); |
| 186 |
0
|
if (actionRequestedCd != null) { |
| 187 |
0
|
ruleResponsibilityClone.setActionRequestedCd(actionRequestedCd); |
| 188 |
|
} |
| 189 |
0
|
if (ruleResponsibilityKey != null && preserveKeys) { |
| 190 |
0
|
ruleResponsibilityClone.setRuleResponsibilityKey(ruleResponsibilityKey); |
| 191 |
|
} |
| 192 |
|
|
| 193 |
0
|
if (responsibilityId != null) { |
| 194 |
0
|
ruleResponsibilityClone.setResponsibilityId(responsibilityId); |
| 195 |
|
} |
| 196 |
|
|
| 197 |
0
|
if (ruleResponsibilityName != null) { |
| 198 |
0
|
ruleResponsibilityClone.setRuleResponsibilityName(ruleResponsibilityName); |
| 199 |
|
} |
| 200 |
0
|
if (ruleResponsibilityType != null) { |
| 201 |
0
|
ruleResponsibilityClone.setRuleResponsibilityType(ruleResponsibilityType); |
| 202 |
|
} |
| 203 |
0
|
if (priority != null) { |
| 204 |
0
|
ruleResponsibilityClone.setPriority(priority); |
| 205 |
|
} |
| 206 |
|
|
| 207 |
|
|
| 208 |
|
|
| 209 |
|
|
| 210 |
|
|
| 211 |
|
|
| 212 |
|
|
| 213 |
|
|
| 214 |
|
|
| 215 |
0
|
return ruleResponsibilityClone; |
| 216 |
|
} |
| 217 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 218 |
0
|
public String getRuleResponsibilityName() {... |
| 219 |
0
|
return ruleResponsibilityName; |
| 220 |
|
} |
| 221 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 222 |
0
|
public void setRuleResponsibilityName(String ruleResponsibilityName) {... |
| 223 |
0
|
this.ruleResponsibilityName = ruleResponsibilityName; |
| 224 |
|
} |
| 225 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 226 |
0
|
public String getRuleResponsibilityType() {... |
| 227 |
0
|
return ruleResponsibilityType; |
| 228 |
|
} |
| 229 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 230 |
0
|
public void setRuleResponsibilityType(String ruleResponsibilityType) {... |
| 231 |
0
|
this.ruleResponsibilityType = ruleResponsibilityType; |
| 232 |
|
} |
| 233 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 234 |
0
|
public Long getResponsibilityId() {... |
| 235 |
0
|
return responsibilityId; |
| 236 |
|
} |
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 237 |
0
|
public void setResponsibilityId(Long responsibilityId) {... |
| 238 |
0
|
this.responsibilityId = responsibilityId; |
| 239 |
|
} |
| 240 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 241 |
0
|
public List<RuleDelegation> getDelegationRules() {... |
| 242 |
0
|
return KEWServiceLocator.getRuleDelegationService().findByResponsibilityId(getResponsibilityId()); |
| 243 |
|
} |
| 244 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 245 |
0
|
public RuleDelegation getDelegationRule(int index) {... |
| 246 |
0
|
return getDelegationRules().get(index); |
| 247 |
|
} |
| 248 |
|
|
| 249 |
|
|
| 250 |
|
|
| 251 |
|
|
| 252 |
|
|
| 253 |
|
|
| 254 |
|
|
| 255 |
|
|
| 256 |
|
|
| 257 |
|
|
| 258 |
|
|
| 259 |
|
|
| 260 |
|
|
| 261 |
|
|
| 262 |
|
|
| 263 |
|
|
| 264 |
|
|
| 265 |
|
|
| 266 |
|
|
| 267 |
|
|
| 268 |
|
|
| 269 |
|
|
| 270 |
|
|
| 271 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 272 |
0
|
public String getActionRequestedDisplayValue() {... |
| 273 |
0
|
return KEWConstants.ACTION_REQUEST_CODES.get(getActionRequestedCd()); |
| 274 |
|
} |
| 275 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 276 |
0
|
public String getRuleResponsibilityTypeDisplayValue() {... |
| 277 |
0
|
return KEWConstants.RULE_RESPONSIBILITY_TYPES.get(getRuleResponsibilityType()); |
| 278 |
|
} |
| 279 |
|
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 280 |
0
|
public boolean equals(Object o) {... |
| 281 |
0
|
if (o == null) return false; |
| 282 |
0
|
if (!(o instanceof RuleResponsibility)) return false; |
| 283 |
0
|
RuleResponsibility pred = (RuleResponsibility) o; |
| 284 |
0
|
return ObjectUtils.equals(ruleResponsibilityName, pred.getRuleResponsibilityName()) && |
| 285 |
|
ObjectUtils.equals(actionRequestedCd, pred.getActionRequestedCd()) && |
| 286 |
|
ObjectUtils.equals(priority, pred.getPriority()) && |
| 287 |
|
ObjectUtils.equals(approvePolicy, pred.getApprovePolicy()); |
| 288 |
|
} |
| 289 |
|
|
| 290 |
|
|
| 291 |
|
@see |
| 292 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 293 |
0
|
@Override... |
| 294 |
|
public int hashCode() { |
| 295 |
0
|
return new HashCodeBuilder() |
| 296 |
|
.append(this.actionRequestedCd) |
| 297 |
|
.append(this.approvePolicy) |
| 298 |
|
.append(this.priority) |
| 299 |
|
.append(this.ruleResponsibilityName).toHashCode(); |
| 300 |
|
} |
| 301 |
|
} |