1 | /* |
---|
2 | * Copyright (C) 2013 DASISH |
---|
3 | * |
---|
4 | * This program is free software; you can redistribute it and/or |
---|
5 | * modify it under the terms of the GNU General Public License |
---|
6 | * as published by the Free Software Foundation; either version 2 |
---|
7 | * of the License, or (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
17 | */ |
---|
18 | package eu.dasish.annotation.backend.dao; |
---|
19 | |
---|
20 | |
---|
21 | import eu.dasish.annotation.schema.Permission; |
---|
22 | import eu.dasish.annotation.schema.Notebook; |
---|
23 | import eu.dasish.annotation.schema.NotebookInfo; |
---|
24 | import java.util.List; |
---|
25 | import java.util.UUID; |
---|
26 | |
---|
27 | /** |
---|
28 | * Created on : Jun 12, 2013, 1:40:09 PM |
---|
29 | * |
---|
30 | * @author Peter Withers <peter.withers@mpi.nl> |
---|
31 | */ |
---|
32 | |
---|
33 | // TODO: not yet fully updated. |
---|
34 | |
---|
35 | public interface NotebookDao extends ResourceDao { |
---|
36 | |
---|
37 | |
---|
38 | /** |
---|
39 | * |
---|
40 | * GETTERS |
---|
41 | * |
---|
42 | **/ |
---|
43 | |
---|
44 | Number getOwner(Number notebookID); |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | List<Number> getNotebookIDs(Number principalID, Permission acessMode); |
---|
49 | |
---|
50 | // Returns a list of notebook Ids for the notebooks for which the given user "userID" is the owner. |
---|
51 | List<Number> getNotebookIDsOwnedBy(Number principaID); |
---|
52 | |
---|
53 | public List<Number> getPrincipalIDsWithPermission(Number notebookID, Permission permission); |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | |
---|
58 | /** |
---|
59 | * |
---|
60 | * @param notebookID |
---|
61 | * @return the notebook info for the notebook with notebookID |
---|
62 | */ |
---|
63 | NotebookInfo getNotebookInfoWithoutOwner(Number notebookID); |
---|
64 | |
---|
65 | |
---|
66 | /** |
---|
67 | * |
---|
68 | * @param notebookID |
---|
69 | * @return notebook metadata for the notebook with notebookID |
---|
70 | */ |
---|
71 | Notebook getNotebookWithoutAnnotationsAndPermissionsAndOwner(Number notebookID); |
---|
72 | |
---|
73 | |
---|
74 | List<Number> getAnnotations(Number notebookID); |
---|
75 | |
---|
76 | /** |
---|
77 | * |
---|
78 | * UPDATERS |
---|
79 | * |
---|
80 | * |
---|
81 | */ |
---|
82 | |
---|
83 | |
---|
84 | |
---|
85 | /** |
---|
86 | * |
---|
87 | * @param notebookID |
---|
88 | * @return true if updated, false otherwise. Logs the reason if the notebook is not updated. |
---|
89 | */ |
---|
90 | boolean updateNotebookMetadata(Number notebookID, String title, Number ownerID); |
---|
91 | |
---|
92 | boolean setOwner(Number notebookID, Number ownerID); |
---|
93 | |
---|
94 | boolean updateUserPermissionForNotebook(Number notebookID, Number principalID, Permission permission); |
---|
95 | |
---|
96 | /** |
---|
97 | * |
---|
98 | * ADDERS |
---|
99 | * |
---|
100 | * |
---|
101 | */ |
---|
102 | |
---|
103 | public Number createNotebookWithoutPermissionsAndAnnotations(Notebook notebook, Number ownerID); |
---|
104 | |
---|
105 | boolean addAnnotationToNotebook(Number notebookID, Number annotationID); |
---|
106 | |
---|
107 | boolean addPermissionToNotebook(Number notebookID, Number userID, Permission permission); |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | /** |
---|
112 | * |
---|
113 | * DELETERS |
---|
114 | * |
---|
115 | * |
---|
116 | */ |
---|
117 | |
---|
118 | boolean deleteAnnotationFromNotebook(Number notebookID, Number annotationID); |
---|
119 | |
---|
120 | boolean deleteAllAnnotationsFromNotebook(Number notebookID); |
---|
121 | |
---|
122 | boolean deleteNotebookPrincipalPermission(Number notebookID, Number principalID); |
---|
123 | |
---|
124 | boolean deleteAllPermissionsForNotebook(Number notebookID); |
---|
125 | |
---|
126 | boolean deleteNotebook(Number notebookID); |
---|
127 | } |
---|