001/** 002 * Copyright 2005-2016 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.Set; 019 020import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition; 021import org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition; 022import org.kuali.rice.krms.api.repository.agenda.AgendaTreeDefinition; 023import org.kuali.rice.krms.api.repository.context.ContextDefinition; 024import org.springframework.cache.annotation.CacheEvict; 025import org.springframework.cache.annotation.Cacheable; 026 027/** 028 * This is the interface for accessing KRMS repository Agenda related 029 * business objects. 030 * 031 * @author Kuali Rice Team (rice.collab@kuali.org) 032 * 033 */ 034public interface AgendaBoService { 035 036 /** 037 * This will create a {@link AgendaDefinition} exactly like the parameter passed in. 038 * 039 * @param agenda The Agenda to create 040 * @throws IllegalArgumentException if the Agenda is null 041 * @throws IllegalStateException if the Agenda already exists in the system 042 */ 043 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true) 044 public AgendaDefinition createAgenda(AgendaDefinition agenda); 045 046 /** 047 * This will update an existing {@link AgendaDefinition}. 048 * 049 * @param agenda The Agenda to update 050 * @throws IllegalArgumentException if the Agenda is null 051 * @throws IllegalStateException if the Agenda does not exists in the system 052 */ 053 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true) 054 public void updateAgenda(AgendaDefinition agenda); 055 056 /** 057 * Retrieves an Agenda from the repository based on the given agenda id. 058 * 059 * @param agendaId the id of the Agenda to retrieve 060 * @return an {@link AgendaDefinition} identified by the given agendaId. 061 * A null reference is returned if an invalid or non-existent id is supplied. 062 */ 063 @Cacheable(value= AgendaDefinition.Cache.NAME, key="'agendaId=' + #p0") 064 public AgendaDefinition getAgendaByAgendaId(String agendaId); 065 066 /** 067 * Retrieves an Agenda from the repository based on the provided agenda name 068 * and context id. 069 * 070 * @param name the name of the Agenda to retrieve. 071 * @param contextId the id of the context that the agenda belongs to. 072 * @return an {@link AgendaDefinition} identified by the given name and namespace. 073 * A null reference is returned if an invalid or non-existent name and 074 * namespace combination is supplied. 075 */ 076 @Cacheable(value= AgendaDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'contextId=' + #p1") 077 public AgendaDefinition getAgendaByNameAndContextId(String name, String contextId); 078 079 /** 080 * Retrieves a set of Agendas associated with a context. 081 * 082 * @param contextId the id of the context 083 * @return a set of {@link AgendaDefinition} associated with the given context. 084 * A null reference is returned if an invalid or contextId is supplied. 085 */ 086 @Cacheable(value= AgendaDefinition.Cache.NAME, key="'contextId=' + #p0") 087 public Set<AgendaDefinition> getAgendasByContextId(String contextId); 088 089 /** 090 * This will create an {@link org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition} in the repository exactly like 091 * the parameter passed in. 092 * 093 * @param agendaItem The AgendaItemDefinition to create 094 * @throws IllegalArgumentException if the AgendaItemDefinition is null 095 * @throws IllegalStateException if the AgendaItemDefinition already exists in the system 096 */ 097 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true) 098 public AgendaItemDefinition createAgendaItem(AgendaItemDefinition agendaItem); 099 100 /** 101 * This will update an existing {@link org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition}. 102 * 103 * @param agendaItem The AgendaItemDefinition to update 104 * @throws IllegalArgumentException if the AgendaItemDefinition is null 105 * @throws IllegalStateException if the AgendaItemDefinition does not exists in the system 106 */ 107 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true) 108 public void updateAgendaItem(AgendaItemDefinition agendaItem); 109 110 /** 111 * This will create an {@link org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition} in the repository exactly like 112 * the parameter passed in. The AgendaItemDefinition will be linked to an existing 113 * AgendaItemDefinition in the relationship provided. Linking the AgendaItems effectively 114 * builds a tree of AgendaItems that may be traversed by the engine. 115 * 116 * @param agendaItem The AgendaItemDefinition to create 117 * @param parentId The id of the existing AgendaItemDefinition to be linked with the 118 * newly created AgendaItemDefinition 119 * @param position. A boolean used to specify the relationship between the 120 * linked AgendaItems. 121 * <p> If the position parameter is true, the new AgendaItemDefinition is linked as the next 122 * AgendaItemDefinition to be evaluated if the parent AgendaItemDefinition evaluates to TRUE. 123 * <p> If the position parameter is false, the new AgendaItemDefinition is linked as the next 124 * AgendaItemDefinition to be evaluated if the parent AgendaItemDefinition evaluates to FALSE. 125 * <p> If the position parameter is null, the new AgendaItemDefinition is linked as the next 126 * AgendaItemDefinition to be evaluated after any true or false branches of the tree have 127 * been traversed. 128 * @throws IllegalArgumentException if the AgendaItemDefinition is null 129 * @throws IllegalStateException if the parent AgendaItemDefinition does not already exists in the system 130 */ 131 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true) 132 public void addAgendaItem(AgendaItemDefinition agendaItem, String parentId, Boolean position); 133 134 /** 135 * Retrieves an AgendaItemDefinition from the repository based on the given agenda id. 136 * 137 * @param id the id of the AgendaItemDefinition to retrieve 138 * @return an {@link org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition} identified by the given id. 139 * A null reference is returned if an invalid or non-existent id is supplied. 140 */ 141 @Cacheable(value= AgendaItemDefinition.Cache.NAME, key="'id=' + #p0") 142 public AgendaItemDefinition getAgendaItemById(String id); 143 144 /** 145 * Converts a mutable bo to it's immutable counterpart 146 * @param bo the mutable business object 147 * @return the immutable object 148 */ 149 public AgendaDefinition to(AgendaBo bo); 150 151 /** 152 * Converts a immutable object to it's mutable bo counterpart 153 * @param im immutable object 154 * @return the mutable bo 155 */ 156 public AgendaBo from(AgendaDefinition im); 157}