View Javadoc
1   package org.kuali.ole.deliver.service.impl;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.apache.log4j.Logger;
5   import org.kuali.rice.krms.api.repository.context.ContextDefinition;
6   import org.kuali.rice.krms.api.repository.context.ContextSelectionCriteria;
7   import org.kuali.rice.krms.impl.repository.KrmsRepositoryServiceLocator;
8   import org.kuali.rice.krms.impl.repository.RuleRepositoryServiceImpl;
9   
10  /**
11   * Created by vivekb on 9/5/14.
12   */
13  public class OLERuleRepositoryServiceImpl extends RuleRepositoryServiceImpl {
14  
15      private static final Logger LOG = Logger.getLogger(OLERuleRepositoryServiceImpl.class);
16      /**
17       * This method is overridden to change db call to cache call...
18       *
19       * @see org.kuali.rice.krms.api.repository.RuleRepositoryService#selectContext(org.kuali.rice.krms.api.repository.context.ContextSelectionCriteria)
20       */
21      @Override
22      public ContextDefinition selectContext(
23              ContextSelectionCriteria contextSelectionCriteria) {
24          if (contextSelectionCriteria == null){
25              throw new IllegalArgumentException("selection criteria is null");
26          }
27          if (StringUtils.isBlank(contextSelectionCriteria.getNamespaceCode())){
28              throw new IllegalArgumentException("selection criteria namespaceCode is null or blank");
29          }
30          long b1 = System.currentTimeMillis();
31          ContextDefinition result = KrmsRepositoryServiceLocator.getContextBoService().getContextByNameAndNamespace(contextSelectionCriteria.getName(),
32                  contextSelectionCriteria.getNamespaceCode());
33          long b2 = System.currentTimeMillis();
34          long tot = b2 - b1;
35          LOG.info("-----------TimeTaken to complete selectContext -----------"+tot);
36  
37          return result;
38      }
39  
40  }