View Javadoc
1   package org.kuali.ole.deliver.keyvalue;
2   
3   import org.kuali.ole.deliver.bo.CopyFormat;
4   import org.kuali.rice.core.api.criteria.QueryByCriteria;
5   import org.kuali.rice.core.api.util.ConcreteKeyValue;
6   import org.kuali.rice.core.api.util.KeyValue;
7   import org.kuali.rice.kns.service.KNSServiceLocator;
8   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
9   import org.kuali.rice.krad.service.KRADServiceLocator;
10  
11  import java.util.*;
12  
13  /**
14   * Created with IntelliJ IDEA.
15   * User: anithaa
16   * Date: 2/12/14
17   * Time: 4:28 PM
18   * To change this template use File | Settings | File Templates.
19   */
20  public class CopyFormatKeyValueFinder extends KeyValuesBase {
21      @Override
22      public List getKeyValues() {
23          List<KeyValue> keyValues = new ArrayList<KeyValue>();
24          /*Collection<CopyFormat> copyFormats = KRADServiceLocator.KRADServiceLocatorWeb.getLegacyDataAdapter().findAll(CopyFormat.class);*/
25          Collection<CopyFormat> copyFormats = (Collection<CopyFormat>) KRADServiceLocator.getDataObjectService().findMatching(CopyFormat.class, QueryByCriteria.Builder.create().build()).getResults();
26          keyValues.add(new ConcreteKeyValue(" ", " "));
27          for (CopyFormat copyFormat : copyFormats) {
28              if (copyFormat.isActive()) {
29                  keyValues.add(new ConcreteKeyValue(copyFormat.getCopyFormatId(), copyFormat.getName()));
30              }
31          }
32          return keyValues;
33      }
34  }