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 */
016package org.kuali.rice.krms.api.repository;
017
018import org.kuali.rice.core.api.criteria.QueryByCriteria;
019import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
020import org.kuali.rice.krms.api.KrmsConstants;
021import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition;
022import org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition;
023import org.kuali.rice.krms.api.repository.context.ContextDefinition;
024import org.kuali.rice.krms.api.repository.language.NaturalLanguageUsage;
025import org.kuali.rice.krms.api.repository.proposition.PropositionDefinition;
026import org.kuali.rice.krms.api.repository.reference.ReferenceObjectBinding;
027import org.kuali.rice.krms.api.repository.rule.RuleDefinition;
028import org.springframework.cache.annotation.CacheEvict;
029import org.springframework.cache.annotation.Cacheable;
030
031import javax.jws.WebMethod;
032import javax.jws.WebParam;
033import javax.jws.WebResult;
034import javax.jws.WebService;
035import javax.jws.soap.SOAPBinding;
036import javax.xml.bind.annotation.XmlElement;
037import javax.xml.bind.annotation.XmlElementWrapper;
038import java.util.List;
039import java.util.Set;
040import org.kuali.rice.krms.api.repository.action.ActionDefinition;
041import org.kuali.rice.krms.api.repository.agenda.AgendaTreeDefinition;
042import org.kuali.rice.krms.api.repository.context.ContextSelectionCriteria;
043import org.kuali.rice.krms.api.repository.language.NaturalLanguageTemplate;
044
045/**
046 * The rule maintenance service operations facilitate management of rules and
047 * associated information.
048 *
049 * @author Kuali Rice Team (rice.collab@kuali.org)
050 */
051@WebService(name = "ruleManagementService", targetNamespace = KrmsConstants.Namespaces.KRMS_NAMESPACE_2_0)
052@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL,
053        parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
054public interface RuleManagementService extends TranslateBusinessMethods {
055
056    /**
057     * Create RefObject-KRMS object binding
058     *
059     * @param referenceObjectDefinition  data for the new ReferenceObjectBinding to be created
060     * @return newly created ReferenceObjectBinding
061     * @throws RiceIllegalArgumentException if the given referenceObjectDefinition
062     *                                      is null or invalid
063     */
064    @WebMethod(operationName = "createReferenceObjectBinding")
065    @WebResult(name = "referenceObjectBinding")
066    @CacheEvict(value={ReferenceObjectBinding.Cache.NAME}, allEntries = true)
067    public ReferenceObjectBinding createReferenceObjectBinding(@WebParam(
068            name = "referenceObjectDefinition") ReferenceObjectBinding referenceObjectDefinition) throws RiceIllegalArgumentException;
069
070    /**
071     * Retrieve referenceObjectBinding  given a specific id
072     *
073     * @param id identifier of the ReferenceObjectBinding to be retrieved
074     * @return a ReferenceObjectBinding with the given id value
075     * @throws RiceIllegalArgumentException if the given  id is blank or
076     *                                      invalid
077     */
078    @WebMethod(operationName = "getReferenceObjectBinding")
079    @WebResult(name = "referenceObjectBinding")
080    @Cacheable(value= ReferenceObjectBinding.Cache.NAME, key="'id=' + #p0")
081    public ReferenceObjectBinding getReferenceObjectBinding(@WebParam(
082            name = "id") String id) throws RiceIllegalArgumentException;
083
084    /**
085     * Retrieve list of ReferenceObjectBinding objects given ids
086     *
087     * @param ids identifiers of the ReferenceObjectBinding to be retrieved
088     * @return list of ReferenceObjectBinding objects for the given ids
089     * @throws RiceIllegalArgumentException if one or more ids in the give list
090     *                                      is blank or invalid
091     */
092    @WebMethod(operationName = "getReferenceObjectBindings")
093    @XmlElementWrapper(name = "referenceObjectBindings", required = true)
094    @XmlElement(name = "referenceObjectBinding", required = false)
095    @WebResult(name = "referenceObjectBindings")
096    @Cacheable(value= ReferenceObjectBinding.Cache.NAME, key="'ids=' + #p0")
097    List<ReferenceObjectBinding> getReferenceObjectBindings(@WebParam(
098            name = "ids") List<String> ids) throws RiceIllegalArgumentException;
099
100    /**
101     * Retrieves list of ReferenceObjectBinding objects for the given ref obj
102     * discriminator type
103     *
104     * @param referenceObjectReferenceDiscriminatorType  reference object type
105     * @return list of ReferenceObjectBinding objects for the given discriminator
106     *         type
107     * @throws RiceIllegalArgumentException if the given  referenceObjectReferenceDiscriminatorType is
108     *                                      blank or invalid
109     */
110    @WebMethod(operationName = "findReferenceObjectBindingsByReferenceDiscriminatorType")
111    @XmlElementWrapper(name = "referenceObjectBindings", required = true)
112    @XmlElement(name = "referenceObjectBinding", required = false)
113    @WebResult(name = "referenceObjectBindings")
114    @Cacheable(value= ReferenceObjectBinding.Cache.NAME, key="'referenceObjectReferenceDiscriminatorType=' + #p0")
115    public List<ReferenceObjectBinding> findReferenceObjectBindingsByReferenceDiscriminatorType(
116            @WebParam(name = "referenceObjectReferenceDiscriminatorType") String referenceObjectReferenceDiscriminatorType) throws RiceIllegalArgumentException;
117
118    /**
119     * Retrieves list of ReferenceObjectBinding objects for the given krms obj
120     * discriminator type
121     *
122     * @param referenceObjectKrmsDiscriminatorType  reference object type
123     * @return list of ReferenceObjectBinding objects for the given discriminator
124     *         type
125     * @throws RiceIllegalArgumentException if the given  referenceObjectKrmsDiscriminatorType is
126     *                                      blank or invalid
127     */
128    @WebMethod(operationName = "findReferenceObjectBindingsByKrmsDiscriminatorType")
129    @XmlElementWrapper(name = "referenceObjectBindings", required = true)
130    @XmlElement(name = "referenceObjectBinding", required = false)
131    @WebResult(name = "referenceObjectBindings")
132    @Cacheable(value= ReferenceObjectBinding.Cache.NAME, key="'referenceObjectKrmsDiscriminatorType=' + #p0")
133    public List<ReferenceObjectBinding> findReferenceObjectBindingsByKrmsDiscriminatorType(
134            @WebParam(name = "referenceObjectKrmsDiscriminatorType") String referenceObjectKrmsDiscriminatorType) throws RiceIllegalArgumentException;
135
136
137    /**
138     * Retrieves list of ReferenceObjectBinding objects for the given obj
139     * discriminator type and reference object id
140     *
141     * @param referenceObjectReferenceDiscriminatorType  reference object type
142     * @param referenceObjectId reference object id
143     * @return list of ReferenceObjectBinding objects for the given discriminator
144     *         type
145     * @throws RiceIllegalArgumentException if the given  referenceObjectKrmsDiscriminatorType or id is
146     *                                      blank or invalid
147     */
148    @WebMethod(operationName = "findReferenceObjectBindingsByReferenceObject")
149    @XmlElementWrapper(name = "referenceObjectBindings", required = true)
150    @XmlElement(name = "referenceObjectBinding", required = false)
151    @WebResult(name = "referenceObjectBindings")
152    @Cacheable(value= ReferenceObjectBinding.Cache.NAME, key="'referenceObjectReferenceDiscriminatorType=' + #p0 + '|' + 'referenceObjectId=' + #p1")
153    public List<ReferenceObjectBinding> findReferenceObjectBindingsByReferenceObject (
154            @WebParam(name = "referenceObjectReferenceDiscriminatorType") String referenceObjectReferenceDiscriminatorType,
155            @WebParam(name = "referenceObjectId") String referenceObjectId)
156            throws RiceIllegalArgumentException;
157
158    /**
159     * Retrieves list of ReferenceObjectBinding objects for the given obj
160     * discriminator type and reference object ids
161     *
162     * @param referenceObjectReferenceDiscriminatorType  reference object type
163     * @param referenceObjectIds reference object ids
164     * @return list of ReferenceObjectBinding objects for the given discriminator
165     *         type
166     * @throws RiceIllegalArgumentException if the given  referenceObjectKrmsDiscriminatorType or id list is
167     *                                      blank or invalid
168     */
169    @WebMethod(operationName = "findReferenceObjectBindingsByReferenceObjectIds")
170    @XmlElementWrapper(name = "referenceObjectBindings", required = true)
171    @XmlElement(name = "referenceObjectBinding", required = false)
172    @WebResult(name = "referenceObjectBindings")
173    @Cacheable(value= ReferenceObjectBinding.Cache.NAME, key="'referenceObjectReferenceDiscriminatorType=' + #p0 + '|' + 'referenceObjectIds=' + #p1")
174    public List<ReferenceObjectBinding> findReferenceObjectBindingsByReferenceObjectIds (
175            @WebParam(name = "referenceObjectReferenceDiscriminatorType") String referenceObjectReferenceDiscriminatorType,
176            @WebParam(name = "referenceObjectId") List<String> referenceObjectIds)
177            throws RiceIllegalArgumentException;
178
179    /**
180     * Retrieves list of ReferenceObjectBinding objects for the given KRMS obj
181     * id.
182     *
183     * @param krmsObjectId identifier of the KRMS obj
184     * @return list of ReferenceObjectBinding objects for the given KRMS obj
185     * @throws RiceIllegalArgumentException if the given krmsObjectId is blank or
186     *                                      invalid
187     */
188    @WebMethod(operationName = "findReferenceObjectBindingsByKrmsObjectId")
189    @XmlElementWrapper(name = "referenceObjectBindings", required = true)
190    @XmlElement(name = "referenceObjectBinding", required = false)
191    @WebResult(name = "referenceObjectBindings")
192    @Cacheable(value= ReferenceObjectBinding.Cache.NAME, key="'krmsObjectId=' + #p0")
193    public List<ReferenceObjectBinding> findReferenceObjectBindingsByKrmsObject(
194            @WebParam(name = "krmsObjectId") String krmsObjectId) throws RiceIllegalArgumentException;
195
196    /**
197     * Update the ReferenceObjectBinding object specified by the identifier in the
198     * given DTO
199     *
200     * @param referenceObjectBindingDefinition DTO with updated info and id of the object to be updated
201     * @throws RiceIllegalArgumentException if the given  referenceObjectBindingDefinition
202     *                                      is null or invalid
203     */
204    @WebMethod(operationName = "updateReferenceObjectBinding")
205    @CacheEvict(value={ReferenceObjectBinding.Cache.NAME}, allEntries = true)
206    public void updateReferenceObjectBinding(ReferenceObjectBinding referenceObjectBindingDefinition) throws RiceIllegalArgumentException;
207
208    /**
209     * Delete the specified ReferenceObjectBinding object
210     *
211     * @param id identifier of the object to be deleted
212     * @throws RiceIllegalArgumentException if the given  id is null or invalid
213     */
214    @WebMethod(operationName = "deleteReferenceObjectBinding")
215    @CacheEvict(value={ReferenceObjectBinding.Cache.NAME}, allEntries = true)
216    public void deleteReferenceObjectBinding(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
217
218
219    /**
220     * Query for ReferenceObjectBinding ids based on the given search criteria
221     * which is a Map of ReferenceObjectBinding field names to values. <p/> <p>
222     * This method returns it's results as a List of ReferenceObjectBinding ids
223     * that match the given search criteria. </p>
224     *
225     * @param queryByCriteria the criteria.  Cannot be null.
226     * @return a list of ids matching the given criteria properties.  An empty
227     *         list is returned if an invalid or non-existent criteria is
228     *         supplied.
229     * @throws RiceIllegalArgumentException if the queryByCriteria is null
230     */
231    @WebMethod(operationName = "findReferenceObjectBindingIds")
232    @XmlElementWrapper(name = "referenceObjectBindingIds", required = true)
233    @XmlElement(name = "referenceObjectBindingId", required = false)
234    @WebResult(name = "referenceObjectBindingIds")
235    List<String> findReferenceObjectBindingIds(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
236
237    ////
238    //// agenda methods
239    ////
240    /**
241     * Create Agenda and an empty first item
242     *
243     * @param agendaDefinition data for the new Agenda to be created
244     * @return newly created Agenda
245     * @throws RiceIllegalArgumentException if the given agendaDefinition is
246     *                                      null or invalid
247     */
248    @WebMethod(operationName = "createAgenda")
249    @WebResult(name = "agenda")
250    @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
251    public AgendaDefinition createAgenda(@WebParam(name = "AgendaDefinition") AgendaDefinition agendaDefinition) throws RiceIllegalArgumentException;
252
253    /**
254     * Create Agenda if not found by contextId and name
255     *
256     * @param agendaDefinition data for the new Agenda to be created
257     * @return newly created or found Agenda
258     * @throws RiceIllegalArgumentException if the given agendaDefinition is
259     *                                      null or invalid
260     */
261    @WebMethod(operationName = "findCreateAgenda")
262    @WebResult(name = "agenda")
263    @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
264    public AgendaDefinition findCreateAgenda(@WebParam(name = "AgendaDefinition") AgendaDefinition agendaDefinition) throws RiceIllegalArgumentException;
265
266    /**
267     * Retrieve Agenda for the specified id
268     *
269     * @param id identifier for the Agenda
270     * @return specified Agenda
271     * @throws RiceIllegalArgumentException if the given id is null or invalid
272     */
273    @WebMethod(operationName = "getAgenda")
274    @WebResult(name = "agenda")
275    @Cacheable(value= AgendaDefinition.Cache.NAME, key="'id=' + #p0")
276    public AgendaDefinition getAgenda(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
277
278    /**
279     * Retrieves an Agenda from the repository based on the provided agenda name
280     * and context id.
281     *
282     * @param name the name of the Agenda to retrieve.
283     * @param contextId the id of the context that the agenda belongs to.
284     * @return an {@link AgendaDefinition} identified by the given name and namespace.  
285     * A null reference is returned if an invalid or non-existent name and
286     * namespace combination is supplied.
287     */
288    @WebMethod(operationName = "getAgendaByNameAndContextId")
289    @WebResult(name = "agenda")
290    @Cacheable(value= AgendaDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'contextId=' + #p1")
291    public AgendaDefinition getAgendaByNameAndContextId (@WebParam(name = "name") String name,
292                                                         @WebParam(name = "contextId") String contextId);
293
294    /**
295     * Retrieve Agendas of the specified type
296     *
297     * @param typeId type of the Agenda
298     * @return list of Agendas of the specified type
299     * @throws RiceIllegalArgumentException if the given typeId is null or
300     *                                      invalid
301     */
302    @WebMethod(operationName = "getAgendasByType")
303    @XmlElementWrapper(name = "agendas", required = true)
304    @XmlElement(name = "agenda", required = false)
305    @WebResult(name = "agendas")
306    @Cacheable(value= AgendaDefinition.Cache.NAME, key="'typeId=' + #p0")
307    public List<AgendaDefinition> getAgendasByType(@WebParam(name = "typeId") String typeId) throws RiceIllegalArgumentException;
308
309    /**
310     * Retrieve Agendas associated with the specified context
311     *
312     * @param contextId  context of interest
313     * @return list of Agendas associated with the context
314     * @throws RiceIllegalArgumentException if the given contextId is null or
315     *                                      invalid
316     */
317    @WebMethod(operationName = "getAgendasByContext")
318    @XmlElementWrapper(name = "agendas", required = true)
319    @XmlElement(name = "agenda", required = false)
320    @WebResult(name = "agendas")
321    @Cacheable(value= AgendaDefinition.Cache.NAME, key="'contextId=' + #p0")
322    public List<AgendaDefinition> getAgendasByContext(@WebParam(name = "contextId") String contextId) throws RiceIllegalArgumentException;
323
324    /**
325     * Retrieve Agendas of the specified type and context
326     *
327     * @param typeId  type of the Agenda
328     * @param contextId  context of interest
329     * @return list of Agendas associated with the specified type and context
330     * @throws RiceIllegalArgumentException if the given typeId or contextId
331     *                                      null or invalid
332     */
333    @WebMethod(operationName = "getAgendasByTypeAndContext")
334    @XmlElementWrapper(name = "agendas", required = true)
335    @XmlElement(name = "agenda", required = false)
336    @WebResult(name = "agendas")
337    @Cacheable(value= AgendaDefinition.Cache.NAME, key="'typeId=' + #p0 + '|' + 'contextId=' + #p1")
338    public List<AgendaDefinition> getAgendasByTypeAndContext(@WebParam(name = "typeId") String typeId,
339                                                             @WebParam(name = "contextId") String contextId) throws RiceIllegalArgumentException;
340
341    /**
342     * Update the Agenda specified by the identifier in the input DTO
343     *
344     * @param agendaDefinition DTO with updated info and identifier of the object to be updated
345     * @throws RiceIllegalArgumentException if the given agendaDefinition is
346     *                                      null or invalid
347     */
348    @WebMethod(operationName = "updateAgenda")
349    @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
350    public void updateAgenda(@WebParam(name = "agendaDefinition") AgendaDefinition agendaDefinition) throws RiceIllegalArgumentException;
351
352    /**
353     * Delete the specified Agenda
354     *
355     * @param id identifier of the object to be deleted
356     * @throws RiceIllegalArgumentException if the given id is null or invalid
357     */
358    @WebMethod(operationName = "deleteAgenda")
359    @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
360    public void deleteAgenda(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
361
362    ////
363    //// agenda item methods
364    ////
365    /**
366     * Create AgendaItem
367     *
368     * @param agendaItemDefinition  data for the new AgendaItem to be created
369     * @return newly created AgendaItem
370     * @throws RiceIllegalArgumentException if the given agendaItemDefinition is
371     *                                      null or invalid
372     */
373    @WebMethod(operationName = "createAgendaItem")
374    @WebResult(name = "agendaItem")
375    @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
376    public AgendaItemDefinition createAgendaItem(@WebParam(name = "AgendaItemDefinition") AgendaItemDefinition agendaItemDefinition) throws RiceIllegalArgumentException;
377
378    /**
379     * Retrieve AgendaItem by the specified identifier
380     *
381     * @param id identifier of the AgendaItem
382     * @return AgendaItem specified by the identifier
383     * @throws RiceIllegalArgumentException if the given id is null or invalid
384     */
385    @WebMethod(operationName = "getAgendaItem")
386    @WebResult(name = "agendaItem")
387    @Cacheable(value= AgendaItemDefinition.Cache.NAME, key="'id=' + #p0")
388    public AgendaItemDefinition getAgendaItem(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
389
390    /**
391     * Retrieve AgendaItems by specified type
392     *
393     * @param typeId type of the AgendaItems
394     * @return list of AgendaItems of the specified type
395     * @throws RiceIllegalArgumentException if the given typeId is null or
396     *                                      invalid
397     */
398    @WebMethod(operationName = "getAgendaItemsByType")
399    @XmlElementWrapper(name = "agendaItems", required = true)
400    @XmlElement(name = "agendaItem", required = false)
401    @WebResult(name = "agendaItems")
402    @Cacheable(value= AgendaItemDefinition.Cache.NAME, key="'typeId=' + #p0")
403    public List<AgendaItemDefinition> getAgendaItemsByType(@WebParam(name = "typeId") String typeId) throws RiceIllegalArgumentException;
404
405    /**
406     * Retrieve AgendaItems associated with a context
407     *
408     * @param contextId context identifier
409     * @return list of AgendaItems associated with a context
410     * @throws RiceIllegalArgumentException if the given  contextId is null or
411     *                                      invalid
412     */
413    @WebMethod(operationName = "getAgendaItemsByContext")
414    @XmlElementWrapper(name = "agendaItems", required = true)
415    @XmlElement(name = "agendaItem", required = false)
416    @WebResult(name = "agendaItems")
417    @Cacheable(value= AgendaItemDefinition.Cache.NAME, key="'contextId=' + #p0")
418    public List<AgendaItemDefinition> getAgendaItemsByContext(@WebParam(name = "contextId") String contextId) throws RiceIllegalArgumentException;
419
420    /**
421     * Retrieve AgendaItems by type and context
422     *
423     * @param typeId type of the Agendas
424     * @param contextId context with which the Agendas are associated
425     * @return list of AgendaItems of the specified type and context
426     * @throws RiceIllegalArgumentException if the given  typeId or contextId
427     *                                      null or invalid
428     */
429    @WebMethod(operationName = "getAgendaItemsByTypeAndContext")
430    @XmlElementWrapper(name = "agendaItems", required = true)
431    @XmlElement(name = "agendaItem", required = false)
432    @WebResult(name = "agendaItems")
433    @Cacheable(value= AgendaItemDefinition.Cache.NAME, key="'typeId=' + #p0 + '|' + 'contextId=' + #p1")
434    public List<AgendaItemDefinition> getAgendaItemsByTypeAndContext(@WebParam(name = "typeId") String typeId,
435                                                                     @WebParam(name = "contextId") String contextId) throws RiceIllegalArgumentException;
436
437    /**
438     * Update an AgendaItem
439     *
440     * @param agendaItemDefinition  updated data for the AgendaItem, with id of the object to be updated
441     * @throws RiceIllegalArgumentException if the given  agendaItemDefinition
442     *                                      is null or invalid
443     */
444    @WebMethod(operationName = "updateAgendaItem")
445    @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true, beforeInvocation = true)
446    public void updateAgendaItem(@WebParam(name = "agendaItemDefinition") AgendaItemDefinition agendaItemDefinition) throws RiceIllegalArgumentException;
447
448    /**
449     * Delete the specified AgendaItem
450     *
451     * @param id identifier of the AgendaItem to be deleted
452     * @throws RiceIllegalArgumentException if the given id is null or invalid
453     */
454    @WebMethod(operationName = "deleteAgendaItem")
455    @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
456    public void deleteAgendaItem(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
457
458    ////
459    //// rule methods
460    ////
461    /**
462     * Create Rule
463     *
464     * @param ruleDefinition data for the new Rule to be created
465     * @return newly created Rule
466     * @throws RiceIllegalArgumentException if the given ruleDefinition is null
467     *                                      or invalid
468     */
469    @WebMethod(operationName = "createRule")
470    @WebResult(name = "rule")
471    @CacheEvict(value={RuleDefinition.Cache.NAME, PropositionDefinition.Cache.NAME, ActionDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME}, allEntries = true)
472    public RuleDefinition createRule(@WebParam(name = "ruleDefinition") RuleDefinition ruleDefinition) throws RiceIllegalArgumentException;
473
474    /**
475     * Retrieves the rule for the given ruleId.  The rule includes the
476     * propositions which define the condition that is to be evaluated on the
477     * rule.  It also defines a collection of actions which will be invoked if
478     * the rule succeeds.
479     *
480     * @param ruleId the id of the rule to retrieve
481     * @return the rule definition, or null if no rule could be located for the
482     *         given ruleId
483     * @throws IllegalArgumentException if the given ruleId is null
484     */
485    @WebMethod(operationName = "getRule")
486    @WebResult(name = "rule")
487    @Cacheable(value= RuleDefinition.Cache.NAME, key="'ruleId=' + #p0")
488    public RuleDefinition getRule(@WebParam(name = "ruleId") String ruleId);
489
490    /**
491     * Retrieves an Rule from the repository based on the provided rule name
492     * and namespace.
493     *
494     * @param name the name of the Rule to retrieve.
495     * @param namespace the namespace that the rule is under.
496     * @return an {@link RuleDefinition} identified by the given name and namespace.
497     * A null reference is returned if an invalid or non-existent name and
498     * namespace combination is supplied.
499     * @throws IllegalArgumentException if the either the name or the namespace
500     * is null or blank.
501     */
502    @WebMethod(operationName = "getRuleByNameAndNamespace")
503    @WebResult(name = "rule")
504    @Cacheable(value= RuleDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1")
505    public RuleDefinition getRuleByNameAndNamespace(@WebParam(name = "name") String name,
506                                                    @WebParam(name = "namespace") String namespace);
507
508    /**
509     * Retrieves all of the rules for the given list of ruleIds.  The rule
510     * includes the propositions which define the condition that is to be
511     * evaluated on the rule.  It also defines a collection of actions which
512     * will be invoked if the rule succeeds.
513     * <p/>
514     * <p>The list which is returned from this operation may not be the same
515     * size as the list which is passed to this method.  If a rule doesn't exist
516     * for a given rule id then no result for that id will be returned in the
517     * list.  As a result of this, the returned list can be empty, but it will
518     * never be null.
519     *
520     * @param ruleIds the list of rule ids for which to retrieve the rules
521     * @return the list of rules for the given ids, this list will only contain
522     *         rules for the ids that were resolved successfully, it will never
523     *         return null but could return an empty list if no rules could be
524     *         loaded for the given set of ids
525     * @throws IllegalArgumentException if the given list of ruleIds is null
526     */
527    @WebMethod(operationName = "getRules")
528    @XmlElementWrapper(name = "rules", required = true)
529    @XmlElement(name = "rule", required = false)
530    @WebResult(name = "rules")
531    @Cacheable(value= RuleDefinition.Cache.NAME, key="'ruleIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
532    public List<RuleDefinition> getRules(@WebParam(name = "ruleIds") List<String> ruleIds);
533
534    /**
535     * Update the Rule specified by the identifier in the DTO
536     *
537     * @param ruleDefinition updated Rule information, object specified by the id
538     * @throws RiceIllegalArgumentException if the given ruleDefinition is null
539     *                                      or invalid
540     */
541    @WebMethod(operationName = "updateRule")
542    @CacheEvict(value={RuleDefinition.Cache.NAME, PropositionDefinition.Cache.NAME, ActionDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME}, allEntries = true)
543    public void updateRule(@WebParam(name = "ruleDefinition") RuleDefinition ruleDefinition) throws RiceIllegalArgumentException;
544
545    /**
546     * Delete the specified Rule
547     *
548     * @param id identifier of the Rule to be deleted
549     * @throws RiceIllegalArgumentException if the given id is null or invalid
550     */
551    @WebMethod(operationName = "deleteRule")
552    @CacheEvict(value={RuleDefinition.Cache.NAME, PropositionDefinition.Cache.NAME, ActionDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME}, allEntries = true)
553    public void deleteRule(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
554
555    ////
556    //// action methods
557    ////
558    /**
559     * Create Action
560     *
561     * @param actionDefinition data for the new Action to be created
562     * @return newly created Action
563     * @throws RiceIllegalArgumentException if the given actionDefinition is null
564     * or invalid
565     */
566    @WebMethod(operationName = "createAction")
567    @WebResult(name = "action")
568    @CacheEvict(value={ActionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
569    public ActionDefinition createAction(@WebParam(name = "actionDefinition") ActionDefinition actionDefinition) throws RiceIllegalArgumentException;
570
571    /**
572     * Retrieves the action for the given actionId. The action includes the
573     * propositions which define the condition that is to be evaluated on the
574     * action. It also defines a collection of actions which will be invoked if
575     * the action succeeds.
576     *
577     * @param actionId the id of the action to retrieve
578     * @return the action definition, or null if no action could be located for the
579     * given actionId
580     * @throws IllegalArgumentException if the given actionId is null
581     */
582    @WebMethod(operationName = "getAction")
583    @WebResult(name = "action")
584    @Cacheable(value= ActionDefinition.Cache.NAME, key="'actionId=' + #p0")
585    public ActionDefinition getAction(@WebParam(name = "actionId") String actionId) throws RiceIllegalArgumentException;
586
587    /**
588     * Retrieves all of the actions for the given list of actionIds.
589     * <p/>
590     * <p>The list which is returned from this operation may not be the same
591     * size as the list which is passed to this method. If a action doesn't exist
592     * for a given action id then no result for that id will be returned in the
593     * list. As a result of this, the returned list can be empty, but it will
594     * never be null.
595     *
596     * @param actionIds the list of action ids for which to retrieve the actions
597     * @return the list of actions for the given ids, this list will only contain
598     * actions for the ids that were resolved successfully, it will never return
599     * null but could return an empty list if no actions could be loaded for the
600     * given set of ids
601     * @throws IllegalArgumentException if the given list of actionIds is null
602     */
603    @WebMethod(operationName = "getActions")
604    @XmlElementWrapper(name = "actions", required = true)
605    @XmlElement(name = "action", required = false)
606    @WebResult(name = "actions")
607    @Cacheable(value= ActionDefinition.Cache.NAME, key="'actionIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
608    public List<ActionDefinition> getActions(@WebParam(name = "actionIds") List<String> actionIds)  throws RiceIllegalArgumentException;
609
610    /**
611     * Update the Action specified by the identifier in the DTO
612     *
613     * @param actionDefinition updated Action information, object specified by the
614     * id
615     * @throws RiceIllegalArgumentException if the given actionDefinition is null
616     * or invalid
617     */
618    @WebMethod(operationName = "updateAction")
619    @CacheEvict(value={ActionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
620    public void updateAction(@WebParam(name = "actionDefinition") ActionDefinition actionDefinition) throws RiceIllegalArgumentException;
621
622    /**
623     * Delete the specified Action
624     *
625     * @param id identifier of the Action to be deleted
626     * @throws RiceIllegalArgumentException if the given id is null or invalid
627     */
628    @WebMethod(operationName = "deleteAction")
629    @CacheEvict(value={ActionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
630    public void deleteAction(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
631
632
633    ////
634    //// proposition methods
635    ////
636    /**
637     * Create a Proposition
638     *
639     * @param propositionDefinition data for the new Proposition to be created
640     * @return newly created Proposition
641     * @throws RiceIllegalArgumentException if the given propositionDefinition
642     *                                      is null or invalid
643     */
644    @WebMethod(operationName = "createProposition")
645    @WebResult(name = "proposition")
646    @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
647    public PropositionDefinition createProposition(@WebParam(name = "propositionDefinition") PropositionDefinition propositionDefinition) throws RiceIllegalArgumentException;
648
649    /**
650     * Retrieve Proposition specified by the identifier
651     *
652     * @param id identifier of the Proposition to be retrieved
653     * @return specified Proposition
654     * @throws RiceIllegalArgumentException if the given id is null or invalid
655     */
656    @WebMethod(operationName = "getProposition")
657    @WebResult(name = "proposition")
658    @Cacheable(value= PropositionDefinition.Cache.NAME, key="'id=' + #p0")
659    public PropositionDefinition getProposition(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
660
661    /**
662     * Retrieve Propositions of the specified type
663     *
664     * @param typeId type of the Propositions to be retrieved
665     * @return list of Propositions of the specified type
666     * @throws RiceIllegalArgumentException if the given typeId is null or
667     *                                      invalid
668     */
669    @WebMethod(operationName = "getPropositionsByType")
670    @XmlElementWrapper(name = "propositions", required = true)
671    @XmlElement(name = "proposition", required = false)
672    @WebResult(name = "propositions")
673    @Cacheable(value= PropositionDefinition.Cache.NAME, key="'typeId=' + #p0")
674    public Set<PropositionDefinition> getPropositionsByType(@WebParam(name = "typeId") String typeId) throws RiceIllegalArgumentException;
675
676    /**
677     * Retrieve Propositions associated with the specified Rule
678     *
679     * @param ruleId identifier of the Rule to which the Propositions are associated with
680     * @return list of Propositions associated with the Rule
681     * @throws RiceIllegalArgumentException if the given ruleId is null or
682     *                                      invalid
683     */
684    @WebMethod(operationName = "getPropositionsByRule")
685    @XmlElementWrapper(name = "propositions", required = true)
686    @XmlElement(name = "proposition", required = false)
687    @WebResult(name = "propositions")
688    @Cacheable(value= PropositionDefinition.Cache.NAME, key="'ruleId=' + #p0")
689    public Set<PropositionDefinition> getPropositionsByRule(@WebParam(name = "ruleId") String ruleId) throws RiceIllegalArgumentException;
690
691    /**
692     * Update the Proposition
693     *
694     * @param propositionDefinition updated data for the Proposition, id specifies the object to be updated
695     * @throws RiceIllegalArgumentException if the given propositionDefinition
696     *                                      is null or invalid
697     */
698    @WebMethod(operationName = "updateProposition")
699    @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
700    public void updateProposition(
701            @WebParam(name = "propositionDefinition") PropositionDefinition propositionDefinition) throws RiceIllegalArgumentException;
702
703    /**
704     * Delete the Proposition
705     *
706     * @param id identifier of the Proposition to be deleted
707     * @throws RiceIllegalArgumentException if the given id is null or invalid
708     */
709    @WebMethod(operationName = "deleteProposition")
710    @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
711    public void deleteProposition(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
712
713    ////
714    //// natural language usages
715    ////
716    /**
717     * Create NaturalLanguageUsage
718     *
719     * @param naturalLanguageUsage data for the new NaturalLanguageUsage to be created
720     * @return newly created NaturalLanguageUsage
721     * @throws RiceIllegalArgumentException if the given naturalLanguageUsage is
722     *                                      null or invalid
723     */
724    @WebMethod(operationName = "createNaturalLanguageUsage")
725    @WebResult(name = "naturalLanguageUsage")
726    @CacheEvict(value={NaturalLanguageUsage.Cache.NAME, NaturalLanguageTemplate.Cache.NAME}, allEntries = true)
727    public NaturalLanguageUsage createNaturalLanguageUsage(@WebParam(name = "naturalLanguageUsage") NaturalLanguageUsage naturalLanguageUsage) throws RiceIllegalArgumentException;
728
729    /**
730     * Retrieve NaturalLanguageUsage specified by the identifier
731     *
732     * @param id identifier of the NaturalLanguageUsage to be retrieved
733     * @return NaturalLanguageUsage specified by the identifier
734     * @throws RiceIllegalArgumentException if the given id is null or invalid
735     */
736    @WebMethod(operationName = "getNaturalLanguageUsage")
737    @WebResult(name = "naturalLanguageUsage")
738    @Cacheable(value= NaturalLanguageUsage.Cache.NAME, key="'id=' + #p0")
739    public NaturalLanguageUsage getNaturalLanguageUsage(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
740
741    /**
742     * Retrieve NaturalLanguageUsage specified by name and namespace
743     *
744     * @param name the name of the natural language usage to retrieve.
745     * @param namespace the namespace that the natural language usage is under.
746     * @return an {@link NaturalLanguageUsage} identified by the given name and
747     * namespace. A null reference is returned if an invalid or non-existent
748     * name and namespace combination is supplied.
749     * @throws RiceIllegalArgumentException if the either the name or the
750     * namespace is null or blank.
751     */
752    @WebMethod(operationName = "getNaturalLanguageUsageByNameAndNamespace")
753    @WebResult(name = "naturalLanguageUsage")
754    @Cacheable(value= NaturalLanguageUsage.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1")
755    public NaturalLanguageUsage getNaturalLanguageUsageByNameAndNamespace(@WebParam(name = "name") String name,
756                                                                          @WebParam(name = "namespace") String namespace)
757            throws RiceIllegalArgumentException;
758
759    /**
760     * Update NaturalLanguageUsage
761     *
762     * @param naturalLanguageUsage updated data for the NaturalLanguageUsage object specified by the id
763     * @throws RiceIllegalArgumentException if the given naturalLanguageUsage is
764     *                                      null or invalid
765     */
766    @WebMethod(operationName = "updateNaturalLanguageUsage")
767    @CacheEvict(value={NaturalLanguageUsage.Cache.NAME, NaturalLanguageTemplate.Cache.NAME}, allEntries = true)
768    public void updateNaturalLanguageUsage(@WebParam(name = "naturalLanguageUsage") NaturalLanguageUsage naturalLanguageUsage) throws RiceIllegalArgumentException;
769
770    /**
771     * Delete NaturalLanguageUsage
772     *
773     * @param naturalLanguageUsageId  identifier of the NaturalLanguageUsage to be deleted
774     * @throws RiceIllegalArgumentException  if the given naturalLanguageUsageId is null or invalid
775     */
776    @WebMethod(operationName = "deleteNaturalLanguageUsage")
777    @CacheEvict(value={NaturalLanguageUsage.Cache.NAME, NaturalLanguageTemplate.Cache.NAME}, allEntries = true)
778    public void deleteNaturalLanguageUsage(@WebParam(name = "naturalLanguageUsageId") String naturalLanguageUsageId) throws RiceIllegalArgumentException;
779
780    /**
781     * Translates and retrieves a NaturalLanguage for a given KRMS object (e.g, proposition
782     * or agenda), NaturalLanguage usage type (context) and language into natural language
783     *
784     * @param namespace namespace to search on.
785     * @return list of NaturalLanguageUsages in a particular namespace
786     */
787    @WebMethod(operationName = "getNaturalLanguageUsagesByNamespace")
788    @XmlElementWrapper(name = "naturalLanguageUsages", required = true)
789    @XmlElement(name = "naturalLanguageUsage", required = false)
790    @WebResult(name = "naturalLanguageUsages")
791    @Cacheable(value= NaturalLanguageUsage.Cache.NAME, key="'namespace=' + #p0")
792    public List<NaturalLanguageUsage> getNaturalLanguageUsagesByNamespace(@WebParam(name = "namespace") String namespace)
793            throws RiceIllegalArgumentException;
794
795    ////
796    //// context methods
797    ////
798    /**
799     * Create Context
800     *
801     * @param contextDefinition data for the new Context to be created
802     * @return newly created Context
803     * @throws RiceIllegalArgumentException if the given contextDefinition is
804     * null or invalid or already in use.
805     */
806    @WebMethod(operationName = "createContext")
807    @WebResult(name = "context")
808    @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true)
809    public ContextDefinition createContext(@WebParam(name = "contextDefinition") ContextDefinition contextDefinition) throws RiceIllegalArgumentException;
810
811
812    /**
813     * find Create Context
814     *
815     * Searches for an existing context with the same name and namespace and returns it
816     * otherwise it creates the context.
817     *
818     * @param contextDefinition data for the new Context to be created
819     * @return newly created Context
820     * @throws RiceIllegalArgumentException if the given contextDefinition is
821     * null or invalid
822     */
823    @WebMethod(operationName = "findCreateContext")
824    @WebResult(name = "context")
825    @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true)
826    public ContextDefinition findCreateContext(@WebParam(name = "contextDefinition") ContextDefinition contextDefinition) throws RiceIllegalArgumentException;
827
828
829    /**
830     * Update the Context specified by the identifier in the input DTO
831     *
832     * @param contextDefinition DTO with updated info and identifier of the
833     * object to be updated
834     * @throws RiceIllegalArgumentException if the given contextDefinition is
835     * null or invalid
836     */
837    @WebMethod(operationName = "updateContext")
838    @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true)
839    public void updateContext(@WebParam(name = "contextDefinition") ContextDefinition contextDefinition) throws RiceIllegalArgumentException;
840
841    /**
842     * Delete the specified Context
843     *
844     * @param id identifier of the object to be deleted
845     * @throws RiceIllegalArgumentException if the given id is null or invalid
846     */
847    @WebMethod(operationName = "deleteContext")
848    @CacheEvict(value={ContextDefinition.Cache.NAME}, allEntries = true)
849    public void deleteContext(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
850
851    /**
852     * Retrieve Context for the specified id
853     *
854     * @param id identifier for the Context
855     * @return specified Context
856     * @throws RiceIllegalArgumentException if the given id is null or invalid
857     */
858    @WebMethod(operationName = "getContext")
859    @WebResult(name = "context")
860    @Cacheable(value= ContextDefinition.Cache.NAME, key="'id=' + #p0")
861    public ContextDefinition getContext(@WebParam(name = "id") String id) throws RiceIllegalArgumentException;
862
863    /**
864     * Retrieves an Context from the repository based on the provided context
865     * name and namespace.
866     *
867     * @param name the name of the Context to retrieve.
868     * @param namespace the namespace that the context is under.
869     * @return an {@link ContextDefinition} identified by the given name and
870     * namespace. A null reference is returned if an invalid or non-existent
871     * name and namespace combination is supplied.
872     * @throws RiceIllegalArgumentException if the either the name or the
873     * namespace is null or blank.
874     */
875    @WebMethod(operationName = "getContextByNameAndNamespace")
876    @WebResult(name = "context")
877    @Cacheable(value= ContextDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1")
878    public ContextDefinition getContextByNameAndNamespace(@WebParam(name = "name") String name,
879                                                          @WebParam(name = "namespace") String namespace)
880            throws RiceIllegalArgumentException;
881
882    //// natural languatge template methods
883    /**
884     * This will create a {@link NaturalLanguageTemplate} exactly like the
885     * parameter passed in except the id will be assigned and create date/user 
886     * will be set.
887     *
888     * @param naturalLanguageTemplate The NaturalLanguageTemplate to create.
889     * @throws RiceIllegalArgumentException if the NaturalLanguageTemplate is null.
890     * @throws IllegalStateException if the NaturalLanguageTemplate already
891     * exists in the system.
892     * @return a {@link NaturalLanguageTemplate} exactly like the parameter
893     * passed in.
894     *
895     */
896    @WebMethod(operationName = "createNaturalLanguageTemplate")
897    @WebResult(name = "naturalLanguageTemplate")
898    @CacheEvict(value={NaturalLanguageTemplate.Cache.NAME}, allEntries = true)
899    public NaturalLanguageTemplate createNaturalLanguageTemplate(@WebParam(name = "naturalLanguageTemplate") NaturalLanguageTemplate naturalLanguageTemplate)
900            throws RiceIllegalArgumentException;
901
902    /**
903     * Retrieves a NaturalLanguageTemplate from the repository based on the
904     * given id.
905     *
906     * @param naturalLanguageTemplateId to retrieve.
907     * @return a {@link NaturalLanguageTemplate} identified by the given id. 
908     * @throws IllegalArgumentException if the given actionId is null     *
909     */
910    @WebMethod(operationName = "getNaturalLanguageTemplate")
911    @WebResult(name = "naturalLanguageTemplate")
912    @Cacheable(value= NaturalLanguageTemplate.Cache.NAME, key="'naturalLanguageTemplateId=' + #p0")
913    public NaturalLanguageTemplate getNaturalLanguageTemplate(@WebParam(name = "naturalLanguageTemplateId") String naturalLanguageTemplateId)
914            throws RiceIllegalArgumentException;
915
916    /**
917     * This will update an existing {@link NaturalLanguageTemplate}.
918     *
919     * @param naturalLanguageTemplate The NaturalLanguageTemplate to update.
920     * @throws RiceIllegalArgumentException if the NaturalLanguageTemplate is null.
921     * exists in the system.
922     *
923     */
924    @WebMethod(operationName = "updateNaturalLanguageTemplate")
925    @CacheEvict(value={NaturalLanguageTemplate.Cache.NAME}, allEntries = true)
926    public void updateNaturalLanguageTemplate(@WebParam(name = "naturalLanguageTemplate") NaturalLanguageTemplate naturalLanguageTemplate)
927            throws RiceIllegalArgumentException;
928
929    /**
930     * Delete the {@link NaturalLanguageTemplate} with the given id.
931     *
932     * @param naturalLanguageTemplateId to delete.
933     * @throws RiceIllegalArgumentException if the NaturalLanguageTemplate is null.
934     *
935     */
936    @WebMethod(operationName = "deleteNaturalLanguageTemplate")
937    @CacheEvict(value={NaturalLanguageTemplate.Cache.NAME}, allEntries = true)
938    public void deleteNaturalLanguageTemplate(@WebParam(name = "naturalLanguageTemplateId") String naturalLanguageTemplateId)
939            throws RiceIllegalArgumentException;
940
941    /**
942     * Finds all the natural language templates for a particular language
943     *
944     * @param languageCode language on which to search
945     * @return list of templates for that language
946     */
947    @WebMethod(operationName = "findNaturalLanguageTemplatesByLanguageCode")
948    @XmlElementWrapper(name = "naturalLangaugeTemplates", required = true)
949    @XmlElement(name = "naturalLangaugeTemplate", required = false)
950    @WebResult(name = "naturalLangaugeTemplates")
951    @Cacheable(value= NaturalLanguageTemplate.Cache.NAME, key="'languageCode=' + #p0")
952    public List<NaturalLanguageTemplate> findNaturalLanguageTemplatesByLanguageCode(@WebParam(name = "languageCode") String languageCode)
953            throws RiceIllegalArgumentException;
954
955    @WebMethod(operationName = "findNaturalLanguageTemplateByLanguageCodeTypeIdAndNluId")
956    @WebResult(name = "naturalLangaugeTemplate")
957    @Cacheable(value= NaturalLanguageTemplate.Cache.NAME, key="'languageCode=' + #p0 + '|' + 'typeId=' + #p1 + '|' + 'naturalLanguageUsageId=' + #p2")
958    public NaturalLanguageTemplate findNaturalLanguageTemplateByLanguageCodeTypeIdAndNluId(@WebParam(name = "languageCode") String languageCode,
959                                                                                           @WebParam(name = "typeId") String typeId,
960                                                                                           @WebParam(name = "naturalLanguageUsageId") String naturalLanguageUsageId)
961            throws RiceIllegalArgumentException;
962
963    /**
964     * Find all the natural language templates for a particular usage
965     *
966     * @param naturalLanguageUsageId the usage on which to search
967     * @return list of templates that match the usage
968     */
969    @WebMethod(operationName = "findNaturalLanguageTemplatesByNaturalLanguageUsage")
970    @XmlElementWrapper(name = "naturalLangaugeTemplates", required = true)
971    @XmlElement(name = "naturalLangaugeTemplate", required = false)
972    @WebResult(name = "naturalLangaugeTemplates")
973    @Cacheable(value= NaturalLanguageTemplate.Cache.NAME, key="'naturalLanguageUsageId=' + #p0")
974    public List<NaturalLanguageTemplate> findNaturalLanguageTemplatesByNaturalLanguageUsage(@WebParam(name = "naturalLanguageUsageId") String naturalLanguageUsageId)
975            throws RiceIllegalArgumentException;
976
977    /**
978     * Find all the natural language templates of a particular type
979     *
980     * Template types are keys that identify the message that is to be expressed
981     * in different languages and in different usage scenarios
982     *
983     * @param typeId on which to search
984     * @return list of templates matching that type
985     */
986    @WebMethod(operationName = "findNaturalLanguageTemplatesByType")
987    @XmlElementWrapper(name = "naturalLangaugeTemplates", required = true)
988    @XmlElement(name = "naturalLangaugeTemplate", required = false)
989    @WebResult(name = "naturalLangaugeTemplates")
990    @Cacheable(value= NaturalLanguageTemplate.Cache.NAME, key="'typeId=' + #p0")
991    public List<NaturalLanguageTemplate> findNaturalLanguageTemplatesByType(@WebParam(name = "typeId") String typeId)
992            throws RiceIllegalArgumentException;
993
994    /**
995     * Find the natural language template using the actual text of the template.
996     *
997     * @param template text to match exactly
998     * @return list of matching templates
999     */
1000    @WebMethod(operationName = "findNaturalLanguageTemplatesByTemplate")
1001    @XmlElementWrapper(name = "naturalLangaugeTemplates", required = true)
1002    @XmlElement(name = "naturalLangaugeTemplate", required = false)
1003    @WebResult(name = "naturalLangaugeTemplates")
1004    @Cacheable(value= NaturalLanguageTemplate.Cache.NAME, key="'template=' + #p0")
1005    public List<NaturalLanguageTemplate> findNaturalLanguageTemplatesByTemplate(@WebParam(name = "template") String template)
1006            throws RiceIllegalArgumentException;
1007
1008    ////
1009    //// translation methods
1010    ////
1011    /**
1012     * Translates and retrieves a NaturalLanguage for a given KRMS object (e.g,
1013     * proposition or agenda), NaturalLanguage usage type (context) and language
1014     * into natural language TODO: Add appropriate caching annotation
1015     *
1016     * @param naturalLanguageUsageId Natural language usage information
1017     * @param typeId    KRMS object type id (for example, could refer to agenda
1018     *                  or proposition)
1019     * @param krmsObjectId KRMS object identifier
1020     * @param languageCode  desired
1021     * @return natural language corresponding to the NaturalLanguage usage, KRMS object id, KRMS object type and desired language
1022     * @throws RiceIllegalArgumentException if the given naturalLanguageUsageId, typeId,
1023     *                                      krmsObjectId or language is null or
1024     *                                      invalid
1025     */
1026    @WebMethod(operationName = "translateNaturalLanguageForObject")
1027    @WebResult(name = "naturalLanguage")
1028    @Override
1029    public String translateNaturalLanguageForObject(@WebParam(name = "naturalLanguageUsageId") String naturalLanguageUsageId,
1030                                                    @WebParam(name = "typeId") String typeId, @WebParam(name = "krmsObjectId") String krmsObjectId,
1031                                                    @WebParam(name = "languageCode") String languageCode) throws RiceIllegalArgumentException;
1032
1033    /**
1034     * Translates and retrieves a NaturalLanguage for a list of KRMS objects (e.g,
1035     * propositions or agendas), NaturalLanguage usage type (context) and language
1036     * into natural language
1037     *
1038     * @param naturalLanguageUsageId Natural language usage information
1039     * @param typeId    KRMS object type id (for example, could refer to agenda
1040     *                  or proposition)
1041     * @param krmsObjectIds KRMS object identifier
1042     * @param languageCode  desired
1043     * @return natural language corresponding to the NaturalLanguage usage, KRMS object id, KRMS object type and desired language
1044     * @throws RiceIllegalArgumentException if the given naturalLanguageUsageId, typeId,
1045     *                                      krmsObjectId or language is null or
1046     *                                      invalid
1047     */
1048    @WebMethod(operationName = "translateNaturalLanguageForObjects")
1049    @WebResult(name = "naturalLanguages")
1050    public List<NaturalLanguage> translateNaturalLanguageForObjects(@WebParam(name = "naturalLanguageUsageId") String naturalLanguageUsageId,
1051                                                    @WebParam(name = "typeId") String typeId, @WebParam(name = "krmsObjectIds") List<String> krmsObjectIds,
1052                                                    @WebParam(name = "languageCode") String languageCode) throws RiceIllegalArgumentException;
1053
1054    /**
1055     * Retrieve all the NaturalLanguageUsages
1056     *
1057     * @return list of NaturalLanguageUsages
1058     */
1059    @WebMethod(operationName = "translateNaturalLanguageForProposition")
1060    @WebResult(name = "naturalLanguage")
1061    @Override
1062    public String translateNaturalLanguageForProposition(@WebParam(name = "naturalLanguageUsageId") String naturalLanguageUsageId,
1063                                                         @WebParam(name = "propositionDefinintion") PropositionDefinition propositionDefinintion,
1064                                                         @WebParam(name = "languageCode") String languageCode)
1065            throws RiceIllegalArgumentException;
1066
1067    /**
1068     * Translates NaturalLanguage for a given proposition, returning a tree of
1069     * the NaturalLanguage.
1070     *
1071     * This method is used to "preview" the proposition in a tree structure
1072     * before saving.
1073     *
1074     * @param naturalLanguageUsageId Natural language usage information
1075     * @param propositionDefinintion proposition to be translated
1076     * @param languageCode desired
1077     * @return natural language tree corresponding to the NaturalLanguage usage,
1078     * proposition and desired language
1079     * @throws RiceIllegalArgumentException if the given naturalLanguageUsageId,
1080     * proposition, or language is null or invalid
1081     */
1082    @WebMethod(operationName = "translateNaturalLanguageTreeForProposition")
1083    @WebResult(name = "naturalLanguageTree")
1084    @Override
1085    public NaturalLanguageTree translateNaturalLanguageTreeForProposition(@WebParam(name = "naturalLanguageUsageId") String naturalLanguageUsageId,
1086                                                                          @WebParam(name = "propositionDefinintion") PropositionDefinition propositionDefinintion,
1087                                                                          @WebParam(name = "languageCode") String languageCode)
1088            throws RiceIllegalArgumentException;
1089
1090
1091    /**
1092     * Query for Context ids based on the given search criteria which is a Map
1093     * of Context field names to values.
1094     * <p/>
1095     * <p> This method returns it's results as a List of Context ids that match
1096     * the given search criteria. </p>
1097     *
1098     * @param queryByCriteria the criteria. Cannot be null.
1099     * @return a list of ids matching the given criteria properties. An empty
1100     * list is returned if an invalid or non-existent criteria is supplied.
1101     * @throws RiceIllegalArgumentException if the queryByCriteria is null
1102     */
1103    @WebMethod(operationName = "findContextIds")
1104    @XmlElementWrapper(name = "contextIds", required = true)
1105    @XmlElement(name = "context", required = false)
1106    @WebResult(name = "contextIds")
1107    List<String> findContextIds(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
1108
1109    /**
1110     * Query for Agenda ids based on the given search criteria which is a Map of
1111     * Agenda field names to values.
1112     * <p/>
1113     * <p> This method returns it's results as a List of Agenda ids that match
1114     * the given search criteria. </p>
1115     *
1116     * @param queryByCriteria the criteria. Cannot be null.
1117     * @return a list of ids matching the given criteria properties. An empty
1118     * list is returned if an invalid or non-existent criteria is supplied.
1119     * @throws RiceIllegalArgumentException if the queryByCriteria is null
1120     */
1121    @WebMethod(operationName = "findAgendaIds")
1122    @XmlElementWrapper(name = "contextIds", required = true)
1123    @XmlElement(name = "agenda", required = false)
1124    @WebResult(name = "agendaIds")
1125    List<String> findAgendaIds(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
1126
1127    /**
1128     * Query for Rule ids based on the given search criteria which is a Map of
1129     * Rule field names to values.
1130     * <p/>
1131     * <p> This method returns it's results as a List of Rule ids that match the
1132     * given search criteria. </p>
1133     *
1134     * @param queryByCriteria the criteria. Cannot be null.
1135     * @return a list of ids matching the given criteria properties. An empty
1136     * list is returned if an invalid or non-existent criteria is supplied.
1137     * @throws RiceIllegalArgumentException if the queryByCriteria is null
1138     */
1139    @WebMethod(operationName = "findRuleIds")
1140    @XmlElementWrapper(name = "ruleIds", required = true)
1141    @XmlElement(name = "rule", required = false)
1142    @WebResult(name = "ruleIds")
1143    List<String> findRuleIds(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
1144
1145    /**
1146     * Query for Proposition ids based on the given search criteria which is a
1147     * Map of Proposition field names to values.
1148     * <p/>
1149     * <p> This method returns it's results as a List of Proposition ids that
1150     * match the given search criteria. </p>
1151     *
1152     * @param queryByCriteria the criteria. Cannot be null.
1153     * @return a list of ids matching the given criteria properties. An empty
1154     * list is returned if an invalid or non-existent criteria is supplied.
1155     * @throws RiceIllegalArgumentException if the queryByCriteria is null
1156     */
1157    @WebMethod(operationName = "findPropositionIds")
1158    @XmlElementWrapper(name = "propositionIds", required = true)
1159    @XmlElement(name = "proposition", required = false)
1160    @WebResult(name = "propositionIds")
1161    List<String> findPropositionIds(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
1162
1163    /**
1164     * Query for Action ids based on the given search criteria which is a Map
1165     * of Action field names to values.
1166     * <p/>
1167     * <p> This method returns it's results as a List of Action ids that match
1168     * the given search criteria. </p>
1169     *
1170     * @param queryByCriteria the criteria. Cannot be null.
1171     * @return a list of ids matching the given criteria properties. An empty
1172     * list is returned if an invalid or non-existent criteria is supplied.
1173     * @throws RiceIllegalArgumentException if the queryByCriteria is null
1174     */
1175    @WebMethod(operationName = "findActionIds")
1176    @XmlElementWrapper(name = "actionIds", required = true)
1177    @XmlElement(name = "action", required = false)
1178    @WebResult(name = "actionIds")
1179    List<String> findActionIds(@WebParam(name = "query") QueryByCriteria queryByCriteria) throws RiceIllegalArgumentException;
1180
1181    ////
1182    //// extra methods from RuleRepositoryService copied here so I can break the dependence on that service
1183    //// and then implement different caching schemes for each 
1184    ////
1185
1186
1187    /**
1188     * Locates a ContextDefinition based on the given map of context qualifiers.
1189     * The requirements for valid selection criteria are implementation
1190     * dependent. An IllegalArgumentException may be thrown if the
1191     * implementation can't operate with the given criteria.
1192     *
1193     * @param contextSelectionCriteria
1194     * @return
1195     * @see ContextSelectionCriteria
1196     * @throws RiceIllegalArgumentException if the implementation can't handle
1197     * the given ContextSelectionCriteria
1198     */
1199    @WebMethod(operationName = "selectContext")
1200    @WebResult(name = "contextDefinition")
1201    public ContextDefinition selectContext(@WebParam(name = "contextSelectionCriteria") ContextSelectionCriteria contextSelectionCriteria)
1202            throws RiceIllegalArgumentException;
1203
1204    /**
1205     * Retrieves the agenda tree for the given agendaId. The agenda tree
1206     * includes the entire agenda definition in the appropriate order and with
1207     * the defined agenda branching.
1208     *
1209     * @param agendaId the id of the agenda for which to retrieve the agenda
1210     * tree
1211     * @return the agenda tree, or null if no agenda could be located for the
1212     * given agendaId
1213     *
1214     * @throws RiceIllegalArgumentException if the given agendaId is null
1215     */
1216    @WebMethod(operationName = "getAgendaTree")
1217    @WebResult(name = "agendaTree")
1218    @Cacheable(value= AgendaTreeDefinition.Cache.NAME, key="'agendaId=' + #p0")
1219    public AgendaTreeDefinition getAgendaTree(@WebParam(name = "agendaId") String agendaId)
1220            throws RiceIllegalArgumentException;
1221
1222    /**
1223     * Retrieves all of the agendas trees for the given list of agendaIds. The
1224     * agenda tree includes the entire agenda definition in the appropriate
1225     * order and with the defined agenda branching.
1226     *
1227     * <p>The list which is returned from this operation may not be the same
1228     * size as the list which is passed to this method. If an agenda doesn't
1229     * exist for a given agenda id then no result for that id will be returned
1230     * in the list. As a result of this, the returned list can be empty, but it
1231     * will never be null.
1232     *
1233     * @param agendaIds the list of agenda ids for which to retrieve the agenda
1234     * trees
1235     * @return the list of agenda trees for the given ids, this list will only
1236     * contain agenda trees for the ids that were resolved successfully, it will
1237     * never return null but could return an empty list if no agenda trees could
1238     * be loaded for the given set of ids
1239     *
1240     * @throws RiceIllegalArgumentException if the given list of agendaIds is
1241     * null
1242     */
1243    @WebMethod(operationName = "getAgendaTrees")
1244    @XmlElementWrapper(name = "agendaTrees", required = true)
1245    @XmlElement(name = "agendaTree", required = false)
1246    @WebResult(name = "agendaTrees")
1247    @Cacheable(value= AgendaTreeDefinition.Cache.NAME, key="'agendaIds=' + T(org.kuali.rice.core.api.cache.CacheKeyUtils).key(#p0)")
1248    public List<AgendaTreeDefinition> getAgendaTrees(@WebParam(name = "agendaIds") List<String> agendaIds)
1249            throws RiceIllegalArgumentException;
1250
1251
1252}