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