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.
A values finder for generating a list of Role names that can be selected for a given RuleTemplate. This is dependant on the template selected on the maintenance document so it needs to use GlobalVariables to get a reference to the KualiForm so it can examine the business object and extract the role names from the RuleTemplate.

Kuali Rice Team (
public class RoleNameValuesFinder extends KeyValuesBase {
	public List<KeyValuegetKeyValues() {
		List<KeyValueroleNames = new ArrayList<KeyValue>();
		if (KNSGlobalVariables.getKualiForm() != null && KNSGlobalVariables.getKualiForm() instanceof KualiMaintenanceForm) {
			KualiMaintenanceForm form = (KualiMaintenanceForm)KNSGlobalVariables.getKualiForm();
			RuleBaseValues rule = null;
			if (businessObject instanceof RuleBaseValues) {
				rule = (RuleBaseValues)businessObject;
else if (businessObject instanceof RuleDelegationBo) {
				rule = ((RuleDelegationBo)businessObject).getDelegationRule();
else {
				throw new RiceRuntimeException("Cannot locate RuleBaseValues business object on maintenance document.  Business Object was " + businessObject);
			RuleTemplateBo ruleTemplate = rule.getRuleTemplate();
			List<RoleNameroles = ruleTemplate.getRoles();
			for (RoleName role : roles) {
				roleNames.add(new ConcreteKeyValue(role.getName(), role.getLabel()));
		return roleNames;
New to GrepCode? Check out our FAQ X