View Javadoc

1   /**
2    * Copyright 2005-2013 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.rice.kew.rule.service;
17  
18  import java.sql.Timestamp;
19  import java.util.Collection;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.kuali.rice.core.framework.impex.xml.XmlExporter;
24  import org.kuali.rice.core.framework.impex.xml.XmlLoader;
25  import org.kuali.rice.kew.api.rule.Rule;
26  import org.kuali.rice.kew.rule.RuleBaseValues;
27  import org.kuali.rice.kew.rule.RuleDelegationBo;
28  import org.kuali.rice.kew.rule.RuleResponsibilityBo;
29  import org.kuali.rice.kim.api.identity.principal.PrincipalContract;
30  import org.springframework.cache.annotation.CacheEvict;
31  
32  /**
33   * A service which provides data access and functions for the KEW Rules engine.
34   *
35   * @see RuleBaseValues
36   * @see org.kuali.rice.kew.rule.RuleResponsibilityBo
37   *
38   * @author Kuali Rice Team (rice.collab@kuali.org)
39   */
40  public interface RuleServiceInternal extends XmlLoader, XmlExporter {
41  
42      /**
43       * Returns a Rule based on unique name.  Returns null if name is null.
44       * @param name the rule name
45       * @return the Rule if found, null if not found or null name
46       */
47      public RuleBaseValues getRuleByName(String name);
48  
49      public String routeRuleWithDelegate(String documentId, RuleBaseValues parentRule, RuleBaseValues delegateRule, PrincipalContract principal, String annotation, boolean blanketApprove) throws Exception;
50      //public void save(RuleBaseValues ruleBaseValues) throws Exception;
51      @CacheEvict(value={Rule.Cache.NAME}, allEntries = true)
52      public void save2(RuleBaseValues ruleBaseValues) throws Exception;
53      public void validate2(RuleBaseValues ruleBaseValues, RuleDelegationBo ruleDelegation, List errors) throws Exception;
54      @CacheEvict(value={Rule.Cache.NAME}, allEntries = true)
55      public void delete(String ruleBaseValuesId);
56      public RuleBaseValues findRuleBaseValuesById(String ruleBaseValuesId);
57      public List<RuleBaseValues> search(String docTypeName, String ruleId, String ruleTemplateId, String ruleDescription, String groupId, String principalId, Boolean delegateRule, Boolean activeInd, Map extensionValues, String workflowIdDirective);
58      public List<RuleBaseValues> searchByTemplate(String docTypeName, String ruleTemplateName, String ruleDescription, String groupId, String principalId, Boolean workgroupMember, Boolean delegateRule, Boolean activeInd, Map extensionValues, Collection<String> actionRequestCodes);
59      public RuleResponsibilityBo findRuleResponsibility(String responsibilityId);
60      public void deleteRuleResponsibilityById(String ruleResponsibilityId);
61      public RuleResponsibilityBo findByRuleResponsibilityId(String ruleResponsibilityId);
62      public List<RuleBaseValues> fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType);
63      public List<RuleBaseValues> fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType, Timestamp effectiveDate);
64      public List<RuleBaseValues> findByDocumentId(String documentId);
65      @CacheEvict(value={Rule.Cache.NAME}, allEntries = true)
66      public void makeCurrent(String documentId);
67      @CacheEvict(value={Rule.Cache.NAME}, allEntries = true)
68      public void makeCurrent(RuleBaseValues rule, boolean isRetroactiveUpdatePermitted);
69      @CacheEvict(value={Rule.Cache.NAME}, allEntries = true)
70      public void makeCurrent(RuleDelegationBo ruleDelegation, boolean isRetroactiveUpdatePermitted);
71      public List<RuleBaseValues> findRuleBaseValuesByResponsibilityReviewer(String reviewerName, String type);
72      public List<RuleBaseValues> findRuleBaseValuesByResponsibilityReviewerTemplateDoc(String ruleTemplateName, String documentType, String reviewerName, String type);
73      public String isLockedForRouting(String currentRuleBaseValuesId);
74      public List<RuleBaseValues> fetchAllRules(boolean currentRules);
75      public RuleBaseValues findDefaultRuleByRuleTemplateId(String ruleTemplateId);
76      public RuleBaseValues getParentRule(String ruleBaseValuesId);
77  
78      /**
79       * Returns the name of the document type definition that should be used to route the given List of rules.  This method will never
80       * return a null value, as it will default to the default Rule document type name if not custom document type is configured for
81       * the given rules.
82       */
83      public String getRuleDocumentTypeName(List<RuleBaseValues> rules);
84  
85      /**
86       * Checks if the Rule with the given value is a duplicate of an existing rule in the system.
87       * 
88       * @return the id of the duplicate rule if one exists, null otherwise
89       */
90      public String getDuplicateRuleId(RuleBaseValues rule);
91      @CacheEvict(value={Rule.Cache.NAME}, allEntries = true)
92      public RuleBaseValues saveRule(RuleBaseValues rule, boolean isRetroactiveUpdatePermitted);
93      @CacheEvict(value={Rule.Cache.NAME}, allEntries = true)
94      public List<RuleBaseValues> saveRules(List<RuleBaseValues> rulesToSave, boolean isRetroactiveUpdatePermitted);
95  
96      public RuleDelegationBo saveRuleDelegation(RuleDelegationBo ruleDelegation, boolean isRetroactiveUpdatePermitted);
97  
98      public List<RuleDelegationBo> saveRuleDelegations(List<RuleDelegationBo> ruleDelegationsToSave, boolean isRetroactiveUpdatePermitted);
99      
100     public String findResponsibilityIdForRule(String ruleName, String ruleResponsibilityName, String ruleResponsibilityType);
101 }