View Javadoc

1   /**
2    * Copyright 2005-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kim.lookup.valuefinder;
17  
18  import org.kuali.rice.core.api.util.ConcreteKeyValue;
19  import org.kuali.rice.core.api.util.KeyValue;
20  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
21  import org.kuali.rice.krad.keyvalues.KeyValuesBase;
22  import org.kuali.rice.kim.api.common.template.Template;
23  
24  import java.util.ArrayList;
25  import java.util.List;
26  
27  /**
28   * This is a description of what this class does - kellerj don't forget to fill this in. 
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   *
32   */
33  public class PermissionTemplateValuesFinder extends KeyValuesBase {
34  
35  	/**
36  	 * This overridden method ...
37  	 * 
38  	 * @see org.kuali.rice.krad.keyvalues.KeyValuesFinder#getKeyValues()
39  	 */
40  	@Override
41  	public List<KeyValue> getKeyValues() {
42  		List<Template> templates = KimApiServiceLocator.getPermissionService().getAllTemplates();
43  		List<KeyValue> result = new ArrayList<KeyValue>( templates.size() ); 
44  		for ( Template template : templates ) {
45  			result.add( new ConcreteKeyValue( template.getId(), template.getNamespaceCode() + " : " + template.getName() ) );
46  		}
47  		return result;
48  	}
49  
50  }