Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2013 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 package org.kuali.rice.kew.document;
 import java.util.List;
 import java.util.Map;
This class is the maintainable implementation for Routing Rules in KEW (represented by the org.kuali.rice.kew.rule.RuleBaseValues business object).

Kuali Rice Team (
 public class RoutingRuleMaintainable extends KualiMaintainableImpl {
 	private static final long serialVersionUID = -5920808902137192662L;
Override the getSections method on this maintainable so that the Section Containing the various Rule Attributes can be dynamically generated based on the RuleTemplate which is selected.
 	public List getSections(MaintenanceDocument documentMaintainable oldMaintainable) {
 		List<Sectionsections = super.getSections(documentoldMaintainable);
 		return WebRuleUtils.customizeSections(getThisRule(), sectionsfalse);

On creation of a new rule document, we must validate that a rule template and document type are set.
 	public void processAfterNew(MaintenanceDocument document,
 			Map<StringString[]> parameters) {
 		WebRuleUtils.validateRuleTemplateAndDocumentType(getOldRule(document), getNewRule(document), parameters);

This is a hack to get around the fact that when a document is first created, this value is true which causes issues if you want to be able to initialize fields on the document using request parameters. See SectionBridge.toSection for the "if" block where it populates Field.propertyValue to see why this causes problems
 	public void setGenerateBlankRequiredValues(String docTypeName) {		

A complete override of the implementation for saving a Rule
     public void saveBusinessObject() {
     	KEWServiceLocator.getRuleService().makeCurrent(getThisRule(), true);
     public void processAfterCopy(MaintenanceDocument documentMap<StringString[]> parameters) {
     	WebRuleUtils.processRuleForCopy(document.getDocumentNumber(), getOldRule(document), getNewRule(document));
 	public void processAfterEdit(MaintenanceDocument document,
 			Map<StringString[]> parameters) {
		if (!getOldRule(document).getCurrentInd()) {
			throw new RiceRuntimeException("Cannot edit a non-current version of a rule.");
		WebRuleUtils.populateForCopyOrEdit(getOldRule(document), getNewRule(document));

Returns the new RuleBaseValues business object.

Returns the old RuleBaseValues business object.

Returns the RuleBaseValues business object associated with this Maintainable.
	protected RuleBaseValues getThisRule() {

Overridden implementation of maintenance locks. The default locking for Routing Rules is based on previous version (can't route more than one rule based off the same previous verison). However, for the first version of a rule, the previous version id will be null. So for a new Route Rule maintenance document we don't want any locks generated. TODO can we just let the locking key be the primary key? (ruleBaseValuesId)
		if (getThisRule().getPreviousRuleId() == null) {
			return Collections.emptyList();
		return super.generateMaintenanceLocks();
		StringBuffer title = new StringBuffer();
        RuleBaseValues rule = getThisRule();
        if (rule.getPreviousRuleId() != null) {
            title.append("Editing Rule '").append(rule.getDescription()).append("'");
        } else {
            title.append("Adding Rule '").append(rule.getDescription()).append("'");
        return title.toString();

This overridden method ...

See also:
	public void prepareForSave() {


See also:
org.kuali.rice.krad.maintenance.KualiMaintainableImpl#setNewCollectionLineDefaultValues(java.lang.String , )
	protected void setNewCollectionLineDefaultValues(String collectionName,
			if(ruleTemplate.getDefaultActionRequestValue() != null && ruleTemplate.getDefaultActionRequestValue().getValue() != null){
New to GrepCode? Check out our FAQ X