1 package org.kuali.ole.ingest.keyvalue;
2
3 import org.kuali.ole.IngestUtil;
4 import org.kuali.ole.OLEConstants;
5 import org.kuali.rice.core.api.util.ConcreteKeyValue;
6 import org.kuali.rice.core.api.util.KeyValue;
7 import org.kuali.rice.coreservice.api.CoreServiceApiServiceLocator;
8 import org.kuali.rice.coreservice.api.parameter.Parameter;
9 import org.kuali.rice.coreservice.api.parameter.ParameterKey;
10 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
11 import java.util.ArrayList;
12 import java.util.List;
13
14
15
16
17
18
19
20
21 public class FileFormatKeyValuesFinder extends KeyValuesBase {
22
23 @Override
24 public List getKeyValues() {
25 List<KeyValue> keyValues = new ArrayList<KeyValue>();
26 String validFileFormat= getParameter(OLEConstants.VALID_FILE_FORMAT);
27 String[] fileFormat = validFileFormat.split(",");
28 keyValues.add(new ConcreteKeyValue("", ""));
29 for(int fileType=0;fileType<fileFormat.length;fileType++){
30 keyValues.add(new ConcreteKeyValue(fileFormat[fileType], fileFormat[fileType]));
31 }
32 return keyValues;
33 }
34
35 public String getParameter(String name){
36 ParameterKey parameterKey = ParameterKey.create(OLEConstants.APPL_ID,OLEConstants.SELECT_NMSPC,OLEConstants.SELECT_CMPNT,name);
37 Parameter parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameter(parameterKey);
38 return parameter!=null?parameter.getValue():null;
39 }
40 }