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 org.kuali.rice.krms.api.repository.rule.RuleDefinition; 019 import org.springframework.cache.annotation.CacheEvict; 020 import org.springframework.cache.annotation.Cacheable; 021 022 /** 023 * This is the interface for accessing KRMS repository Rule related bos 024 * 025 * @author Kuali Rice Team (rice.collab@kuali.org) 026 * 027 */ 028 public interface RuleBoService { 029 /** 030 * This will create a {@link RuleDefinition} exactly like the parameter passed in. 031 * 032 * @param rule The Rule to create 033 * @throws IllegalArgumentException if the rule is null 034 * @throws IllegalStateException if the rule already exists in the system 035 */ 036 @CacheEvict(value={RuleDefinition.Cache.NAME}, allEntries = true) 037 public RuleDefinition createRule(RuleDefinition rule); 038 039 /** 040 * This will update an existing {@link RuleDefinition}. 041 * 042 * @param rule The Rule to update 043 * @throws IllegalArgumentException if the Rule is null 044 * @throws IllegalStateException if the Rule does not exists in the system 045 */ 046 @CacheEvict(value={RuleDefinition.Cache.NAME}, allEntries = true) 047 public void updateRule(RuleDefinition rule); 048 049 /** 050 * Retrieves an Rule from the repository based on the given rule id. 051 * 052 * @param ruleId the id of the Rule to retrieve 053 * @return an {@link RuleDefinition} identified by the given actionId. 054 * A null reference is returned if an invalid or non-existent id is supplied. 055 * @throws IllegalArgumentException if the ruleId is null or blank. 056 */ 057 @Cacheable(value= RuleDefinition.Cache.NAME, key="'ruleId=' + #p0") 058 public RuleDefinition getRuleByRuleId(String ruleId); 059 060 /** 061 * Retrieves an Rule from the repository based on the provided rule name 062 * and namespace. 063 * 064 * @param name the name of the Rule to retrieve. 065 * @param namespace the namespace that the rule is under. 066 * @return an {@link RuleDefinition} identified by the given name and namespace. 067 * A null reference is returned if an invalid or non-existent name and 068 * namespace combination is supplied. 069 * @throws IllegalArgumentException if the either the name or the namespace 070 * is null or blank. 071 */ 072 @Cacheable(value= RuleDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'namespace=' + #p1") 073 public RuleDefinition getRuleByNameAndNamespace(String name, String namespace); 074 075 // public void createRuleAttribute(RuleAttribute ruleAttribute); 076 // public void updateRuleAttribute(RuleAttribute ruleAttribute); 077 // 078 // public RuleAttribute getRuleAttributeById(String attrId); 079 080 // public void setBusinessObjectService(final BusinessObjectService businessObjectService); 081 // public List<RuleDefinition> convertListOfBosToImmutables(final Collection<RuleBo> ruleBos); 082 }