1 package org.kuali.ole.patron.keyvalue;
2
3 import org.kuali.ole.OLEConstants;
4 import org.kuali.ole.PropertyUtil;
5 import org.kuali.ole.editor.service.OleExposedWebService;
6 import org.kuali.ole.editor.service.OleWebServiceProvider;
7 import org.kuali.ole.patron.bo.OleBorrowerType;
8 import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
9 import org.kuali.rice.core.api.util.ConcreteKeyValue;
10 import org.kuali.rice.core.api.util.KeyValue;
11 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
12 import org.kuali.rice.krad.service.KRADServiceLocator;
13
14 import java.util.ArrayList;
15 import java.util.Collection;
16 import java.util.List;
17
18
19
20
21 public class OlePaymentMethodKeyValue extends KeyValuesBase {
22
23
24
25
26 @Override
27 public List getKeyValues() {
28 List<KeyValue> keyValues = new ArrayList<KeyValue>();
29 OleWebServiceProvider oleWebServiceProvider = GlobalResourceLoader.getService(OLEConstants.OLE_WEB_SERVICE_PROVIDER);
30 OleExposedWebService oleExposedWebService =
31 (OleExposedWebService) oleWebServiceProvider.
32 getService("org.kuali.ole.editor.service.OleExposedWebService", "oleExposedWebService",getURL());
33
34 String paymentMethod= oleExposedWebService.getPaymentMethod();
35 String methods = paymentMethod.substring(0,paymentMethod.length()-1);
36 String[] method = methods.split(",");
37 keyValues.add(new ConcreteKeyValue("", ""));
38 for(int i=0;i<method.length;i++){
39 keyValues.add(new ConcreteKeyValue(method[i], method[i]));
40 }
41 return keyValues;
42 }
43
44
45
46
47
48 public String getURL() {
49 String url = PropertyUtil.getPropertyUtil().getProperty("oleExposedWebService.url");
50 return url;
51 }
52 }