1 package org.kuali.ole.ingest.function;
2
3 import org.apache.log4j.Logger;
4 import org.kuali.ole.OLEConstants;
5 import org.kuali.rice.krms.framework.engine.Function;
6
7 import java.util.ArrayList;
8 import java.util.List;
9
10
11
12
13 public class OleContainsComparison implements Function {
14 private static final Logger LOG = Logger.getLogger(OleContainsComparison.class);
15
16
17
18
19
20 @Override
21 public Object invoke(Object... arguments) {
22 LOG.debug(" --------- Inside OleContainsComparison ------------");
23 boolean result = true;
24 if(arguments!=null && arguments.length==2){
25 String operatorsCirculationLocations =arguments[0]!=null?(String) arguments[0]:"";
26 String itemLocation = arguments[1]!=null?(String) arguments[1]:"";
27 String[] splitOperatorLocationTerm = operatorsCirculationLocations.split(OLEConstants.DELIMITER_HASH);
28 String[] splitLocationTerm = itemLocation.split(OLEConstants.DELIMITER_HASH);
29 for(String itemLocationTerm: splitLocationTerm){
30 for(String location: splitOperatorLocationTerm){
31 result = true;
32 String[] splitTerm = itemLocationTerm.split("/");
33 for(String term:splitTerm){
34 result &= location.contains(term);
35 }
36 if(result){
37 return result;
38 }
39 }
40 }
41 }
42 return result;
43 }
44
45 }