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.rice.core.api.resourceloader.GlobalResourceLoader;
6   import org.kuali.rice.krms.framework.engine.Function;
7   
8   /**
9    * Created with IntelliJ IDEA.
10   * User: vivekb
11   * Date: 1/24/13
12   * Time: 3:33 PM
13   * To change this template use File | Settings | File Templates.
14   */
15  public class CirculationPolicyFoundFunction implements Function {
16      @Override
17      public Object invoke(Object... arguments) {
18          DataCarrierService dataCarrierService = GlobalResourceLoader.getService(OLEConstants.DATA_CARRIER_SERVICE);
19          String patronId="";
20          String itemId="";
21          if(arguments!=null && arguments.length==2){
22              itemId =arguments[0]!=null?(String) arguments[0]:"";
23              patronId = arguments[1]!=null?(String) arguments[1]:"";
24          }
25          Boolean circulationPolicyFound =(Boolean)dataCarrierService.getData(patronId+itemId);
26          circulationPolicyFound = circulationPolicyFound!=null?circulationPolicyFound:false;
27          return !circulationPolicyFound;
28      }
29  }