View Javadoc
1   package org.kuali.ole.describe.keyvalue;
2   
3   import org.kuali.ole.OLEConstants;
4   import org.kuali.ole.describe.form.BoundwithForm;
5   import org.kuali.rice.core.api.util.ConcreteKeyValue;
6   import org.kuali.rice.core.api.util.KeyValue;
7   import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
8   import org.kuali.rice.krad.uif.view.ViewModel;
9   
10  import java.util.ArrayList;
11  import java.util.List;
12  
13  /**
14   * Created with IntelliJ IDEA.
15   * User: PP7788
16   * Date: 11/29/12
17   * Time: 5:02 PM
18   * To change this template use File | Settings | File Templates.
19   */
20  public class BoundwithDocFieldKeyValueFinder extends UifKeyValuesFinderBase {
21  
22      @Override
23      public List<KeyValue> getKeyValues(ViewModel viewModel) {
24          BoundwithForm boundwithForm = (BoundwithForm) viewModel;
25          List<KeyValue> options = new ArrayList<KeyValue>();
26          //TODO: Get drop-down values dynamically by parsing DocumentConfig.xml file
27          if (boundwithForm.getSearchParams().getSearchConditions().get(0).getSearchField().getDocType().equalsIgnoreCase(OLEConstants.BIB_DOC_TYPE)) {
28              options.add(new ConcreteKeyValue("all", "ALL"));
29              options.add(new ConcreteKeyValue("Title_search", "Title"));
30              options.add(new ConcreteKeyValue("Author_search", "Author"));
31              options.add(new ConcreteKeyValue("PublicationDate_search", "Publication Date"));
32          } else if (boundwithForm.getSearchParams().getSearchConditions().get(0).getSearchField().getDocType().equalsIgnoreCase(OLEConstants.HOLDING_DOC_TYPE)) {
33              options.add(new ConcreteKeyValue("all", "ALL"));
34              options.add(new ConcreteKeyValue("Location_search", "Location"));
35              options.add(new ConcreteKeyValue("CallNumber_search", "Call Number"));
36          } else if (boundwithForm.getSearchParams().getSearchConditions().get(0).getSearchField().getDocType().equalsIgnoreCase(OLEConstants.ITEM_DOC_TYPE)) {
37              options.add(new ConcreteKeyValue("all", "ALL"));
38              options.add(new ConcreteKeyValue("Location_search", "Location"));
39              options.add(new ConcreteKeyValue("CallNumber_search", "Call Number"));
40              options.add(new ConcreteKeyValue("ItemBarcode_search", "Barcode"));
41          }
42          return options;
43      }
44  }