View Javadoc
1   /**
2    * Copyright 2004-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.kpme.tklm.time.missedpunch.rules;
17  
18  import org.kuali.kpme.core.api.namespace.KPMENamespace;
19  import org.kuali.kpme.core.krms.KPMERulesEngineExecuter;
20  import org.kuali.kpme.tklm.api.common.krms.TklmKrmsConstants;
21  import org.kuali.rice.kew.engine.RouteContext;
22  import org.kuali.rice.krms.api.engine.Engine;
23  import org.kuali.rice.krms.api.engine.EngineResults;
24  import org.kuali.rice.krms.api.engine.Facts;
25  import org.kuali.rice.krms.api.engine.SelectionCriteria;
26  
27  import java.util.HashMap;
28  import java.util.Map;
29  
30  
31  public class MissedPunchRulesEngineExecutor extends KPMERulesEngineExecuter {
32      @Override
33      protected EngineResults performExecute(RouteContext routeContext, Engine engine) {
34          Map<String, String> contextQualifiers = new HashMap<String, String>();
35          contextQualifiers.put("namespaceCode", KPMENamespace.KPME_TK.getNamespaceCode());
36          contextQualifiers.put("name", TklmKrmsConstants.MissedPunch.KPME_MISSED_PUNCH_CONTEXT_NAME);
37          SelectionCriteria selectionCriteria = SelectionCriteria.createCriteria(null, contextQualifiers, new HashMap<String, String>());
38  
39          Facts.Builder factsBuilder = Facts.Builder.create();
40          
41          EngineResults results = engine.execute(selectionCriteria, factsBuilder.build(), null);
42          return results;
43      }
44  }