001 /**
002 * Copyright 2005-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.krad.service;
017
018 import org.kuali.rice.krad.document.Document;
019 import org.kuali.rice.krad.rules.rule.BusinessRule;
020 import org.kuali.rice.krad.rules.rule.event.AddAdHocRoutePersonEvent;
021 import org.kuali.rice.krad.rules.rule.event.AddAdHocRouteWorkgroupEvent;
022 import org.kuali.rice.krad.rules.rule.event.KualiDocumentEvent;
023
024 import java.util.List;
025
026
027 /**
028 * Defines the interface to the business-rule evaluation service, used to evauluate document-type-specific business rules using
029 * document-related events to drive the process.
030 */
031 public interface KualiRuleService {
032
033 /**
034 * Retrieves and instantiates the businessRulesClass associated with the event's document type (if any), and calls the
035 * appropriate process* method of that businessRule for handling the given event type. This is a helper method that takes in the
036 * generic KualiDocumentEvent class and determines which event call to make.
037 *
038 * @param event
039 * @return true if no rule is applied, or all rules are applied successfully, false otherwise
040 */
041 public boolean applyRules(KualiDocumentEvent event);
042
043 /**
044 * Builds a list containing ad hoc route person events appropriate for the context.
045 *
046 * @param document
047 * @return List
048 */
049 public List<AddAdHocRoutePersonEvent> generateAdHocRoutePersonEvents(Document document);
050
051 /**
052 * Builds a list containing ad hoc route workgroup events appropriate for the context.
053 *
054 * @param document
055 * @return List
056 */
057 public List<AddAdHocRouteWorkgroupEvent> generateAdHocRouteWorkgroupEvents(Document document);
058
059 /**
060 * Allows code in actions or business objects to directly access rule methods in the class.
061 *
062 * @param document
063 * @param ruleInterface
064 * @return BusinessRule
065 */
066 public BusinessRule getBusinessRulesInstance(Document document, Class<? extends BusinessRule> ruleInterface);
067 }