001package org.kuali.ole.ingest.function;
002
003import org.apache.log4j.Logger;
004import org.kuali.ole.LoanUtil;
005import org.kuali.ole.service.OleCirculationPolicyService;
006import org.kuali.ole.service.OleCirculationPolicyServiceImpl;
007import org.kuali.rice.krms.framework.engine.Function;
008
009import java.util.ArrayList;
010import java.util.List;
011
012/**
013 * Created with IntelliJ IDEA.
014 * User: ?
015 * Date: 10/4/12
016 * Time: 6:00 PM
017 * To change this template use File | Settings | File Templates.
018 */
019public class CheckDigitRoutine implements Function {
020
021    private static final Logger LOG = Logger.getLogger(CheckDigitRoutine.class);
022
023    @Override
024    public Object invoke(Object... arguments) {
025        LOG.info("-------- Inside CheckDigitRoutine -------------");
026        String pattern = "";
027        String itemBarcode = "";
028        if(arguments!=null && arguments.length==2){
029            pattern = (String)(arguments[0]);
030            itemBarcode = (String)(arguments[1]);
031        }
032        OleCirculationPolicyService oleCirculationPolicyService = new OleCirculationPolicyServiceImpl();
033        return oleCirculationPolicyService.isValidBarcode(itemBarcode,pattern);
034    }
035}