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

Last change on this file since 6042 was 6042, checked in by olhsha@mpi.nl, 9 years ago

Javadoc annotations are revised for "eu.daish.annotation.backend" and "eu.daish.annotation.backend.dao" packages.

File size: 3.4 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.NotInDataBaseException;
21import eu.dasish.annotation.schema.Access;
22import java.util.List;
23import java.util.Map;
24import java.util.UUID;
25
26/**
27 * This interface defines methods common for all dao's: Annotation, Target, Cached Representation, Principal, Notebook.
28 * An implementation must set a non-null value for the field "resourceTableName". It is one of the five names of resource tables:
29 * "annotation", "target", "cached_representation", "principal", "notebook".
30 * @author olhsha
31 */
32public interface ResourceDao {
33
34    /**
35     *
36     * @param relResourcePath a string, representing "[relative-servise-url]/[resource]", e.g. "my-servlet/annotations".
37     */
38    void setResourcePath(String relResourcePath);
39
40    /**
41     *
42     * @param externalId the external UUID of a resource.
43     * @return the internal ID of the resource.
44     * @throws NotInDataBaseException if the resource with this id is not found.
45     */
46    Number getInternalID(UUID externalId) throws NotInDataBaseException;
47
48    /**
49     *
50     * @param internalId the internal ID of the resource.
51     * @return  the external UUID of the resource.
52     */
53    UUID getExternalID(Number internalId);
54
55    /**
56     *
57     * @param oldIdentifier the current external UUID of a resource.
58     * @param newIdentifier the new external UUID of the resource.
59     * @return true iff the external id of the resource has been updated to the value of "newIdentifier".
60     */
61    boolean updateResourceIdentifier(UUID oldIdentifier, UUID newIdentifier);
62 
63    /**
64     *
65     * @param internalID the internal databaseID of the resource.
66     * @return the hyper-reference string of the resource with "internalID".
67     */
68    String getHrefFromInternalID(Number internalID);
69   
70    /**
71     *
72     * @param href the hyper-reference of a resource.
73     * @return  the internal ID of the resource with "href".
74     * @throws NotInDataBaseException if the resource with ""href" is not found in the corresponding database.
75     */
76    Number getInternalIDFromHref(String href)  throws NotInDataBaseException;
77
78    /**
79     *
80     * @param resourceID the internal database id of a resource.
81     * @return mapping "principal internal id" -> "access" for a given "resourceID";
82     * till now makes sense only for annotations and notebooks.
83     */
84    List<Map<Number, String>> getPermissions(Number resourceID);
85
86    /**
87     *
88     * @param resourceID the internal database id of a resource.
89     * @return the public access mode for "resourceID"; till now makes sense only for annotations and notebooks.
90     */
91    Access getPublicAttribute(Number resourceID);
92   
93   
94}
Note: See TracBrowser for help on using the repository browser.