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.schema.Target; |
---|
21 | import eu.dasish.annotation.schema.TargetInfo; |
---|
22 | import java.sql.SQLException; |
---|
23 | import java.util.List; |
---|
24 | import java.util.Map; |
---|
25 | |
---|
26 | /** |
---|
27 | * |
---|
28 | * @author olhsha |
---|
29 | */ |
---|
30 | public interface TargetDao extends ResourceDao { |
---|
31 | |
---|
32 | /** |
---|
33 | * GETTERS |
---|
34 | * |
---|
35 | */ |
---|
36 | /** |
---|
37 | * |
---|
38 | * @param inernalID |
---|
39 | * @return the Target with the intrenal Id "internalID". |
---|
40 | */ |
---|
41 | public Target getTarget(Number internalID); |
---|
42 | |
---|
43 | /** |
---|
44 | * |
---|
45 | * @param targets |
---|
46 | * @return the list of TargetInfo objects corresponding to the Targets with |
---|
47 | * the internalIds from the list "Targets". |
---|
48 | */ |
---|
49 | public List<TargetInfo> getTargetInfos(List<Number> targets); |
---|
50 | |
---|
51 | /** |
---|
52 | * |
---|
53 | * @param targetID |
---|
54 | * @return the list of pairs (cached_representation_id, fragment_descriptor) |
---|
55 | * for the target with the internal ID "targetID". |
---|
56 | */ |
---|
57 | public Map<Number, String> getCachedRepresentationFragmentPairs(Number targetID); |
---|
58 | |
---|
59 | /** |
---|
60 | * |
---|
61 | * @param subword |
---|
62 | * @return the list of Target ID's which link-fields contain "subword" as a |
---|
63 | * substring. |
---|
64 | */ |
---|
65 | public List<Number> getTargetsReferringTo(String subword); |
---|
66 | |
---|
67 | /** |
---|
68 | * |
---|
69 | * @param targetID |
---|
70 | * @return The link (uri) to the source to which the target refers |
---|
71 | */ |
---|
72 | public String getLink(Number targetID); |
---|
73 | |
---|
74 | /** |
---|
75 | * |
---|
76 | * @param link |
---|
77 | * @return the list of Target ID's which link-fields is exactly "link" |
---|
78 | */ |
---|
79 | public List<Number> getTargetsForLink(String link); |
---|
80 | |
---|
81 | boolean cachedIsInUse(Number cachedID); |
---|
82 | |
---|
83 | public List<Number> retrieveTargetIDs(Number annotationID); |
---|
84 | |
---|
85 | /** |
---|
86 | * ADDERS |
---|
87 | * |
---|
88 | */ |
---|
89 | /** |
---|
90 | * |
---|
91 | * @param target: the Target-object of the Target to be added to "Target" |
---|
92 | * table. |
---|
93 | * @return the internal ID of the just added Target or null if it has not |
---|
94 | * been added. |
---|
95 | */ |
---|
96 | public Number addTarget(Target target); |
---|
97 | |
---|
98 | /** |
---|
99 | * |
---|
100 | * @param TargetID |
---|
101 | * @param cachedID |
---|
102 | * @return # added rows to the table "Targets_cached_representations". |
---|
103 | * Should be "1" if the pair (TargetID, cachedID) has been added. |
---|
104 | * @throws SQLException |
---|
105 | */ |
---|
106 | public int addTargetCachedRepresentation(Number TargetID, Number cachedID, String fragmentDescription); |
---|
107 | |
---|
108 | /** |
---|
109 | * DELETERS |
---|
110 | * |
---|
111 | */ |
---|
112 | /** |
---|
113 | * |
---|
114 | * @param internalId |
---|
115 | * @return # deleted rows in "Target" table. Should be "1" if the Target has |
---|
116 | * been deleted. |
---|
117 | */ |
---|
118 | public int deleteTarget(Number internalID); |
---|
119 | |
---|
120 | /** |
---|
121 | * |
---|
122 | * @param TargetID |
---|
123 | * @return # deleted rows in the table "Targets_cached_representation" when |
---|
124 | * deleting the pair (TargetID, chachedID) |
---|
125 | * @throws SQLException |
---|
126 | */ |
---|
127 | public int deleteTargetCachedRepresentation(Number TargetID, Number chachedID); |
---|
128 | } |
---|