View Javadoc
1   package org.kuali.ole.ingest.function;
2   
3   import org.apache.log4j.Logger;
4   import org.kuali.ole.LoanUtil;
5   import org.kuali.ole.service.OleCirculationPolicyService;
6   import org.kuali.ole.service.OleCirculationPolicyServiceImpl;
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: 10/4/12
16   * Time: 6:00 PM
17   * To change this template use File | Settings | File Templates.
18   */
19  public class CheckDigitRoutine implements Function {
20  
21      private static final Logger LOG = Logger.getLogger(CheckDigitRoutine.class);
22  
23      @Override
24      public Object invoke(Object... arguments) {
25          LOG.info("-------- Inside CheckDigitRoutine -------------");
26          String pattern = "";
27          String itemBarcode = "";
28          if(arguments!=null && arguments.length==2){
29              pattern = (String)(arguments[0]);
30              itemBarcode = (String)(arguments[1]);
31          }
32          OleCirculationPolicyService oleCirculationPolicyService = new OleCirculationPolicyServiceImpl();
33          return oleCirculationPolicyService.isValidBarcode(itemBarcode,pattern);
34      }
35  }