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

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

refactored DAO-s and creating an annotation in rest. Still 2 failures and 3 errors.

File size: 2.8 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.SourceIdentifier;
21import eu.dasish.annotation.schema.NewOrExistingSourceInfo;
22import eu.dasish.annotation.schema.Source;
23import eu.dasish.annotation.schema.SourceInfo;
24import java.sql.SQLException;
25import java.util.List;
26import java.util.Map;
27
28/**
29 *
30 * @author olhsha
31 */
32public interface SourceDao extends ResourceDao{
33   
34     /**
35     *
36     * @param internalID
37     * @return extrnalID identifier of the resource with internalID
38     */
39    public SourceIdentifier getExternalID(Number internalID);
40   
41   
42   
43    /**
44     *
45     * @param inernalID
46     * @return the object containing the source with the intrenal Id "internalId"
47     */
48    public Source getSource(Number internalID);
49   
50   
51   
52    /**
53     *
54     * @param internalId
55     * removes the source with the ID "internalId" from the DB, if it is not a target source of some annotation
56     * @return the amount of affected rows in the "source" table
57     */
58    public int[] deleteSource(Number internalID);
59   
60    /**
61     *
62     * @param freshSource
63     * adds freshSource to the DB and assigns the fresh external Identifier to it
64     * @return the internal ID of the just added source
65     * return -1 id the source cannot be added because its version is not in the DB
66     */
67    public Number addSource(Source freshSource) throws SQLException;   
68   
69   
70     /**
71     *
72     * @param sourceID
73     * @return the list of the internal version id-s for the  target source with the internal Id "sourceID"
74     */
75    public List<Number> retrieveVersionList(Number sourceID);
76   
77 
78    public List<SourceInfo> getSourceInfos(List<Number> sources);
79   
80 
81    /**
82     *
83     * @param link
84     * @return the list source ID's which link-fields contain "link" as a substring
85     */ 
86    public List<Number> getSourcesForLink(String link);
87 
88   
89   
90   public Map<String, String> addTargetSourcesToAnnotation(Number annotationID, List<NewOrExistingSourceInfo> sources) throws SQLException;       
91   
92     
93}
Note: See TracBrowser for help on using the repository browser.