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 http://www.opensource.org/licenses/ecl2.php 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.actionrequest.bo;
A values finder for returning KEW Action Request codes related to Kuali maintenance forms.

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
	public List<KeyValuegetKeyValues() {
		final List<KeyValueactionRequestCodes = new ArrayList<KeyValue>();
		// Acquire the Kuali form, and return the super class' result if the form is not a Kuali maintenance form.
		final KualiForm kForm = KNSGlobalVariables.getKualiForm();
		if (!(kForm instanceof KualiMaintenanceForm)) {
			return super.getKeyValues();
		}
		// Acquire the Kuali maintenance form's document and its rule template.
		// Ensure that the rule template is defined.
		if (ruleTemplate == null) {
			throw new RuntimeException("Rule template cannot be null for document ID " + maintDoc.getDocumentNumber());
		}
		// get the options to check for, as well as their related KEW constants.
		final RuleTemplateOptionBo[] ruleOpts = {ruleTemplate.getAcknowledge(), ruleTemplate.getComplete(),
				ruleTemplate.getApprove(), ruleTemplate.getFyi()};
		// Add the rule options to the list if they are not defined (true by default) or if they are explicitly set to true.
		for (int i = 0; i < ruleOpts.lengthi++) {
			if (ruleOpts[i] == null || ruleOpts[i].getValue() == null || "true".equals(ruleOpts[i].getValue())) {
				actionRequestCodes.add(new ConcreteKeyValue(ruleConsts[i], ..get(ruleConsts[i])));
			}
		}
		return actionRequestCodes;
	}
New to GrepCode? Check out our FAQ X