1 /**
2 * Copyright 2005-2012 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.AgendaItem;
22
23 /**
24 * This is the interface for accessing KRMS repository Agenda related
25 * business objects.
26 *
27 * @author Kuali Rice Team (rice.collab@kuali.org)
28 *
29 */
30 public interface AgendaBoService {
31
32 /**
33 * This will create a {@link AgendaDefinition} exactly like the parameter passed in.
34 *
35 * @param agenda The Agenda to create
36 * @throws IllegalArgumentException if the Agenda is null
37 * @throws IllegalStateException if the Agenda already exists in the system
38 */
39 public AgendaDefinition createAgenda(AgendaDefinition agenda);
40
41 /**
42 * This will update an existing {@link AgendaDefinition}.
43 *
44 * @param agenda The Agenda to update
45 * @throws IllegalArgumentException if the Agenda is null
46 * @throws IllegalStateException if the Agenda does not exists in the system
47 */
48 public void updateAgenda(AgendaDefinition agenda);
49
50 /**
51 * Retrieves an Agenda from the repository based on the given agenda id.
52 *
53 * @param agendaId the id of the Agenda to retrieve
54 * @return an {@link AgendaDefinition} identified by the given agendaId.
55 * A null reference is returned if an invalid or non-existent id is supplied.
56 */
57 public AgendaDefinition getAgendaByAgendaId(String agendaId);
58
59 /**
60 * Retrieves an Agenda from the repository based on the provided agenda name
61 * and context id.
62 *
63 * @param name the name of the Agenda to retrieve.
64 * @param contextId the id of the context that the agenda belongs to.
65 * @return an {@link AgendaDefinition} identified by the given name and namespace.
66 * A null reference is returned if an invalid or non-existent name and
67 * namespace combination is supplied.
68 */
69 public AgendaDefinition getAgendaByNameAndContextId(String name, String contextId);
70
71 /**
72 * Retrieves a set of Agendas associated with a context.
73 *
74 * @param contextId the id of the context
75 * @return a set of {@link AgendaDefinition} associated with the given context.
76 * A null reference is returned if an invalid or contextId is supplied.
77 */
78 public Set<AgendaDefinition> getAgendasByContextId(String contextId);
79
80 /**
81 * This will create an {@link AgendaItem} in the repository exactly like
82 * the parameter passed in.
83 *
84 * @param agendaItem The AgendaItem to create
85 * @throws IllegalArgumentException if the AgendaItem is null
86 * @throws IllegalStateException if the AgendaItem already exists in the system
87 */
88 public AgendaItem createAgendaItem(AgendaItem agendaItem);
89
90 /**
91 * This will update an existing {@link AgendaItem}.
92 *
93 * @param agendaItem The AgendaItem to update
94 * @throws IllegalArgumentException if the AgendaItem is null
95 * @throws IllegalStateException if the AgendaItem does not exists in the system
96 */
97 public void updateAgendaItem(AgendaItem agendaItem);
98
99 /**
100 * This will create an {@link AgendaItem} in the repository exactly like
101 * the parameter passed in. The AgendaItem will be linked to an existing
102 * AgendaItem in the relationship provided. Linking the AgendaItems effectively
103 * builds a tree of AgendaItems that may be traversed by the engine.
104 *
105 * @param agendaItem The AgendaItem to create
106 * @param parentId The id of the existing AgendaItem to be linked with the
107 * newly created AgendaItem
108 * @param position. A boolean used to specify the relationship between the
109 * linked AgendaItems.
110 * <p> If the position parameter is true, the new AgendaItem is linked as the next
111 * AgendaItem to be evaluated if the parent AgendaItem evaluates to TRUE.
112 * <p> If the position parameter is false, the new AgendaItem is linked as the next
113 * AgendaItem to be evaluated if the parent AgendaItem evaluates to FALSE.
114 * <p> If the position parameter is null, the new AgendaItem is linked as the next
115 * AgendaItem to be evaluated after any true or false branches of the tree have
116 * been traversed.
117 * @throws IllegalArgumentException if the AgendaItem is null
118 * @throws IllegalStateException if the parent AgendaItem does not already exists in the system
119 */
120 public void addAgendaItem(AgendaItem agendaItem, String parentId, Boolean position);
121
122 /**
123 * Retrieves an AgendaItem from the repository based on the given agenda id.
124 *
125 * @param id the id of the AgendaItem to retrieve
126 * @return an {@link AgendaItem} identified by the given id.
127 * A null reference is returned if an invalid or non-existent id is supplied.
128 */
129 public AgendaItem getAgendaItemById(String id);
130
131 /**
132 * Converts a mutable bo to it's immutable counterpart
133 * @param bo the mutable business object
134 * @return the immutable object
135 */
136 public AgendaDefinition to(AgendaBo bo);
137
138 /**
139 * Converts a immutable object to it's mutable bo counterpart
140 * @param im immutable object
141 * @return the mutable bo
142 */
143 public AgendaBo from(AgendaDefinition im);
144 }