1 /**
2 * Copyright 2005-2014 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.Set;
19
20 import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition;
21 import org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition;
22 import org.kuali.rice.krms.api.repository.agenda.AgendaTreeDefinition;
23 import org.kuali.rice.krms.api.repository.context.ContextDefinition;
24 import org.springframework.cache.annotation.CacheEvict;
25 import org.springframework.cache.annotation.Cacheable;
26
27 /**
28 * This is the interface for accessing KRMS repository Agenda related
29 * business objects.
30 *
31 * @author Kuali Rice Team (rice.collab@kuali.org)
32 *
33 */
34 public interface AgendaBoService {
35
36 /**
37 * This will create a {@link AgendaDefinition} exactly like the parameter passed in.
38 *
39 * @param agenda The Agenda to create
40 * @throws IllegalArgumentException if the Agenda is null
41 * @throws IllegalStateException if the Agenda already exists in the system
42 */
43 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
44 public AgendaDefinition createAgenda(AgendaDefinition agenda);
45
46 /**
47 * This will update an existing {@link AgendaDefinition}.
48 *
49 * @param agenda The Agenda to update
50 * @throws IllegalArgumentException if the Agenda is null
51 * @throws IllegalStateException if the Agenda does not exists in the system
52 */
53 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
54 public void updateAgenda(AgendaDefinition agenda);
55
56 /**
57 * Retrieves an Agenda from the repository based on the given agenda id.
58 *
59 * @param agendaId the id of the Agenda to retrieve
60 * @return an {@link AgendaDefinition} identified by the given agendaId.
61 * A null reference is returned if an invalid or non-existent id is supplied.
62 */
63 @Cacheable(value= AgendaDefinition.Cache.NAME, key="'agendaId=' + #p0")
64 public AgendaDefinition getAgendaByAgendaId(String agendaId);
65
66 /**
67 * Retrieves an Agenda from the repository based on the provided agenda name
68 * and context id.
69 *
70 * @param name the name of the Agenda to retrieve.
71 * @param contextId the id of the context that the agenda belongs to.
72 * @return an {@link AgendaDefinition} identified by the given name and namespace.
73 * A null reference is returned if an invalid or non-existent name and
74 * namespace combination is supplied.
75 */
76 @Cacheable(value= AgendaDefinition.Cache.NAME, key="'name=' + #p0 + '|' + 'contextId=' + #p1")
77 public AgendaDefinition getAgendaByNameAndContextId(String name, String contextId);
78
79 /**
80 * Retrieves a set of Agendas associated with a context.
81 *
82 * @param contextId the id of the context
83 * @return a set of {@link AgendaDefinition} associated with the given context.
84 * A null reference is returned if an invalid or contextId is supplied.
85 */
86 @Cacheable(value= AgendaDefinition.Cache.NAME, key="'contextId=' + #p0")
87 public Set<AgendaDefinition> getAgendasByContextId(String contextId);
88
89 /**
90 * This will create an {@link org.kuali.rice.krms.api.repository.agenda.AgendaItemDefinition} in the repository exactly like
91 * the parameter passed in.
92 *
93 * @param agendaItem The AgendaItemDefinition to create
94 * @throws IllegalArgumentException if the AgendaItemDefinition is null
95 * @throws IllegalStateException if the AgendaItemDefinition already exists in the system
96 */
97 @CacheEvict(value={AgendaTreeDefinition.Cache.NAME, AgendaDefinition.Cache.NAME, AgendaItemDefinition.Cache.NAME, ContextDefinition.Cache.NAME}, allEntries = true)
98 public AgendaItemDefinition createAgendaItem(AgendaItemDefinition agendaItem);
99
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 }