View Javadoc
1   /**
2    * Copyright 2005-2016 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.impl.repository;
17  
18  import java.util.List;
19  import java.util.Set;
20  
21  import org.kuali.rice.krms.api.repository.proposition.PropositionDefinition;
22  import org.kuali.rice.krms.api.repository.proposition.PropositionParameter;
23  import org.kuali.rice.krms.api.repository.rule.RuleDefinition;
24  import org.springframework.cache.annotation.CacheEvict;
25  import org.springframework.cache.annotation.Cacheable;
26  
27  /**
28   * This is the interface for accessing KRMS repository Proposition related
29   * business objects.
30   *
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   *
33   */
34  public interface PropositionBoService {
35  
36      /**
37       * This will create a {@link PropositionDefinition} exactly like the parameter passed in.
38       *
39       * @param prop the proposition to create
40       * @throws IllegalArgumentException if the proposition is null
41       * @throws IllegalStateException if the proposition already exists in the system
42       */
43      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
44      PropositionDefinition createProposition(PropositionDefinition prop);
45  
46      /**
47       * This will update an existing {@link PropositionDefinition}.
48       *
49       * @param prop the proposition to update
50       * @throws IllegalArgumentException if the proposition is null
51       * @throws IllegalStateException if the proposition does not exist in the system
52       */
53      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
54      PropositionDefinition updateProposition(PropositionDefinition prop);
55  
56      /**
57       * This will delete an existing {@link PropositionDefinition}.
58       *
59       * @param propId the proposition to delete
60       * @throws IllegalArgumentException if the proposition is null
61       * @throws IllegalStateException if the proposition does not exist in the system
62       */
63      void deleteProposition(String propId);
64  
65      /**
66       * Lookup the proposition based on the given proposition id.
67       *
68       * @param propId the given proposition id
69       * @return a proposition associated with the given proposition id.  A null reference is returned if an invalid or
70       *         non-existent id is supplied.
71       */
72      @Cacheable(value= PropositionDefinition.Cache.NAME, key="'propId=' + #p0")
73      PropositionDefinition getPropositionById(String propId);
74  
75      public Set<PropositionDefinition> getPropositionsByType(String typeId);
76  
77      public Set<PropositionDefinition> getPropositionsByRule(String ruleId);
78  
79      /**
80       * This will create a {@link PropositionParameter} exactly like the parameter passed in.
81       *
82       * @param parameter the proposition parameter to create
83       * @throws IllegalArgumentException if the proposition parameter is null
84       * @throws IllegalStateException if the proposition parameter is already existing in the system
85       */
86      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
87      void createParameter(PropositionParameter parameter);
88  
89      /**
90       * This will update a {@link PropositionParameter}.
91       *
92       *
93       * @param parameter the proposition parameter to update
94       * @throws IllegalArgumentException if the proposition parameter is null
95       * @throws IllegalStateException if the proposition parameter does not exist in the system
96       */
97      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
98      PropositionParameter updateParameter(PropositionParameter parameter);
99  
100 
101     /**
102      * Lookup the proposition parameters based on the given proposition id.
103      *
104      * @param propId the given proposition id
105      * @return a list of PropositionParameters associated with the given proposition id.  A null reference is returned if an invalid or
106      *         non-existant id is supplied.
107      */
108     List<PropositionParameter> getParameters(String propId);
109 
110     /**
111      * Lookup the proposition parameter based on the id.
112      *
113      * @param id the given proposition id
114      * @return an immutable PropositionParameters associated with the given id.  A null reference is returned if an invalid or
115      *         non-existant id is supplied.
116      */
117     PropositionParameter getParameterById(String id);
118 
119     /**
120      * Lookup the proposition parameter based on the proposition id and sequence number.
121      *
122      * @param propId the given proposition id
123      * @return an immutable PropositionParameters associated with the given proposition id and sequence number.  A null reference is returned if an invalid or
124      *         non-existant.
125      */
126     PropositionParameter getParameterByPropIdAndSequenceNumber(String propId, Integer sequenceNumber);
127 
128 
129 }