source: DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/NotebookDao.java @ 3218

Last change on this file since 3218 was 3218, checked in by olhsha, 11 years ago

handling permissions by adding and deleting an annotation: dao and REST. All is tested (annotation methods)

File size: 3.5 KB
Line 
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 */
18package eu.dasish.annotation.backend.dao;
19
20import eu.dasish.annotation.backend.identifiers.AnnotationIdentifier;
21import eu.dasish.annotation.backend.identifiers.NotebookIdentifier;
22import eu.dasish.annotation.backend.identifiers.UserIdentifier;
23import eu.dasish.annotation.schema.Annotations;
24import eu.dasish.annotation.schema.Notebook;
25import eu.dasish.annotation.schema.NotebookInfo;
26import eu.dasish.annotation.schema.ResourceREF;
27import java.util.List;
28
29/**
30 * Created on : Jun 12, 2013, 1:40:09 PM
31 *
32 * @author Peter Withers <peter.withers@mpi.nl>
33 */
34public interface NotebookDao extends ResourceDao {
35
36    // Returns a list of notebook-info for the notebooks accessible to the current user.
37    List<NotebookInfo> getNotebookInfos(UserIdentifier userID);
38
39    // Returns the list of all notebooks owned by the current logged user.
40    List<Notebook> getUsersNotebooks(UserIdentifier userID);
41
42    // Creates a new notebook and returns the _nid_ of the created Notebook
43    NotebookIdentifier addNotebook(UserIdentifier userID, String title);
44
45    // Delete _nid_. Annotations stay, they just lose connection to _nid_.<br>
46    // returns the number of records deleted
47    public int deleteNotebook(NotebookIdentifier notebookId);
48
49    // Adds an annotation _aid_ to the list of annotations of _nid_.
50    public int addAnnotation(NotebookIdentifier notebookId, AnnotationIdentifier annotationId);
51   
52     // Returns the list of annotation Id-s  for the notebook id.
53    List<Number> getAnnotationIDs(Number notebookID);
54   
55      /*Returns the list of annotation info-s  for the notebook id.
56    /List<AnnotationInfo> getAnnotationInfosOfNotebook(Number notebookID); */   
57   
58      // Returns the list of annotations Id-s  for the notebook id.
59    List<ResourceREF> getAnnotationREFsOfNotebook(Number notebookID);
60   
61    // Returns the Annotations object for the notebook id.
62    Annotations getAnnotations(Number notebookID);
63   
64    /**
65     *
66     * @param notebookID
67     * @return the Notebook information (title, owner (?), time_stamp(?), amount of annotations(?), their headlines (?) // TODO: discuss changing in the schema
68     * user in getting the metadata of a notebook
69     */
70    NotebookInfo getNotebookInfo(Number notebookID);
71   
72    /**
73     *
74     * @param externalId
75     * @return the notebook's internal ID, given its extrnalId
76     */
77    Number getNotebookID(NotebookIdentifier externalId);
78   
79     /**
80     * @param notebookId
81     * @return returns the externalIds of the annotations contained in the notebookId
82     */
83    List<AnnotationIdentifier> getAnnotationExternalIDs(NotebookIdentifier notebookId);
84   
85    /**
86     *
87     * @param annotationID
88     * @return removes the rows with annotationID from notebooks_annotations table
89     */
90    int removeAnnotation(Number annotationID);
91}
Note: See TracBrowser for help on using the repository browser.