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.Source; |
---|
21 | import eu.dasish.annotation.schema.SourceInfo; |
---|
22 | import java.sql.SQLException; |
---|
23 | import java.util.List; |
---|
24 | |
---|
25 | /** |
---|
26 | * |
---|
27 | * @author olhsha |
---|
28 | */ |
---|
29 | public interface SourceDao extends ResourceDao{ |
---|
30 | |
---|
31 | |
---|
32 | |
---|
33 | /** |
---|
34 | * |
---|
35 | * @param inernalID |
---|
36 | * @return the object containing the source with the intrenal Id "internalId" |
---|
37 | */ |
---|
38 | public Source getSource(Number internalID); |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | /** |
---|
43 | * |
---|
44 | * @param internalId |
---|
45 | * @return # deleted rows in "source" table |
---|
46 | */ |
---|
47 | public int deleteSource(Number internalID); |
---|
48 | |
---|
49 | /** |
---|
50 | * |
---|
51 | * @param source |
---|
52 | * @param versionID |
---|
53 | * adds freshSource to the DB and assigns the fresh external Identifier to it |
---|
54 | * @return the internal ID of the just added source |
---|
55 | * return -1 id the source cannot be added because its version is not in the DB |
---|
56 | */ |
---|
57 | public Number addSource(Source source) throws SQLException; |
---|
58 | |
---|
59 | public int addSourceVersion(Number sourceID, Number versionID) throws SQLException; |
---|
60 | |
---|
61 | public int deleteAllSourceVersion(Number sourceID) throws SQLException; |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | /** |
---|
66 | * |
---|
67 | * @param sourceID |
---|
68 | * @return the list of the internal version id-s for the target source with the internal Id "sourceID" |
---|
69 | */ |
---|
70 | public List<Number> retrieveVersionList(Number sourceID); |
---|
71 | |
---|
72 | |
---|
73 | public List<SourceInfo> getSourceInfos(List<Number> sources); |
---|
74 | |
---|
75 | |
---|
76 | /** |
---|
77 | * |
---|
78 | * @param link |
---|
79 | * @return the list source ID's which link-fields contain "link" as a substring |
---|
80 | */ |
---|
81 | public List<Number> getSourcesForLink(String link); |
---|
82 | |
---|
83 | |
---|
84 | public boolean sourceIsInUse(Number sourceID); |
---|
85 | } |
---|