Changeset 5989
- Timestamp:
- 02/17/15 17:38:30 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/AnnotationDao.java
r5838 r5989 41 41 */ 42 42 43 /** 44 * 45 * @param headline the headline of an annotation. 46 * @return the list of uuid-s of the annotations with this headline; may be empty. 47 */ 43 48 public List<UUID> getExternalIdFromHeadline(String headline); 44 49 50 /** 51 * 52 * @param headline the headline of an annotation. 53 * @return the list of internal (database) identifiers of the annotations with this headline; may be empty. 54 */ 45 55 public List<Number> getInternalIDsFromHeadline(String headline); 46 56 /** 47 57 * 48 * @param annotationID 49 * @return the pair (annotation, owner_id) with empty list of Targets. 50 * 51 * (Constructing a complete Annotation object using "getAnnotationWithoutTargets" and "retrieveTargetIDs" is done in "DaoDispatchter".) 52 * 58 * @param annotationID the internal (database) identifier of an annotation. 59 * @return the {@link Annotation} object whose fields are filled in partially, 60 * only with the information accessible from the table "annotation". 61 * Constructing a complete {@link Annotation} object is done in the implementation of {@link DBDispatchter}.) 53 62 */ 54 63 public Annotation getAnnotationWithoutTargetsAndPemissionList(Number annotationID); 55 64 56 65 /** 66 * 67 * @param ownerID the owner of annotations we search for; if null then the owner may be any. 68 * @param text the text fragment which must occur in an annotation-body; if null, the now requirements on the annotation body. 69 * @param namespace (search on the parameter is not implemented). 70 * @param after the earliest time of creating/last-update of annotations; if null then search "from the beginning of time". 71 * @param before the latest time of creating/last-update of annotations; if null then search "till now". 72 * @return 73 */ 57 74 public List<Number> getFilteredAnnotationIDs(Number ownerID, String text, String namespace, String after, String before); 58 75 76 /** 77 * 78 * @param principalID the internal database ID of a principal (user or, in general, a group). 79 * @param acess access level (none, read, write, all). 80 * @return the list of internal (database) annotation identifiers to which "principalID" has access at least "acess". 81 * For instance, on access==write, the method should output id-s of the annotations to which user has "write" (update bodies), 82 * or "all" access, according to the junction table "annotations-principals-acesses". 83 */ 84 public List<Number> getAnnotationIDsPermissionAtLeast(Number principalID, Access acess); 85 86 /** 87 * 88 * @param access the value of public assess of an annotation. 89 * @return The list of internal (database identifiers to which public has at least "access" access; 90 * for instance on "write" the method should output annotations 91 * whose "public" value is "write" or "all". 92 */ 93 public List<Number> getAnnotationIDsPublicAtLeast(Access access); 94 95 59 96 60 public List<Number> getAnnotationIDsPermissionAtLeast(Number principalID, Access acess); 61 62 63 public List<Number> getAnnotationIDsPublicAtLeast(Access access); 64 65 66 /* 67 * Use inly in the debugging mode to acces all the existing annotations. 97 /** 98 * 99 * @return the list of the internal (database) annotation IDs of all the annotations; 100 * used only by the developers and the admin in the debugging mode to access all the existing annotations. 68 101 */ 69 102 public List<Number> getAllAnnotationIDs(); 70 103 104 /** 105 * 106 * @param annotationIDs the list of internal annotationIDs. 107 * @param offset the offset parameter for SELECT SQL request. 108 * @param limit the limit parameter for SELECT SQL request. 109 * @param orderedBy criterion of ordering according to the SQL syntax (by some field). 110 * @param desc direction of ordering according to the SQL syntax. 111 * @return the SELECT response on the given parameters: i.e. the list of annotationID's starting from offset and to limit, 112 * if the database rows are ordered according to "orderedBy" and "desc". 113 */ 71 114 public List<Number> sublistOrderedAnnotationIDs(List<Number> annotationIDs, int offset, int limit, String orderedBy, String desc); 72 115 73 /** 74 * unit test is missing 116 /** 75 117 * @param annotationIDs 76 * @return annotationInfo for the annotation with the internal annotationID. 118 * @return annotationInfo for the annotation with the internal annotationID: 119 * i.e. the information which you can take only from the "annotation" table 120 * and not the junction tables connecting the annotations to permissions and targets. 77 121 * 78 122 */ … … 82 126 * 83 127 * @param annotationIDs 84 * @return list of reTarget references where an i-th reference is constructed from the external identifier of the annotation with the i-th internal identifier from the list. 128 * @return list of target references where the i-th reference is constructed from the external 129 * identifier of the annotation with the i-th internal identifier from the list. 85 130 */ 86 131 public List<String> getAnnotationREFs(List<Number> annotationIDs); 87 132 88 133 89 134 /** 135 * 136 * @param annotationID 137 * @return the internal database ID of the owner of the annotation. 138 */ 90 139 public Number getOwner(Number annotationID); 91 140 … … 94 143 * @param annotationID 95 144 * @param principalID 96 * @return access of the principalID w.r.t. annotationID, or null if the access is not given145 * @return access of the principalID w.r.t. annotationID, or Access.NONE if the access is not given. 97 146 */ 98 147 public Access getAccess(Number annotationID, Number principalID); 99 148 149 /** 150 * 151 * @param annotationID 152 * @param principalID 153 * @return true if there is triple (annotationID, principalID, access) for some access 154 * in the corresponding junction table; false otherwise. 155 */ 100 156 public boolean hasExplicitAccess(Number annotationID, Number principalID); 101 157 102 158 /** 159 * 160 * @param annotationID 161 * @return the value of the "public" field for annotationID; can be one of ACCESS values. 162 */ 103 163 public Access getPublicAttribute(Number annotationID); 104 164 105 165 106 166 /** 167 * 168 * @param notebookID 169 * @return the list of annotationIDs of the annotations from the notebook with notebookID. 170 */ 107 171 public List<Number> getAnnotations(Number notebookID); 108 172 109 173 /** 174 * 175 * @param targetID 176 * @return true if at least one annotation refers to this target; false otherwise. 177 */ 110 178 public boolean targetIsInUse(Number targetID); 111 /** 112 * 113 * @param annotationID 114 * @return true if "annotationID" is mentioned in at least one of the joint tables: 115 * "annotations_targets", "annotations_principals_accesss", "notebook_annotations". 116 * Otherwise return "false". 117 */ 118 //public boolean annotationIsInUse(Number annotationID); 119 179 120 180 /** 121 181 * ADDERS … … 126 186 * @param annotationID 127 187 * @param targetID 128 * @return # updated rows in the joint table "annotations_target _Targets".129 * @throws SQLException130 * Connects the annotation to its target Target by adding the pair (annotationID, TargetID) to the jointtable.188 * @return # updated rows in the joint table "annotations_targets". 189 * Connects the annotation to its target by adding the pair (annotationID, targetID) 190 * to the junction table. 131 191 */ 132 192 public int addAnnotationTarget(Number annotationID, Number targetID); … … 138 198 * @param principalID 139 199 * @param access 140 * @return # rows added to the table "annotations_principals_access s"200 * @return # rows added to the table "annotations_principals_access". 141 201 * Sets the "access" for the "principalID" w.r.t. the annotation with "annotationID". 142 202 */ … … 144 204 145 205 146 147 /** 148 * 149 * @param annotation: the object to be added to the table "annotation". 150 * @return the internal ID of the added annotation, if it is added, or null otherwise. 151 **/ 152 206 207 /** 208 * 209 * @param annotationthe the object to be added to the table "annotation". 210 * @param newOwnerID the ownerID, 211 * @return the internal ID of the added annotation, if it is added, or throws NotInDataBaseException otherwise. 212 * @throws NotInDataBaseException if the request on the internal database annotation ID for the added annotation throws this exception. 213 */ 153 214 public Number addAnnotation(Annotation annotation, Number newOwnerID) throws NotInDataBaseException; 154 215 … … 156 217 /////// UPDATERS ////////////////// 157 218 158 219 /** 220 * 221 * @param annotationID the internal database ID of the annotation to be updated. 222 * @param text the new body text. 223 * @param mimeType the new mime type. 224 * @param isXml if the new body is a text body or an xml. 225 * @return # of updated rows in the table "annotation". 226 */ 159 227 public int updateAnnotationBody(Number annotationID, String text, String mimeType, Boolean isXml); 160 228 229 /** 230 * 231 * @param annotationID the internal database ID of the annotation to be updated. 232 * @param text the new headline. 233 * @return # of updated rows in the table "annotation". 234 */ 161 235 public int updateAnnotationHeadline(Number annotationID, String text); 162 236 … … 166 240 * 167 241 * @param annotation 168 * @return # of updated rows in "annotation" table after updating the annotation. Should return 1 if update happens 169 * @throws SQLException 242 * @return # of updated rows in "annotation" table after updating the annotation. Should return 1 if update happens. 243 */ 244 /** 245 * 246 * @param annotation the new annotation (including targets and permissions). 247 * @param annotationID the ID of the annotation to be updated. 248 * @param ownerID the Id of the new owner. 249 * @return # of updated rows in "annotation" table after this FULL updating the annotation. Should return 1 if update happens. 170 250 */ 171 251 public int updateAnnotation(Annotation annotation, Number annotationID, Number ownerID); … … 177 257 * @param principalID 178 258 * @param access 179 * @return # rows updated to the table "annotations_principals_access s"259 * @return # rows updated to the table "annotations_principals_access". 180 260 * Sets the "access" for the "principalID" w.r.t. the annotation with "annotationID". 181 261 */ 182 262 public int updatePermission(Number annotationID, Number principalID, Access access); 183 263 184 264 /** 265 * 266 * @param annotationID the internal database ID of the annotation to be updated. 267 * @param access access level. 268 * @return # of updated rows in "annotation". should be "1" if updated and "0" otherwise. 269 */ 185 270 public int updatePublicAccess(Number annotationID, Access access); 186 271 … … 212 297 * 213 298 * @param annotationID 214 * @return # removed rows in the table "annotations_principals_accesss". 215 * @throws SQLException 299 * @return # removed rows in the table "annotations_principals_access". 216 300 */ 217 301 public int deletePermissions(Number annotationID); 218 302 303 /** 304 * 305 * @param annotationID 306 * @param principalID 307 * @return # removed rows in the table "annotations_principals_access". 308 * Should be "1" is removed and "0" otherwise. 309 */ 219 310 public int deletePermission(Number annotationID, Number principalID); 220 311 312 /** 313 * 314 * @param annotationID 315 * @return # removed rows in the table "notebookds_annotations". 316 */ 221 317 public int deleteAnnotationFromAllNotebooks(Number annotationID); 222 318 … … 225 321 */ 226 322 323 /** 324 * 325 * @param annotationBody 326 * @return two string components of the annotationBody: the text/xml content and the mime type. 327 */ 227 328 public String[] retrieveBodyComponents(AnnotationBody annotationBody); 228 329
Note: See TracChangeset
for help on using the changeset viewer.