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.krms.api.repository; 17 18 import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; 19 import org.kuali.rice.krms.api.KrmsConstants; 20 import org.kuali.rice.krms.api.repository.agenda.AgendaTreeDefinition; 21 import org.kuali.rice.krms.api.repository.context.ContextDefinition; 22 import org.kuali.rice.krms.api.repository.context.ContextSelectionCriteria; 23 import org.kuali.rice.krms.api.repository.rule.RuleDefinition; 24 import org.springframework.cache.annotation.Cacheable; 25 26 import javax.jws.WebMethod; 27 import javax.jws.WebParam; 28 import javax.jws.WebResult; 29 import javax.jws.WebService; 30 import javax.jws.soap.SOAPBinding; 31 import javax.xml.bind.annotation.XmlElement; 32 import javax.xml.bind.annotation.XmlElementWrapper; 33 import java.util.List; 34 35 /** 36 * The rule repository contains all of the information about context definitions, 37 * agendas, and business rules. 38 * 39 * @author Kuali Rice Team (rice.collab@kuali.org) 40 * 41 */ 42 @WebService(name = "ruleRepositoryService", targetNamespace = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0) 43 @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) 44 public interface RuleRepositoryService { 45 46 /** 47 * Locates a ContextDefinition based on the given map of context qualifiers. The requirements for valid selection 48 * criteria are implementation dependent. An IllegalArgumentException may be thrown if the implementation can't 49 * operate with the given criteria. 50 * 51 * @param contextSelectionCriteria 52 * @return 53 * @see ContextSelectionCriteria 54 * @throws RiceIllegalArgumentException if the implementation can't handle the given ContextSelectionCriteria 55 */ 56 @WebMethod(operationName = "selectContext") 57 @WebResult(name = "contextDefinition") 58 public ContextDefinition selectContext(@WebParam(name = "contextSelectionCriteria") ContextSelectionCriteria contextSelectionCriteria) 59 throws RiceIllegalArgumentException; 60 61 /** 62 * Retrieves the agenda tree for the given agendaId. The agenda tree includes 63 * the entire agenda definition in the appropriate order and with the 64 * defined agenda branching. 65 * 66 * @param agendaId the id of the agenda for which to retrieve the agenda tree 67 * @return the agenda tree, or null if no agenda could be located for the given agendaId 68 * 69 * @throws RiceIllegalArgumentException if the given agendaId is null 70 */ 71 @WebMethod(operationName = "getAgendaTree") 72 @WebResult(name = "agendaTree") 73 @Cacheable(value= AgendaTreeDefinition.Cache.NAME, key="'agendaId=' + #p0") 74 public AgendaTreeDefinition getAgendaTree(@WebParam(name = "agendaId") String agendaId) 75 throws RiceIllegalArgumentException; 76 77 /** 78 * Retrieves all of the agendas trees for the given list of agendaIds. The agenda tree includes 79 * the entire agenda definition in the appropriate order and with the 80 * defined agenda branching. 81 * 82 * <p>The list which is returned from this operation may not be the same size as the list 83 * which is passed to this method. If an agenda doesn't exist for a given agenda id then 84 * no result for that id will be returned in the list. As a result of this, the returned 85 * list can be empty, but it will never be null. 86 * 87 * @param agendaIds the list of agenda ids for which to retrieve the agenda trees 88 * @return the list of agenda trees for the given ids, this list will only contain agenda trees for the ids 89 * that were resolved successfully, it will never return null but could return an empty list if no agenda 90 * trees could be loaded for the given set of ids 91 * 92 * @throws RiceIllegalArgumentException if the given list of agendaIds is null 93 */ 94 @WebMethod(operationName = "getAgendaTrees") 95 @XmlElementWrapper(name = "agendaTrees", required = true) 96 @XmlElement(name = "agendaTree", required = false) 97 @WebResult(name = "agendaTrees") 98 public List<AgendaTreeDefinition> getAgendaTrees(@WebParam(name = "agendaIds") List<String> agendaIds) 99 throws RiceIllegalArgumentException; 100 101 /** 102 * Retrieves the rule for the given ruleId. The rule includes the propositions 103 * which define the condition that is to be evaluated on the rule. It also 104 * defines a collection of actions which will be invoked if the rule succeeds. 105 * 106 * @param ruleId the id of the rule to retrieve 107 * @return the rule definition, or null if no rule could be located for the given ruleId 108 * 109 * @throws RiceIllegalArgumentException if the given ruleId is null 110 */ 111 @WebMethod(operationName = "getRule") 112 @WebResult(name = "rule") 113 @Cacheable(value= RuleDefinition.Cache.NAME, key="'ruleId=' + #p0") 114 public RuleDefinition getRule(@WebParam(name = "ruleId") String ruleId) throws RiceIllegalArgumentException; 115 116 /** 117 * Retrieves all of the rules for the given list of ruleIds. The rule includes the propositions 118 * which define the condition that is to be evaluated on the rule. It also 119 * defines a collection of actions which will be invoked if the rule succeeds. 120 * 121 * <p>The list which is returned from this operation may not be the same size as the list 122 * which is passed to this method. If a rule doesn't exist for a given rule id then 123 * no result for that id will be returned in the list. As a result of this, the returned 124 * list can be empty, but it will never be null. 125 * 126 * @param ruleIds the list of rule ids for which to retrieve the rules 127 * @return the list of rules for the given ids, this list will only contain rules for the ids 128 * that were resolved successfully, it will never return null but could return an empty list if no 129 * rules could be loaded for the given set of ids 130 * 131 * @throws RiceIllegalArgumentException if the given list of ruleIds is null 132 */ 133 @WebMethod(operationName = "getRules") 134 @XmlElementWrapper(name = "rules", required = true) 135 @XmlElement(name = "rule", required = false) 136 @WebResult(name = "rules") 137 public List<RuleDefinition> getRules(@WebParam(name = "ruleIds") List<String> ruleIds) 138 throws RiceIllegalArgumentException; 139 140 }