View Javadoc

1   package org.kuali.ole.deliver.calendar.finder;
2   
3   import org.kuali.ole.deliver.calendar.bo.OleCalendarGroup;
4   import org.kuali.rice.core.api.util.ConcreteKeyValue;
5   import org.kuali.rice.core.api.util.KeyValue;
6   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
7   import org.kuali.rice.krad.service.KRADServiceLocator;
8   
9   import java.util.ArrayList;
10  import java.util.Collection;
11  import java.util.List;
12  
13  /**
14   * Created with IntelliJ IDEA.
15   * Date: 7/7/13
16   * Time: 3:49 PM
17   * To change this template use File | Settings | File Templates.
18   */
19  public class OLECalendarGroupNameValuesFinder extends KeyValuesBase {
20      @Override
21      public List<KeyValue> getKeyValues() {
22          List<KeyValue> keyValues = new ArrayList<KeyValue>();
23          Collection<OleCalendarGroup> oleCalendarGroups = KRADServiceLocator.getBusinessObjectService().findAll(OleCalendarGroup.class);
24          keyValues.add(new ConcreteKeyValue(" ", " "));
25          for (OleCalendarGroup oleCalendarGroup : oleCalendarGroups) {
26              if(oleCalendarGroup.isActive())
27                  keyValues.add(new ConcreteKeyValue(oleCalendarGroup.getCalendarGroupId(), oleCalendarGroup.getCalendarGroupName()));
28          }
29  
30          return keyValues;
31      }
32  }