View Javadoc

1   package org.kuali.ole.describe.keyvalue;
2   
3   import org.kuali.ole.catalog.bo.OleShelvingScheme;
4   import org.kuali.ole.describe.bo.ExternalDataSourceConfig;
5   import org.kuali.rice.core.api.util.ConcreteKeyValue;
6   import org.kuali.rice.core.api.util.KeyValue;
7   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
8   import org.kuali.rice.krad.service.KRADServiceLocator;
9   
10  
11  import java.util.ArrayList;
12  import java.util.Collection;
13  import java.util.List;
14  
15  /**
16   * Created with IntelliJ IDEA.
17   * User: PJ7789
18   * Date: 11/12/12
19   * Time: 1:49 PM
20   * To change this template use File | Settings | File Templates.
21   */
22  public class ExternalDataSourceKeyValue
23          extends KeyValuesBase {
24  
25      /**
26       * This method returns the List of ConcreteKeyValue,
27       * ConcreteKeyValue has two arguments External Data Source Id and name
28       *
29       * @return List<KeyValue>
30       */
31      @Override
32      public List<KeyValue> getKeyValues() {
33          List<KeyValue> options = new ArrayList<KeyValue>();
34          Collection<ExternalDataSourceConfig> externalDataSourceNames = KRADServiceLocator.getBusinessObjectService()
35                                                                                           .findAll(
36                                                                                                   ExternalDataSourceConfig.class);
37          options.add(new ConcreteKeyValue("", ""));
38          for (ExternalDataSourceConfig type : externalDataSourceNames) {
39              options.add(new ConcreteKeyValue(type.getId().toString(), type.getName()));
40          }
41          return options;
42      }
43  }