1 package org.kuali.ole.describe.keyvalue;
2
3 import org.apache.commons.lang3.StringUtils;
4 import org.kuali.ole.describe.bo.OleCountryCodes;
5 import org.kuali.ole.describe.form.BoundwithForm;
6 import org.kuali.ole.describe.form.DocumentConfigForm;
7 import org.kuali.ole.describe.form.ImportBibForm;
8 import org.kuali.ole.describe.form.WorkbenchForm;
9 import org.kuali.ole.describe.service.DocstoreHelperService;
10 import org.kuali.ole.docstore.common.document.config.DocFormatConfig;
11 import org.kuali.ole.docstore.common.document.config.DocTypeConfig;
12 import org.kuali.ole.docstore.common.search.SearchParams;
13 import org.kuali.ole.docstore.model.enums.DocCategory;
14 import org.kuali.ole.docstore.model.enums.DocFormat;
15 import org.kuali.ole.docstore.model.enums.DocType;
16 import org.kuali.ole.docstore.model.xmlpojo.config.*;
17 import org.kuali.ole.integration.cg.dto.HashMapElement;
18 import org.kuali.ole.sys.context.SpringContext;
19 import org.kuali.ole.vnd.businessobject.PaymentTermType;
20 import org.kuali.rice.core.api.util.ConcreteKeyValue;
21 import org.kuali.rice.core.api.util.KeyValue;
22 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
23 import org.kuali.rice.krad.service.KRADServiceLocator;
24 import org.kuali.rice.krad.service.KeyValuesService;
25 import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
26 import org.kuali.rice.krad.uif.view.ViewModel;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 import java.util.*;
31
32
33
34
35
36
37
38
39 public class DocFormatKeyValueFinder extends UifKeyValuesFinderBase {
40
41 public static final Logger LOG = LoggerFactory.getLogger(DocFormatKeyValueFinder.class);
42
43 @Override
44 public List<KeyValue> getKeyValues(ViewModel model) {
45 DocumentConfigForm documentConfigForm= (DocumentConfigForm) model;
46 String docFormatType= documentConfigForm.getDocFieldDocType();
47 List<KeyValue> options = new ArrayList<KeyValue>();
48 if(docFormatType!=null){
49 HashMap hashMap =new HashMap();
50 hashMap.put("name",docFormatType);
51 DocTypeConfig docTypeConfig = (DocTypeConfig) KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(DocTypeConfig.class,hashMap);
52 if(docTypeConfig!=null ){
53 Integer docTypeId= docTypeConfig.getId();
54 HashMap hashMapDocFormat =new HashMap();
55 hashMapDocFormat.put("docTypeId",docTypeId);
56
57 Collection<DocFormatConfig> docFormatConfigs = KRADServiceLocator.getBusinessObjectService().findMatchingOrderBy(DocFormatConfig.class,hashMapDocFormat,"name",true);
58
59 options.add(new ConcreteKeyValue("", ""));
60
61 for (DocFormatConfig type : docFormatConfigs) {
62 options.add(new ConcreteKeyValue(type.getName(), type.getLabel()));
63 }
64 }
65
66 }
67 return options;
68 }
69
70
71 }