View Javadoc
1   package org.kuali.ole.deliver.keyvalue;
2   
3   import org.kuali.ole.select.service.impl.OleExposedWebServiceImpl;
4   import org.kuali.ole.sys.context.SpringContext;
5   import org.kuali.rice.core.api.config.property.ConfigContext;
6   import org.kuali.rice.core.api.util.ConcreteKeyValue;
7   import org.kuali.rice.core.api.util.KeyValue;
8   import org.kuali.rice.krad.keyvalues.KeyValuesBase;
9   
10  import java.util.ArrayList;
11  import java.util.List;
12  
13  /**
14   * OlePaymentMethodKeyValue returns PaymentMethodId and PaymentMethodName
15   */
16  public class OlePaymentMethodKeyValue extends KeyValuesBase {
17      /**
18       * This method will retrieve Payment method maintenance document from rice 1
19       *
20       * @return keyValues(list)
21       */
22      @Override
23      public List getKeyValues() {
24          List<KeyValue> keyValues = new ArrayList<KeyValue>();
25          OleExposedWebServiceImpl oleExposedWebService = (OleExposedWebServiceImpl) SpringContext.getBean("oleExposedWebService");
26  
27          String paymentMethod = oleExposedWebService.getPaymentMethod();
28          String methods = paymentMethod.substring(0, paymentMethod.length() - 1);
29          String[] method = methods.split(",");
30          keyValues.add(new ConcreteKeyValue("", ""));
31          for (int i = 0; i < method.length; i++) {
32              keyValues.add(new ConcreteKeyValue(method[i], method[i]));
33          }
34          return keyValues;
35      }
36  
37      /**
38       * Gets the webservice URL using PropertyUtil.
39       *
40       * @return String
41       */
42      public String getURL() {
43          String url = ConfigContext.getCurrentContextConfig().getProperty("oleExposedWebService.url");
44          return url;
45      }
46  }