001 /**
002 * Copyright 2005-2012 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.krms.impl.repository;
017
018 import java.util.List;
019
020
021 import org.kuali.rice.krms.api.repository.proposition.PropositionDefinition;
022 import org.kuali.rice.krms.api.repository.proposition.PropositionParameter;
023 import org.kuali.rice.krms.api.repository.rule.RuleDefinition;
024 import org.springframework.cache.annotation.CacheEvict;
025 import org.springframework.cache.annotation.Cacheable;
026
027 public interface PropositionBoService {
028
029 /**
030 * This will create a {@link PropositionDefinition} exactly like the parameter passed in.
031 *
032 * @param prop the proposition to create
033 * @throws IllegalArgumentException if the proposition is null
034 * @throws IllegalStateException if the proposition already exists in the system
035 */
036 @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
037 PropositionDefinition createProposition(PropositionDefinition prop);
038
039 /**
040 * This will update an existing {@link PropositionDefinition}.
041 *
042 * @param prop the proposition to update
043 * @throws IllegalArgumentException if the proposition is null
044 * @throws IllegalStateException if the proposition does not exist in the system
045 */
046 @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
047 void updateProposition(PropositionDefinition prop);
048
049 /**
050 * Lookup the proposition based on the given proposition id.
051 *
052 * @param propId the given proposition id
053 * @return a proposition associated with the given proposition id. A null reference is returned if an invalid or
054 * non-existent id is supplied.
055 */
056 @Cacheable(value= PropositionDefinition.Cache.NAME, key="'propId=' + #p0")
057 PropositionDefinition getPropositionById(String propId);
058
059
060
061 /**
062 * This will create a {@link PropositionParameter} exactly like the parameter passed in.
063 *
064 * @param parameter the proposition parameter to create
065 * @throws IllegalArgumentException if the proposition parameter is null
066 * @throws IllegalStateException if the proposition parameter is already existing in the system
067 */
068 @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
069 void createParameter(PropositionParameter parameter);
070
071 /**
072 * This will update a {@link PropositionParameter}.
073 *
074 *
075 * @param parameter the proposition parameter to update
076 * @throws IllegalArgumentException if the proposition parameter is null
077 * @throws IllegalStateException if the proposition parameter does not exist in the system
078 */
079 @CacheEvict(value={PropositionDefinition.Cache.NAME, RuleDefinition.Cache.NAME}, allEntries = true)
080 void updateParameter(PropositionParameter parameter);
081
082 /**
083 * Lookup the proposition parameters based on the given proposition id.
084 *
085 * @param propId the given proposition id
086 * @return a list of PropositionParameters associated with the given proposition id. A null reference is returned if an invalid or
087 * non-existant id is supplied.
088 */
089 List<PropositionParameter> getParameters(String propId);
090
091 /**
092 * Lookup the proposition parameter based on the id.
093 *
094 * @param id the given proposition id
095 * @return an immutable PropositionParameters associated with the given id. A null reference is returned if an invalid or
096 * non-existant id is supplied.
097 */
098 PropositionParameter getParameterById(String id);
099
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 }