1 /**
2 * Copyright 2010 The Kuali Foundation Licensed under the
3 * Educational Community License, Version 2.0 (the "License"); you may
4 * not use this file except in compliance with the License. You may
5 * obtain a copy of the License at
6 *
7 * http://www.osedu.org/licenses/ECL-2.0
8 *
9 * Unless required by applicable law or agreed to in writing,
10 * software distributed under the License is distributed on an "AS IS"
11 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12 * or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 package org.kuali.student.common.ui.server.applicationstate.dao;
17
18 import java.util.Collection;
19 import java.util.List;
20
21 import org.kuali.student.common.ui.server.applicationstate.entity.ApplicationState;
22 import org.kuali.student.r1.common.dao.CrudDao;
23 import org.kuali.student.r1.common.dao.SearchableDao;
24 import org.kuali.student.r2.common.exceptions.AlreadyExistsException;
25 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
26
27 /**
28 * This data access interface stores the GUI (page, section, widget, etc.)
29 * application states as key value pairs in a database.
30 */
31 public interface ApplicationStateDao extends CrudDao, SearchableDao {
32
33 /**
34 * Gets a list of application states by
35 * <code>applicationId</code>, <code>referenceKey</code>,
36 * <code>referenceType</code> and <code>userId</code>.
37 *
38 * @param applicationId Application id
39 * @param referenceKey Reference key
40 * @param referenceType Reference type
41 * @param userId User id
42 * @return An application state
43 * @throws DoesNotExistException Thrown if application state does not exist
44 */
45 public ApplicationState getApplicationState(String applicationId, String referenceKey, String referenceType, String userId) throws DoesNotExistException;
46
47 /**
48 * Gets a list of application states by
49 * <code>applicationId</code>, <code>referenceKey</code> and
50 * <code>referenceType</code>.
51 *
52 * @param applicationId Application id
53 * @param referenceKey Reference key
54 * @param referenceType Reference type
55 * @return A list of application states
56 * @throws DoesNotExistException Thrown if application state does not exist
57 */
58 public ApplicationState getApplicationState(String applicationId, String referenceKey, String referenceType) throws DoesNotExistException;
59
60 /**
61 * Creates and returns an application state.
62 *
63 * @param appState Application state
64 * @return A new application state
65 * @throws AlreadyExistsException Thrown if application state already exists
66 */
67 public ApplicationState createApplicationState(ApplicationState appState)
68 throws AlreadyExistsException;
69
70 /**
71 * Creates a collection of application states and returns their ids.
72 *
73 * @param appStateList collection of application states
74 * @return A list of newly created application state ids
75 * @throws AlreadyExistsException Thrown if application state already exists
76 */
77 public List<String> createApplicationState(Collection<ApplicationState> appStates)
78 throws AlreadyExistsException;
79 }