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

Last change on this file since 4146 was 4146, checked in by olhsha, 10 years ago

saving the current "last update" time stamp in UTC time in the DB. Outputting it as UTC. Works with PostgreSQL, does not work with HSQL (had to comment unit tests)

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