| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kew.rule; |
| 17 | |
|
| 18 | |
import org.hibernate.annotations.Fetch; |
| 19 | |
import org.hibernate.annotations.FetchMode; |
| 20 | |
import org.hibernate.annotations.GenericGenerator; |
| 21 | |
import org.hibernate.annotations.Parameter; |
| 22 | |
import org.joda.time.DateTime; |
| 23 | |
import org.kuali.rice.core.api.util.RiceConstants; |
| 24 | |
import org.kuali.rice.kew.api.rule.RuleContract; |
| 25 | |
import org.kuali.rice.kew.api.util.CodeTranslator; |
| 26 | |
import org.kuali.rice.kew.doctype.bo.DocumentType; |
| 27 | |
import org.kuali.rice.kew.lookupable.MyColumns; |
| 28 | |
import org.kuali.rice.kew.routeheader.DocumentContent; |
| 29 | |
import org.kuali.rice.kew.rule.bo.RuleAttribute; |
| 30 | |
import org.kuali.rice.kew.rule.bo.RuleTemplateAttributeBo; |
| 31 | |
import org.kuali.rice.kew.rule.bo.RuleTemplateBo; |
| 32 | |
import org.kuali.rice.kew.rule.service.RuleServiceInternal; |
| 33 | |
import org.kuali.rice.kew.rule.xmlrouting.GenericXMLRuleAttribute; |
| 34 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 35 | |
import org.kuali.rice.kew.api.KewApiConstants; |
| 36 | |
import org.kuali.rice.kim.impl.identity.PersonImpl; |
| 37 | |
import org.kuali.rice.kns.web.ui.Field; |
| 38 | |
import org.kuali.rice.kns.web.ui.Row; |
| 39 | |
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase; |
| 40 | |
|
| 41 | |
import javax.persistence.CascadeType; |
| 42 | |
import javax.persistence.Column; |
| 43 | |
import javax.persistence.Entity; |
| 44 | |
import javax.persistence.FetchType; |
| 45 | |
import javax.persistence.GeneratedValue; |
| 46 | |
import javax.persistence.Id; |
| 47 | |
import javax.persistence.JoinColumn; |
| 48 | |
import javax.persistence.ManyToOne; |
| 49 | |
import javax.persistence.OneToMany; |
| 50 | |
import javax.persistence.OneToOne; |
| 51 | |
import javax.persistence.Table; |
| 52 | |
import javax.persistence.Transient; |
| 53 | |
import java.sql.Timestamp; |
| 54 | |
import java.util.ArrayList; |
| 55 | |
import java.util.Date; |
| 56 | |
import java.util.HashMap; |
| 57 | |
import java.util.Iterator; |
| 58 | |
import java.util.List; |
| 59 | |
import java.util.Map; |
| 60 | |
|
| 61 | |
|
| 62 | |
|
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | 0 | @Entity |
| 70 | |
@Table(name="KREW_RULE_T") |
| 71 | |
|
| 72 | |
public class RuleBaseValues extends PersistableBusinessObjectBase implements RuleContract { |
| 73 | |
|
| 74 | |
private static final long serialVersionUID = 6137765574728530156L; |
| 75 | |
@Id |
| 76 | |
@GeneratedValue(generator="KREW_RTE_TMPL_S") |
| 77 | |
@GenericGenerator(name="KREW_RTE_TMPL_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ |
| 78 | |
@Parameter(name="sequence_name",value="KREW_RTE_TMPL_S"), |
| 79 | |
@Parameter(name="value_column",value="id") |
| 80 | |
}) |
| 81 | |
@Column(name="RULE_ID") |
| 82 | |
private String id; |
| 83 | |
|
| 84 | |
|
| 85 | |
|
| 86 | |
@Column(name="NM") |
| 87 | |
private String name; |
| 88 | |
@Column(name="RULE_TMPL_ID", insertable=false, updatable=false) |
| 89 | |
private String ruleTemplateId; |
| 90 | |
@Column(name="PREV_VER_RULE_ID") |
| 91 | |
private String previousRuleId; |
| 92 | 0 | @Column(name="ACTV_IND") |
| 93 | |
private boolean active = true; |
| 94 | |
@Column(name="RULE_BASE_VAL_DESC") |
| 95 | |
private String description; |
| 96 | |
@Column(name="DOC_TYP_NM") |
| 97 | |
private String docTypeName; |
| 98 | |
@Column(name="DOC_HDR_ID") |
| 99 | |
private String documentId; |
| 100 | |
@Column(name="FRM_DT") |
| 101 | |
private Timestamp fromDateValue; |
| 102 | |
@Column(name="TO_DT") |
| 103 | |
private Timestamp toDateValue; |
| 104 | |
@Column(name="DACTVN_DT") |
| 105 | |
private Timestamp deactivationDate; |
| 106 | 0 | @Column(name="CUR_IND") |
| 107 | |
private Boolean currentInd = Boolean.TRUE; |
| 108 | 0 | @Column(name="RULE_VER_NBR") |
| 109 | |
private Integer versionNbr = new Integer(0); |
| 110 | |
@Column(name="FRC_ACTN") |
| 111 | |
private boolean forceAction; |
| 112 | |
@Fetch(value = FetchMode.SELECT) |
| 113 | |
@OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE},mappedBy="ruleBaseValues") |
| 114 | |
private List<RuleResponsibilityBo> ruleResponsibilities; |
| 115 | |
@Fetch(value = FetchMode.SELECT) |
| 116 | |
@OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE},mappedBy="ruleBaseValues") |
| 117 | |
private List<RuleExtensionBo> ruleExtensions; |
| 118 | |
@ManyToOne(fetch=FetchType.EAGER) |
| 119 | |
@JoinColumn(name="RULE_TMPL_ID") |
| 120 | |
private RuleTemplateBo ruleTemplate; |
| 121 | |
@OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE}) |
| 122 | |
@JoinColumn(name="RULE_EXPR_ID") |
| 123 | |
private RuleExpressionDef ruleExpressionDef; |
| 124 | |
@Transient |
| 125 | |
private RuleBaseValues previousVersion; |
| 126 | |
@Column(name="ACTVN_DT") |
| 127 | |
private Timestamp activationDate; |
| 128 | 0 | @Column(name="DLGN_IND") |
| 129 | |
private Boolean delegateRule = Boolean.FALSE; |
| 130 | |
|
| 131 | |
|
| 132 | |
|
| 133 | |
|
| 134 | 0 | @Column(name="TMPL_RULE_IND") |
| 135 | |
private Boolean templateRuleInd = Boolean.FALSE; |
| 136 | |
|
| 137 | |
|
| 138 | |
@Transient |
| 139 | |
private String returnUrl; |
| 140 | |
@Transient |
| 141 | |
private String destinationUrl; |
| 142 | |
@Transient |
| 143 | |
private MyColumns myColumns; |
| 144 | 0 | @Transient |
| 145 | |
private List<PersonRuleResponsibility> personResponsibilities = new ArrayList<PersonRuleResponsibility>(); |
| 146 | 0 | @Transient |
| 147 | |
private List<GroupRuleResponsibility> groupResponsibilities = new ArrayList<GroupRuleResponsibility>(); |
| 148 | 0 | @Transient |
| 149 | |
private List<RoleRuleResponsibility> roleResponsibilities = new ArrayList<RoleRuleResponsibility>(); |
| 150 | |
@Transient |
| 151 | |
private Map<String, String> fieldValues; |
| 152 | |
@Transient |
| 153 | |
private String groupReviewerName; |
| 154 | |
@Transient |
| 155 | |
private String groupReviewerNamespace; |
| 156 | |
@Transient |
| 157 | |
private String personReviewer; |
| 158 | |
@Transient |
| 159 | |
private String personReviewerType; |
| 160 | |
|
| 161 | 0 | public RuleBaseValues() { |
| 162 | 0 | ruleResponsibilities = new ArrayList<RuleResponsibilityBo>(); |
| 163 | 0 | ruleExtensions = new ArrayList<RuleExtensionBo>(); |
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | 0 | fieldValues = new HashMap<String, String>(); |
| 168 | 0 | } |
| 169 | |
|
| 170 | |
|
| 171 | |
|
| 172 | |
|
| 173 | |
public RuleExpressionDef getRuleExpressionDef() { |
| 174 | 0 | return ruleExpressionDef; |
| 175 | |
} |
| 176 | |
|
| 177 | |
|
| 178 | |
|
| 179 | |
|
| 180 | |
public void setRuleExpressionDef(RuleExpressionDef ruleExpressionDef) { |
| 181 | 0 | this.ruleExpressionDef = ruleExpressionDef; |
| 182 | 0 | } |
| 183 | |
|
| 184 | |
public Map getRuleExtensionValueLabels() { |
| 185 | 0 | Map extensionLabels = new HashMap(); |
| 186 | 0 | for (RuleExtensionBo ruleExtension : getRuleExtensions()) { |
| 187 | 0 | if (!ruleExtension.getRuleTemplateAttribute().isWorkflowAttribute()) { |
| 188 | 0 | continue; |
| 189 | |
} |
| 190 | 0 | WorkflowRuleAttribute workflowAttribute = ruleExtension.getRuleTemplateAttribute().getWorkflowAttribute(); |
| 191 | |
|
| 192 | 0 | RuleAttribute ruleAttribute = ruleExtension.getRuleTemplateAttribute().getRuleAttribute(); |
| 193 | |
|
| 194 | |
|
| 195 | |
|
| 196 | 0 | for (Row row : workflowAttribute.getRuleRows()) { |
| 197 | 0 | for (Field field : row.getFields()) { |
| 198 | 0 | extensionLabels.put(field.getPropertyName(), field.getFieldLabel()); |
| 199 | |
} |
| 200 | |
} |
| 201 | 0 | } |
| 202 | 0 | return extensionLabels; |
| 203 | |
} |
| 204 | |
|
| 205 | |
public String getRuleTemplateName() { |
| 206 | 0 | if (ruleTemplate != null) { |
| 207 | 0 | return ruleTemplate.getName(); |
| 208 | |
} |
| 209 | 0 | return null; |
| 210 | |
} |
| 211 | |
|
| 212 | |
public RuleBaseValues getPreviousVersion() { |
| 213 | 0 | if (previousVersion == null && previousRuleId != null) { |
| 214 | 0 | RuleServiceInternal ruleService = (RuleServiceInternal) KEWServiceLocator.getService(KEWServiceLocator.RULE_SERVICE); |
| 215 | 0 | return ruleService.findRuleBaseValuesById(previousRuleId); |
| 216 | |
} |
| 217 | 0 | return previousVersion; |
| 218 | |
} |
| 219 | |
|
| 220 | |
public void setPreviousVersion(RuleBaseValues previousVersion) { |
| 221 | 0 | this.previousVersion = previousVersion; |
| 222 | 0 | } |
| 223 | |
|
| 224 | |
public RuleResponsibilityBo getResponsibility(int index) { |
| 225 | 0 | while (getRuleResponsibilities().size() <= index) { |
| 226 | 0 | RuleResponsibilityBo ruleResponsibility = new RuleResponsibilityBo(); |
| 227 | 0 | ruleResponsibility.setRuleBaseValues(this); |
| 228 | 0 | getRuleResponsibilities().add(ruleResponsibility); |
| 229 | 0 | } |
| 230 | 0 | return (RuleResponsibilityBo) getRuleResponsibilities().get(index); |
| 231 | |
} |
| 232 | |
|
| 233 | |
public RuleExtensionBo getRuleExtension(int index) { |
| 234 | 0 | while (getRuleExtensions().size() <= index) { |
| 235 | 0 | getRuleExtensions().add(new RuleExtensionBo()); |
| 236 | |
} |
| 237 | 0 | return (RuleExtensionBo) getRuleExtensions().get(index); |
| 238 | |
} |
| 239 | |
|
| 240 | |
public RuleExtensionValue getRuleExtensionValue(String key) { |
| 241 | 0 | for (Iterator iter = getRuleExtensions().iterator(); iter.hasNext();) { |
| 242 | 0 | RuleExtensionBo ruleExtension = (RuleExtensionBo) iter.next(); |
| 243 | 0 | for (Iterator iterator = ruleExtension.getExtensionValues().iterator(); iterator.hasNext();) { |
| 244 | 0 | RuleExtensionValue ruleExtensionValue = (RuleExtensionValue) iterator.next(); |
| 245 | 0 | if (ruleExtensionValue.getKey().equals(key)) { |
| 246 | 0 | return ruleExtensionValue; |
| 247 | |
} |
| 248 | 0 | } |
| 249 | 0 | } |
| 250 | 0 | return null; |
| 251 | |
} |
| 252 | |
|
| 253 | |
public RuleExtensionValue getRuleExtensionValue(String ruleTemplateAttributeId, String key) { |
| 254 | 0 | for (Iterator iter = getRuleExtensions().iterator(); iter.hasNext();) { |
| 255 | 0 | RuleExtensionBo ruleExtension = (RuleExtensionBo) iter.next(); |
| 256 | 0 | if (ruleExtension.getRuleTemplateAttributeId().equals(ruleTemplateAttributeId)) { |
| 257 | 0 | for (Iterator iterator = ruleExtension.getExtensionValues().iterator(); iterator.hasNext();) { |
| 258 | 0 | RuleExtensionValue ruleExtensionValue = (RuleExtensionValue) iterator.next(); |
| 259 | 0 | if (ruleExtensionValue.getKey().equals(key)) { |
| 260 | 0 | return ruleExtensionValue; |
| 261 | |
} |
| 262 | 0 | } |
| 263 | |
} |
| 264 | 0 | } |
| 265 | 0 | return null; |
| 266 | |
} |
| 267 | |
|
| 268 | |
public String getPreviousRuleId() { |
| 269 | 0 | return previousRuleId; |
| 270 | |
} |
| 271 | |
|
| 272 | |
public void setPreviousRuleId(String previousVersion) { |
| 273 | 0 | this.previousRuleId = previousVersion; |
| 274 | 0 | } |
| 275 | |
|
| 276 | |
public void addRuleResponsibility(RuleResponsibilityBo ruleResponsibility) { |
| 277 | 0 | addRuleResponsibility(ruleResponsibility, new Integer(getRuleResponsibilities().size())); |
| 278 | 0 | } |
| 279 | |
|
| 280 | |
public void addRuleResponsibility(RuleResponsibilityBo ruleResponsibility, Integer counter) { |
| 281 | 0 | boolean alreadyAdded = false; |
| 282 | 0 | int location = 0; |
| 283 | 0 | if (counter != null) { |
| 284 | 0 | for (RuleResponsibilityBo ruleResponsibilityRow : getRuleResponsibilities()) { |
| 285 | 0 | if (counter.intValue() == location) { |
| 286 | 0 | ruleResponsibilityRow.setPriority(ruleResponsibility.getPriority()); |
| 287 | 0 | ruleResponsibilityRow.setActionRequestedCd(ruleResponsibility.getActionRequestedCd()); |
| 288 | 0 | ruleResponsibilityRow.setVersionNumber(ruleResponsibility.getVersionNumber()); |
| 289 | 0 | ruleResponsibilityRow.setRuleBaseValuesId(ruleResponsibility.getRuleBaseValuesId()); |
| 290 | 0 | ruleResponsibilityRow.setRuleResponsibilityName(ruleResponsibility.getRuleResponsibilityName()); |
| 291 | 0 | ruleResponsibilityRow.setRuleResponsibilityType(ruleResponsibility.getRuleResponsibilityType()); |
| 292 | |
|
| 293 | 0 | ruleResponsibilityRow.setApprovePolicy(ruleResponsibility.getApprovePolicy()); |
| 294 | 0 | alreadyAdded = true; |
| 295 | |
} |
| 296 | 0 | location++; |
| 297 | |
} |
| 298 | |
} |
| 299 | 0 | if (!alreadyAdded) { |
| 300 | 0 | getRuleResponsibilities().add(ruleResponsibility); |
| 301 | |
} |
| 302 | 0 | } |
| 303 | |
|
| 304 | |
public RuleTemplateBo getRuleTemplate() { |
| 305 | 0 | return ruleTemplate; |
| 306 | |
} |
| 307 | |
|
| 308 | |
public void setRuleTemplate(RuleTemplateBo ruleTemplate) { |
| 309 | 0 | this.ruleTemplate = ruleTemplate; |
| 310 | 0 | } |
| 311 | |
|
| 312 | |
public String getRuleTemplateId() { |
| 313 | 0 | return ruleTemplateId; |
| 314 | |
} |
| 315 | |
|
| 316 | |
public void setRuleTemplateId(String ruleTemplateId) { |
| 317 | 0 | this.ruleTemplateId = ruleTemplateId; |
| 318 | 0 | } |
| 319 | |
|
| 320 | |
public DocumentType getDocumentType() { |
| 321 | 0 | return KEWServiceLocator.getDocumentTypeService().findByName(getDocTypeName()); |
| 322 | |
} |
| 323 | |
|
| 324 | |
public String getDocTypeName() { |
| 325 | 0 | return docTypeName; |
| 326 | |
} |
| 327 | |
|
| 328 | |
public void setDocTypeName(String docTypeName) { |
| 329 | 0 | this.docTypeName = docTypeName; |
| 330 | 0 | } |
| 331 | |
|
| 332 | |
public List<RuleExtensionBo> getRuleExtensions() { |
| 333 | 0 | return ruleExtensions; |
| 334 | |
} |
| 335 | |
|
| 336 | |
public Map<String, String> getRuleExtensionMap() { |
| 337 | 0 | Map<String, String> extensions = new HashMap<String, String>(); |
| 338 | 0 | for (RuleExtensionBo ext : this.getRuleExtensions()) { |
| 339 | 0 | for (RuleExtensionValue value : ext.getExtensionValues()) { |
| 340 | 0 | extensions.put(value.getKey(), value.getValue()); |
| 341 | |
} |
| 342 | |
} |
| 343 | 0 | return extensions; |
| 344 | |
} |
| 345 | |
|
| 346 | |
public void setRuleExtensions(List<RuleExtensionBo> ruleExtensions) { |
| 347 | 0 | this.ruleExtensions = ruleExtensions; |
| 348 | 0 | } |
| 349 | |
|
| 350 | |
public List<RuleResponsibilityBo> getRuleResponsibilities() { |
| 351 | 0 | return this.ruleResponsibilities; |
| 352 | |
} |
| 353 | |
|
| 354 | |
public void setRuleResponsibilities(List<RuleResponsibilityBo> ruleResponsibilities) { |
| 355 | 0 | this.ruleResponsibilities = ruleResponsibilities; |
| 356 | 0 | } |
| 357 | |
|
| 358 | |
public RuleResponsibilityBo getResponsibility(Long ruleResponsibilityKey) { |
| 359 | 0 | for (Iterator iterator = getRuleResponsibilities().iterator(); iterator.hasNext();) { |
| 360 | 0 | RuleResponsibilityBo responsibility = (RuleResponsibilityBo) iterator.next(); |
| 361 | 0 | if (responsibility.getId() != null |
| 362 | |
&& responsibility.getId().equals(ruleResponsibilityKey)) { |
| 363 | 0 | return responsibility; |
| 364 | |
} |
| 365 | 0 | } |
| 366 | 0 | return null; |
| 367 | |
} |
| 368 | |
|
| 369 | |
public void removeResponsibility(int index) { |
| 370 | 0 | getRuleResponsibilities().remove(index); |
| 371 | 0 | } |
| 372 | |
|
| 373 | |
@Override |
| 374 | |
public boolean isActive() { |
| 375 | 0 | return active; |
| 376 | |
} |
| 377 | |
|
| 378 | |
public void setActive(boolean active) { |
| 379 | 0 | this.active = active; |
| 380 | 0 | } |
| 381 | |
|
| 382 | |
public String getActiveIndDisplay() { |
| 383 | 0 | return CodeTranslator.getActiveIndicatorLabel(isActive()); |
| 384 | |
} |
| 385 | |
|
| 386 | |
public Boolean getCurrentInd() { |
| 387 | 0 | return currentInd; |
| 388 | |
} |
| 389 | |
|
| 390 | |
public void setCurrentInd(Boolean currentInd) { |
| 391 | 0 | this.currentInd = currentInd; |
| 392 | 0 | } |
| 393 | |
|
| 394 | |
public Timestamp getFromDateValue() { |
| 395 | 0 | return fromDateValue; |
| 396 | |
} |
| 397 | |
|
| 398 | |
@Override |
| 399 | |
public DateTime getFromDate() { |
| 400 | 0 | if (this.fromDateValue == null) { |
| 401 | 0 | return null; |
| 402 | |
} |
| 403 | 0 | return new DateTime(this.fromDateValue.getTime()); |
| 404 | |
} |
| 405 | |
|
| 406 | |
public void setFromDateValue(Timestamp fromDateValue) { |
| 407 | 0 | this.fromDateValue = fromDateValue; |
| 408 | 0 | } |
| 409 | |
|
| 410 | |
public String getDescription() { |
| 411 | 0 | return description; |
| 412 | |
} |
| 413 | |
|
| 414 | |
public void setDescription(String description) { |
| 415 | 0 | this.description = description; |
| 416 | 0 | } |
| 417 | |
|
| 418 | |
public String getId() { |
| 419 | 0 | return id; |
| 420 | |
} |
| 421 | |
|
| 422 | |
public void setId(String id) { |
| 423 | 0 | this.id = id; |
| 424 | 0 | } |
| 425 | |
|
| 426 | |
public Timestamp getToDateValue() { |
| 427 | 0 | return toDateValue; |
| 428 | |
} |
| 429 | |
|
| 430 | |
@Override |
| 431 | |
public DateTime getToDate() { |
| 432 | 0 | if (this.toDateValue == null) { |
| 433 | 0 | return null; |
| 434 | |
} |
| 435 | 0 | return new DateTime(this.toDateValue.getTime()); |
| 436 | |
} |
| 437 | |
|
| 438 | |
public void setToDateValue(Timestamp toDateValue) { |
| 439 | 0 | this.toDateValue = toDateValue; |
| 440 | 0 | } |
| 441 | |
|
| 442 | |
public Integer getVersionNbr() { |
| 443 | 0 | return versionNbr; |
| 444 | |
} |
| 445 | |
|
| 446 | |
public void setVersionNbr(Integer versionNbr) { |
| 447 | 0 | this.versionNbr = versionNbr; |
| 448 | 0 | } |
| 449 | |
|
| 450 | |
public String getReturnUrl() { |
| 451 | 0 | return returnUrl; |
| 452 | |
} |
| 453 | |
|
| 454 | |
public void setReturnUrl(String returnUrl) { |
| 455 | 0 | this.returnUrl = returnUrl; |
| 456 | 0 | } |
| 457 | |
|
| 458 | |
public String getFromDateString() { |
| 459 | 0 | if (this.fromDateValue != null) { |
| 460 | 0 | return RiceConstants.getDefaultDateFormat().format(this.fromDateValue); |
| 461 | |
} |
| 462 | 0 | return null; |
| 463 | |
} |
| 464 | |
|
| 465 | |
public String getToDateString() { |
| 466 | 0 | if (this.toDateValue != null) { |
| 467 | 0 | return RiceConstants.getDefaultDateFormat().format(this.toDateValue); |
| 468 | |
} |
| 469 | 0 | return null; |
| 470 | |
} |
| 471 | |
|
| 472 | |
@Override |
| 473 | |
public boolean isForceAction() { |
| 474 | 0 | return forceAction; |
| 475 | |
} |
| 476 | |
|
| 477 | |
public void setForceAction(boolean forceAction) { |
| 478 | 0 | this.forceAction = forceAction; |
| 479 | 0 | } |
| 480 | |
|
| 481 | |
public boolean isActive(Date date) { |
| 482 | 0 | boolean isAfterFromDate = getFromDateValue() == null || date.after(getFromDateValue()); |
| 483 | 0 | boolean isBeforeToDate = getToDateValue() == null || date.before(getToDateValue()); |
| 484 | 0 | return isActive() && isAfterFromDate && isBeforeToDate; |
| 485 | |
} |
| 486 | |
|
| 487 | |
public boolean isMatch(DocumentContent docContent) { |
| 488 | 0 | for (RuleTemplateAttributeBo ruleTemplateAttribute : getRuleTemplate().getActiveRuleTemplateAttributes()) { |
| 489 | 0 | if (!ruleTemplateAttribute.isWorkflowAttribute()) { |
| 490 | 0 | continue; |
| 491 | |
} |
| 492 | 0 | WorkflowRuleAttribute routingAttribute = (WorkflowRuleAttribute) ruleTemplateAttribute.getWorkflowAttribute(); |
| 493 | |
|
| 494 | 0 | RuleAttribute ruleAttribute = ruleTemplateAttribute.getRuleAttribute(); |
| 495 | 0 | if (ruleAttribute.getType().equals(KewApiConstants.RULE_XML_ATTRIBUTE_TYPE)) { |
| 496 | 0 | ((GenericXMLRuleAttribute) routingAttribute).setExtensionDefinition(RuleAttribute.to(ruleAttribute)); |
| 497 | |
} |
| 498 | 0 | String className = ruleAttribute.getResourceDescriptor(); |
| 499 | 0 | List<RuleExtensionBo> editedRuleExtensions = new ArrayList<RuleExtensionBo>(); |
| 500 | 0 | for (RuleExtensionBo extension : getRuleExtensions()) { |
| 501 | 0 | if (extension.getRuleTemplateAttribute().getRuleAttribute().getResourceDescriptor().equals(className)) { |
| 502 | 0 | editedRuleExtensions.add(extension); |
| 503 | |
} |
| 504 | |
} |
| 505 | 0 | if (!routingAttribute.isMatch(docContent, editedRuleExtensions)) { |
| 506 | 0 | return false; |
| 507 | |
} |
| 508 | 0 | } |
| 509 | 0 | return true; |
| 510 | |
} |
| 511 | |
|
| 512 | |
public RuleResponsibilityBo findResponsibility(String roleName) { |
| 513 | 0 | for (Iterator iter = getRuleResponsibilities().iterator(); iter.hasNext();) { |
| 514 | 0 | RuleResponsibilityBo resp = (RuleResponsibilityBo) iter.next(); |
| 515 | 0 | if (KewApiConstants.RULE_RESPONSIBILITY_ROLE_ID.equals(resp.getRuleResponsibilityType()) |
| 516 | |
&& roleName.equals(resp.getRuleResponsibilityName())) { |
| 517 | 0 | return resp; |
| 518 | |
} |
| 519 | 0 | } |
| 520 | 0 | return null; |
| 521 | |
} |
| 522 | |
|
| 523 | |
public String getDocumentId() { |
| 524 | 0 | return documentId; |
| 525 | |
} |
| 526 | |
|
| 527 | |
public void setDocumentId(String documentId) { |
| 528 | 0 | this.documentId = documentId; |
| 529 | 0 | } |
| 530 | |
|
| 531 | |
public Boolean getDelegateRule() { |
| 532 | 0 | return delegateRule; |
| 533 | |
} |
| 534 | |
|
| 535 | |
public void setDelegateRule(Boolean isDelegateRule) { |
| 536 | 0 | this.delegateRule = isDelegateRule; |
| 537 | 0 | } |
| 538 | |
|
| 539 | |
public Timestamp getActivationDate() { |
| 540 | 0 | return activationDate; |
| 541 | |
} |
| 542 | |
|
| 543 | |
public void setActivationDate(Timestamp activationDate) { |
| 544 | 0 | this.activationDate = activationDate; |
| 545 | 0 | } |
| 546 | |
|
| 547 | |
public MyColumns getMyColumns() { |
| 548 | 0 | return myColumns; |
| 549 | |
} |
| 550 | |
|
| 551 | |
public void setMyColumns(MyColumns additionalColumns) { |
| 552 | 0 | this.myColumns = additionalColumns; |
| 553 | 0 | } |
| 554 | |
|
| 555 | |
public String getDestinationUrl() { |
| 556 | 0 | return destinationUrl; |
| 557 | |
} |
| 558 | |
|
| 559 | |
public void setDestinationUrl(String destinationUrl) { |
| 560 | 0 | this.destinationUrl = destinationUrl; |
| 561 | 0 | } |
| 562 | |
|
| 563 | |
public Timestamp getDeactivationDate() { |
| 564 | 0 | return deactivationDate; |
| 565 | |
} |
| 566 | |
|
| 567 | |
public void setDeactivationDate(Timestamp deactivationDate) { |
| 568 | 0 | this.deactivationDate = deactivationDate; |
| 569 | 0 | } |
| 570 | |
|
| 571 | |
|
| 572 | |
|
| 573 | |
|
| 574 | |
public Boolean getTemplateRuleInd() { |
| 575 | 0 | return templateRuleInd; |
| 576 | |
} |
| 577 | |
|
| 578 | |
|
| 579 | |
|
| 580 | |
|
| 581 | |
public void setTemplateRuleInd(Boolean templateRuleInd) { |
| 582 | 0 | this.templateRuleInd = templateRuleInd; |
| 583 | 0 | } |
| 584 | |
|
| 585 | |
|
| 586 | |
|
| 587 | |
|
| 588 | |
|
| 589 | |
public String getName() { |
| 590 | 0 | return name; |
| 591 | |
} |
| 592 | |
|
| 593 | |
|
| 594 | |
|
| 595 | |
|
| 596 | |
|
| 597 | |
public void setName(String name) { |
| 598 | 0 | this.name = name; |
| 599 | 0 | } |
| 600 | |
|
| 601 | |
public List<PersonRuleResponsibility> getPersonResponsibilities() { |
| 602 | 0 | return this.personResponsibilities; |
| 603 | |
} |
| 604 | |
|
| 605 | |
public void setPersonResponsibilities(List<PersonRuleResponsibility> personResponsibilities) { |
| 606 | 0 | this.personResponsibilities = personResponsibilities; |
| 607 | 0 | } |
| 608 | |
|
| 609 | |
public List<GroupRuleResponsibility> getGroupResponsibilities() { |
| 610 | 0 | return this.groupResponsibilities; |
| 611 | |
} |
| 612 | |
|
| 613 | |
public void setGroupResponsibilities(List<GroupRuleResponsibility> groupResponsibilities) { |
| 614 | 0 | this.groupResponsibilities = groupResponsibilities; |
| 615 | 0 | } |
| 616 | |
|
| 617 | |
public List<RoleRuleResponsibility> getRoleResponsibilities() { |
| 618 | 0 | return this.roleResponsibilities; |
| 619 | |
} |
| 620 | |
|
| 621 | |
public void setRoleResponsibilities(List<RoleRuleResponsibility> roleResponsibilities) { |
| 622 | 0 | this.roleResponsibilities = roleResponsibilities; |
| 623 | 0 | } |
| 624 | |
|
| 625 | |
|
| 626 | |
|
| 627 | |
|
| 628 | |
public Map<String, String> getFieldValues() { |
| 629 | 0 | return this.fieldValues; |
| 630 | |
} |
| 631 | |
|
| 632 | |
|
| 633 | |
|
| 634 | |
|
| 635 | |
public void setFieldValues(Map<String, String> fieldValues) { |
| 636 | 0 | this.fieldValues = fieldValues; |
| 637 | 0 | } |
| 638 | |
|
| 639 | |
public String getGroupReviewerName() { |
| 640 | 0 | return this.groupReviewerName; |
| 641 | |
} |
| 642 | |
|
| 643 | |
public String getGroupReviewerNamespace() { |
| 644 | 0 | return this.groupReviewerNamespace; |
| 645 | |
} |
| 646 | |
|
| 647 | |
public String getPersonReviewer() { |
| 648 | 0 | return this.personReviewer; |
| 649 | |
} |
| 650 | |
|
| 651 | |
public void setGroupReviewerName(String groupReviewerName) { |
| 652 | 0 | this.groupReviewerName = groupReviewerName; |
| 653 | 0 | } |
| 654 | |
|
| 655 | |
public void setGroupReviewerNamespace(String groupReviewerNamespace) { |
| 656 | 0 | this.groupReviewerNamespace = groupReviewerNamespace; |
| 657 | 0 | } |
| 658 | |
|
| 659 | |
public void setPersonReviewer(String personReviewer) { |
| 660 | 0 | this.personReviewer = personReviewer; |
| 661 | 0 | } |
| 662 | |
|
| 663 | |
|
| 664 | |
|
| 665 | |
|
| 666 | |
|
| 667 | |
public PersonImpl getPersonImpl() { |
| 668 | 0 | return new PersonImpl(); |
| 669 | |
} |
| 670 | |
|
| 671 | |
public String getPersonReviewerType() { |
| 672 | 0 | return this.personReviewerType; |
| 673 | |
} |
| 674 | |
|
| 675 | |
public void setPersonReviewerType(String personReviewerType) { |
| 676 | 0 | this.personReviewerType = personReviewerType; |
| 677 | 0 | } |
| 678 | |
|
| 679 | |
|
| 680 | |
|
| 681 | |
|
| 682 | |
|
| 683 | |
|
| 684 | |
public static org.kuali.rice.kew.api.rule.Rule to(RuleBaseValues bo) { |
| 685 | 0 | if (bo == null) { |
| 686 | 0 | return null; |
| 687 | |
} |
| 688 | 0 | return org.kuali.rice.kew.api.rule.Rule.Builder.create(bo).build(); |
| 689 | |
} |
| 690 | |
} |