View Javadoc

1   /**
2    * Copyright 2005-2012 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  
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  public interface PropositionBoService {
28  
29      /**
30       * This will create a {@link PropositionDefinition} exactly like the parameter passed in.
31       *
32       * @param prop the proposition to create
33       * @throws IllegalArgumentException if the proposition is null
34       * @throws IllegalStateException if the proposition already exists in the system
35       */
36      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
37      PropositionDefinition createProposition(PropositionDefinition prop);
38  
39      /**
40       * This will update an existing {@link PropositionDefinition}.
41       *
42       * @param prop the proposition to update
43       * @throws IllegalArgumentException if the proposition is null
44       * @throws IllegalStateException if the proposition does not exist in the system
45       */
46      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
47      void updateProposition(PropositionDefinition prop);
48  
49      /**
50       * Lookup the proposition based on the given proposition id.
51       *
52       * @param propId the given proposition id
53       * @return a proposition associated with the given proposition id.  A null reference is returned if an invalid or
54       *         non-existent id is supplied.
55       */
56      @Cacheable(value= PropositionDefinition.Cache.NAME, key="'propId=' + #p0")
57      PropositionDefinition getPropositionById(String propId);
58  
59  
60  
61      /**
62       * This will create a {@link PropositionParameter} exactly like the parameter passed in.
63       *
64       * @param parameter the proposition parameter to create
65       * @throws IllegalArgumentException if the proposition parameter is null
66       * @throws IllegalStateException if the proposition parameter is already existing in the system
67       */
68      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
69      void createParameter(PropositionParameter parameter);
70  
71      /**
72       * This will update a {@link PropositionParameter}.
73       *
74       *
75       * @param parameter the proposition parameter to update
76       * @throws IllegalArgumentException if the proposition parameter is null
77       * @throws IllegalStateException if the proposition parameter does not exist in the system
78       */
79      @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
80      void updateParameter(PropositionParameter parameter);
81  
82      /**
83       * Lookup the proposition parameters based on the given proposition id.
84       *
85       * @param propId the given proposition id
86       * @return a list of PropositionParameters associated with the given proposition id.  A null reference is returned if an invalid or
87       *         non-existant id is supplied.
88       */
89      List<PropositionParameter> getParameters(String propId);
90  
91      /**
92       * Lookup the proposition parameter based on the id.
93       *
94       * @param id the given proposition id
95       * @return an immutable PropositionParameters associated with the given id.  A null reference is returned if an invalid or
96       *         non-existant id is supplied.
97       */
98      PropositionParameter getParameterById(String id);
99  
100     /**
101      * Lookup the proposition parameter based on the proposition id and sequence number.
102      *
103      * @param id the given proposition id
104      * @return an immutable PropositionParameters associated with the given proposition id and sequence number.  A null reference is returned if an invalid or
105      *         non-existant.
106      */
107     PropositionParameter getParameterByPropIdAndSequenceNumber(String propId, Integer sequenceNumber);
108 
109 
110 }