| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.kuali.rice.kew.document; |
| 17 |
|
|
| 18 |
|
import java.util.Collections; |
| 19 |
|
import java.util.List; |
| 20 |
|
import java.util.Map; |
| 21 |
|
|
| 22 |
|
import org.kuali.rice.core.api.exception.RiceRuntimeException; |
| 23 |
|
import org.kuali.rice.kew.rule.RuleBaseValues; |
| 24 |
|
import org.kuali.rice.kew.rule.RuleResponsibility; |
| 25 |
|
import org.kuali.rice.kew.rule.bo.RuleTemplate; |
| 26 |
|
import org.kuali.rice.kew.rule.web.WebRuleUtils; |
| 27 |
|
import org.kuali.rice.kew.service.KEWServiceLocator; |
| 28 |
|
import org.kuali.rice.kew.util.KEWPropertyConstants; |
| 29 |
|
import org.kuali.rice.kns.bo.PersistableBusinessObject; |
| 30 |
|
import org.kuali.rice.kns.document.MaintenanceDocument; |
| 31 |
|
import org.kuali.rice.kns.document.MaintenanceLock; |
| 32 |
|
import org.kuali.rice.kns.maintenance.KualiMaintainableImpl; |
| 33 |
|
import org.kuali.rice.kns.maintenance.Maintainable; |
| 34 |
|
import org.kuali.rice.kns.web.ui.Section; |
| 35 |
|
|
| 36 |
|
|
| 37 |
|
|
| 38 |
|
@link |
| 39 |
|
|
| 40 |
|
@author |
| 41 |
|
|
| 42 |
|
|
|
|
|
| 0% |
Uncovered Elements: 59 (59) |
Complexity: 19 |
Complexity Density: 0.53 |
|
| 43 |
|
public class RoutingRuleMaintainable extends KualiMaintainableImpl { |
| 44 |
|
|
| 45 |
|
private static final long serialVersionUID = -5920808902137192662L; |
| 46 |
|
|
| 47 |
|
|
| 48 |
|
|
| 49 |
|
|
| 50 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 51 |
0
|
@Override... |
| 52 |
|
public List getSections(MaintenanceDocument document, Maintainable oldMaintainable) { |
| 53 |
0
|
List<Section> sections = super.getSections(document, oldMaintainable); |
| 54 |
0
|
return WebRuleUtils.customizeSections(getThisRule(), sections, false); |
| 55 |
|
|
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 61 |
0
|
@Override... |
| 62 |
|
public void processAfterNew(MaintenanceDocument document, |
| 63 |
|
Map<String, String[]> parameters) { |
| 64 |
0
|
WebRuleUtils.validateRuleTemplateAndDocumentType(getOldRule(document), getNewRule(document), parameters); |
| 65 |
0
|
WebRuleUtils.establishDefaultRuleValues(getNewRule(document)); |
| 66 |
0
|
getNewRule(document).setRouteHeaderId(new Long(document.getDocumentHeader().getDocumentNumber())); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 75 |
0
|
@Override... |
| 76 |
|
public void setGenerateBlankRequiredValues(String docTypeName) { |
| 77 |
|
|
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
|
| 81 |
|
|
| 82 |
|
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 83 |
0
|
@Override... |
| 84 |
|
public void saveBusinessObject() { |
| 85 |
0
|
WebRuleUtils.clearKeysForSave(getThisRule()); |
| 86 |
0
|
WebRuleUtils.translateResponsibilitiesForSave(getThisRule()); |
| 87 |
0
|
WebRuleUtils.translateFieldValuesForSave(getThisRule()); |
| 88 |
0
|
KEWServiceLocator.getRuleService().makeCurrent(getThisRule(), true); |
| 89 |
|
} |
| 90 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 91 |
0
|
@Override... |
| 92 |
|
public void processAfterCopy(MaintenanceDocument document, Map<String, String[]> parameters) { |
| 93 |
0
|
WebRuleUtils.processRuleForCopy(document.getDocumentNumber(), getOldRule(document), getNewRule(document)); |
| 94 |
0
|
super.processAfterCopy(document, parameters); |
| 95 |
|
} |
| 96 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 97 |
0
|
@Override... |
| 98 |
|
public void processAfterEdit(MaintenanceDocument document, |
| 99 |
|
Map<String, String[]> parameters) { |
| 100 |
0
|
if (!getOldRule(document).getCurrentInd()) { |
| 101 |
0
|
throw new RiceRuntimeException("Cannot edit a non-current version of a rule."); |
| 102 |
|
} |
| 103 |
0
|
WebRuleUtils.populateForCopyOrEdit(getOldRule(document), getNewRule(document)); |
| 104 |
|
|
| 105 |
0
|
getNewRule(document).setPreviousVersionId(getOldRule(document).getRuleBaseValuesId()); |
| 106 |
|
|
| 107 |
0
|
getNewRule(document).setRouteHeaderId(new Long(document.getDocumentHeader().getDocumentNumber())); |
| 108 |
0
|
super.processAfterEdit(document, parameters); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 114 |
0
|
protected RuleBaseValues getNewRule(MaintenanceDocument document) {... |
| 115 |
0
|
return (RuleBaseValues)document.getNewMaintainableObject().getBusinessObject(); |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 121 |
0
|
protected RuleBaseValues getOldRule(MaintenanceDocument document) {... |
| 122 |
0
|
return (RuleBaseValues)document.getOldMaintainableObject().getBusinessObject(); |
| 123 |
|
} |
| 124 |
|
|
| 125 |
|
|
| 126 |
|
|
| 127 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 128 |
0
|
protected RuleBaseValues getThisRule() {... |
| 129 |
0
|
return (RuleBaseValues)getBusinessObject(); |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
|
| 133 |
|
|
| 134 |
|
|
| 135 |
|
|
| 136 |
|
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 140 |
|
|
| 141 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 142 |
0
|
@Override... |
| 143 |
|
public List<MaintenanceLock> generateMaintenanceLocks() { |
| 144 |
0
|
if (getThisRule().getPreviousVersionId() == null) { |
| 145 |
0
|
return Collections.emptyList(); |
| 146 |
|
} |
| 147 |
0
|
return super.generateMaintenanceLocks(); |
| 148 |
|
} |
| 149 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
| 150 |
0
|
@Override... |
| 151 |
|
public String getDocumentTitle(MaintenanceDocument document) { |
| 152 |
0
|
StringBuffer title = new StringBuffer(); |
| 153 |
0
|
RuleBaseValues rule = getThisRule(); |
| 154 |
0
|
if (rule.getPreviousVersionId() != null) { |
| 155 |
0
|
title.append("Editing Rule '").append(rule.getDescription()).append("'"); |
| 156 |
|
} else { |
| 157 |
0
|
title.append("Adding Rule '").append(rule.getDescription()).append("'"); |
| 158 |
|
} |
| 159 |
0
|
return title.toString(); |
| 160 |
|
} |
| 161 |
|
|
| 162 |
|
|
| 163 |
|
|
| 164 |
|
|
| 165 |
|
@see |
| 166 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 167 |
0
|
@Override... |
| 168 |
|
public void prepareForSave() { |
| 169 |
0
|
super.prepareForSave(); |
| 170 |
0
|
WebRuleUtils.translateResponsibilitiesForSave(getThisRule()); |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
|
| 174 |
|
@see |
| 175 |
|
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 4 |
Complexity Density: 0.8 |
|
| 176 |
0
|
@Override... |
| 177 |
|
protected void setNewCollectionLineDefaultValues(String collectionName, |
| 178 |
|
PersistableBusinessObject addLine) { |
| 179 |
0
|
super.setNewCollectionLineDefaultValues(collectionName, addLine); |
| 180 |
0
|
if (KEWPropertyConstants.RESP_SECTION_NAME_SET.contains(collectionName)) { |
| 181 |
0
|
RuleTemplate ruleTemplate = getThisRule().getRuleTemplate(); |
| 182 |
0
|
if(ruleTemplate.getDefaultActionRequestValue() != null && ruleTemplate.getDefaultActionRequestValue().getValue() != null){ |
| 183 |
0
|
((RuleResponsibility) addLine).setActionRequestedCd(ruleTemplate.getDefaultActionRequestValue().getValue()); |
| 184 |
|
} |
| 185 |
|
} |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
} |