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 | import eu.dasish.annotation.backend.identifiers.VersionIdentifier; |
---|
21 | import eu.dasish.annotation.schema.Version; |
---|
22 | import java.util.List; |
---|
23 | |
---|
24 | /** |
---|
25 | * |
---|
26 | * @author olhsha |
---|
27 | */ |
---|
28 | public interface VersionDao { |
---|
29 | |
---|
30 | /** |
---|
31 | * |
---|
32 | * @param internalID |
---|
33 | * @return extrnalID identifier of the resource with internalID |
---|
34 | */ |
---|
35 | |
---|
36 | public VersionIdentifier getExternalID(Number internalID); |
---|
37 | |
---|
38 | |
---|
39 | /** |
---|
40 | * |
---|
41 | * @param internalID |
---|
42 | * @return the instance of Version.class where the version internal Id is "internalID" |
---|
43 | * |
---|
44 | */ |
---|
45 | public Version getVersion(Number internalID); |
---|
46 | |
---|
47 | /** |
---|
48 | * |
---|
49 | * @param sourceID |
---|
50 | * @return the list of the internal version id-s for the target source with the internal Id "sourceID" |
---|
51 | */ |
---|
52 | public List<Number> retrieveVersionList(Number sourceID); |
---|
53 | |
---|
54 | |
---|
55 | /** @param versionID |
---|
56 | * removes the row of "version" with the internal ID "internalID" if no references to this version from the tables "sources_versions" and "source" |
---|
57 | * @return the amount of removed rows |
---|
58 | */ |
---|
59 | |
---|
60 | public int deleteVersion(Number versionID); |
---|
61 | |
---|
62 | /** |
---|
63 | * |
---|
64 | * @param version |
---|
65 | * @return the copy of "version" with the new external Id set in "version" text field (for now) |
---|
66 | * |
---|
67 | */ |
---|
68 | public Version addVersion(Version version); |
---|
69 | |
---|
70 | /** |
---|
71 | * |
---|
72 | * @param versionID |
---|
73 | * @return removes the rows (versionID, some cached representation id) from the joint table "versions_cached_representations" |
---|
74 | */ |
---|
75 | public int deleteVersionCachedRepresentationRow(Number versionID); |
---|
76 | |
---|
77 | |
---|
78 | /** |
---|
79 | * |
---|
80 | * @param sourceID |
---|
81 | * @param cachedRepresentationID |
---|
82 | * @return |
---|
83 | * 1) the amount of rows affected by deleting cached representation "cachedRepresentationID" |
---|
84 | * from the table "versions_cached_representations", if the corresponding version is a sibling-version of the source surceID |
---|
85 | * 2) the amount of rows affected by SAFE removing cachedRepresentationID from cached_representation table, |
---|
86 | * if the first number>0 |
---|
87 | * |
---|
88 | * used to fulfill DELETE api/sources/<sid>/cached/<cid> |
---|
89 | */ |
---|
90 | public int[] deleteCachedRepresentationForSource(Number sourceID, Number cachedRepresentationID); |
---|
91 | } |
---|
92 | |
---|
93 | |
---|