View Javadoc
1   package org.kuali.ole.ingest.function;
2   
3   import org.kuali.ole.DataCarrierService;
4   import org.kuali.ole.OLEConstants;
5   import org.kuali.ole.service.impl.OverlayMatchingServiceImpl;
6   import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader;
7   import org.kuali.rice.krms.framework.engine.Function;
8   
9   import java.util.ArrayList;
10  import java.util.List;
11  
12  /**
13   * Created with IntelliJ IDEA.
14   * User: ?
15   * Date: 12/12/12
16   * Time: 6:43 PM
17   * To change this template use File | Settings | File Templates.
18   */
19  public class LocationFunction implements Function {
20  
21      @Override
22      public Object invoke(Object... arguments) {
23          DataCarrierService dataCarrierService = GlobalResourceLoader.getService(OLEConstants.DATA_CARRIER_SERVICE);
24          String existingDocstoreField = (String)(arguments[0]);
25          String location = (String)(arguments[1]);
26          if(location != null){
27              try {
28                  List list = new OverlayMatchingServiceImpl().getInstanceCollectionOnLocationMatch(location);
29                  if(list.size() >= 1){
30                      dataCarrierService.addData(OLEConstants.BIB_INFO_LIST_FROM_SOLR_RESPONSE, list);
31                      return true;
32                  }
33              } catch (Exception e) {
34                  e.printStackTrace();
35              }
36          }
37          return false;
38      }
39  }