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.editor.service.MockDiscoveryHelperService;
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  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: ?
14   * Date: 12/18/12
15   * Time: 7:17 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class MockISBNFunction implements Function {
19  
20      private MockDiscoveryHelperService discoveryHelperService;
21  
22      @Override
23      public Object invoke(Object... arguments) {
24          DataCarrierService dataCarrierService = GlobalResourceLoader.getService(OLEConstants.DATA_CARRIER_SERVICE);
25          Object argument = arguments[0];
26          String existingDocstoreField = (String)((ArrayList) argument).get(0);
27          String isbn = (String)((ArrayList) argument).get(1);
28          boolean exists = getDiscoveryHelperService().isIsbnExists(isbn);
29          return exists;
30      }
31  
32      public MockDiscoveryHelperService getDiscoveryHelperService() {
33          if (null == discoveryHelperService) {
34              discoveryHelperService = new MockDiscoveryHelperService();
35          }
36          return discoveryHelperService;
37      }
38  
39      public void setDiscoveryHelperService(MockDiscoveryHelperService discoveryHelperService) {
40          this.discoveryHelperService = discoveryHelperService;
41      }
42  }