Changeset 6021
- Timestamp:
- 02/23/15 15:53:03 (9 years ago)
- Location:
- DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/DBDispatcher.java
r5998 r6021 359 359 * 360 360 * @param notebookID the internal database id of a notebook. 361 * @param startAnnotation the first index for the list (of annotations). 361 * @param startAnnotation the first index for the list (of annotations). min value is "1". 362 362 * @param maximumAnnotations the maximum # of annotations in the output list expected. 363 363 * @param orderedBy SQL "orderedBy" string value, must be one of the fields in the table "annotation". -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/DBDispatcherImlp.java
r5998 r6021 634 634 635 635 ///////////////////////////////////////////////////////////// 636 636 637 @Override 637 638 public ReferenceList getAnnotationsForNotebook(Number notebookID, int startAnnotation, int maximumAnnotations, String orderedBy, boolean desc) { 638 639 List<Number> annotationIDs = annotationDao.getAnnotations(notebookID); 639 640 640 if (startAnnotation < -1) {641 if (startAnnotation < 0) { 641 642 logger.info("Variable's startAnnotation value " + startAnnotation + " is invalid. I will return null."); 642 643 return null; … … 648 649 } 649 650 650 int offset = (startAnnotation > 0) ? startAnnotation - 1 : 0;651 int offset = startAnnotation - 1; 651 652 String direction = desc ? "DESC" : "ASC"; 652 653 List<Number> selectedAnnotIDs = annotationDao.sublistOrderedAnnotationIDs(annotationIDs, offset, maximumAnnotations, orderedBy, direction); -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/NotebookResource.java
r5385 r6021 59 59 } 60 60 61 // changed w.r.t.the spec, query parameter persmission is added 61 /** 62 * 63 * @param accessMode a string, representing an access mode: "none", "read", "write", "all". 64 * @return the {@link NotebookInfoList} element containing the list of {@link NotebookInfo} elements 65 * of all the notebooks to which the in-logged principal has "access" access. 66 * @throws IOException if sending the error fails. 67 */ 62 68 @GET 63 69 @Produces(MediaType.APPLICATION_XML) … … 77 83 } 78 84 85 /** 86 * 87 * @return the {@link ReferenceList} element containing the list of h-references of all the notebooks owned by the in-logged principal. 88 * @throws IOException if sending the error fails. 89 */ 79 90 @GET 80 91 @Produces(MediaType.APPLICATION_XML) … … 90 101 } 91 102 103 /** 104 * 105 * @param externalIdentifier the external UUID identifier of a notebook. 106 * @param accessMode the access mode on which principals must be filtered, 107 * can be "none", "read", "write", "all". 108 * @return a {@link ReferenceList} element representing the list of h-references of the 109 * principal that have access "accessMode" 110 * @throws IOException if sending the error fails. 111 */ 92 112 @GET 93 113 @Produces(MediaType.APPLICATION_XML) … … 115 135 } 116 136 } 117 // Notebook and NotebookInfo (metadata) schemata may be changed 118 // 1) we do not have information "private notebook" directly in the xml, but we have reads and writes in the schema 119 //so if both are empty then we see that it is private for the owner 120 // or shall we change the scheme? for notebooks 121 // 2) d we need to include the reference list of annotations in teh metadata of the notebook 137 138 /** 139 * 140 * @param externalIdentifier the external UUID identifier of a notebook. 141 * @return a {@link Notebook} element built up on the whole information 142 * ("notebook" table and the corresponding junction tables) for the notebook with "externalIdentifier". 143 * @throws IOException if sending the error fails. 144 */ 145 122 146 123 147 @GET … … 125 149 @Path("{notebookid: " + BackendConstants.regExpIdentifier + "}/metadata") 126 150 @Transactional(readOnly = true) 127 public JAXBElement<Notebook> getNotebook(@PathParam("notebookid") String externalIdentifier) throws IOException , HTTPException{151 public JAXBElement<Notebook> getNotebook(@PathParam("notebookid") String externalIdentifier) throws IOException{ 128 152 Number remotePrincipalID = this.getPrincipalID(); 129 153 if (remotePrincipalID == null) { … … 147 171 } 148 172 173 /** 174 * 175 * @param externalIdentifier the external UUID identifier of a notebook. 176 * @param maximumAnnotations the maximum amount of annotations from this notebook to output 177 * if the amount of annotations in the notebook is more than (startAnnotations-1) + maximumAnnotations, 178 * then exactly maximumAnnotations will be output, otherwise the amount of annotations of 179 * output is limited by "# of annotations in the notebook" - startAnnotation 180 * @param startAnnotations the index of the first annotation, min value is "1". 181 * @param orderBy the field in the table "notebook" on which annotations must be ordered. 182 * @param desc if true then the annotations in the list must be ordered in descending order, otherwise in ascending order. 183 * @return a {@link ReferenceList} element representing the list of (maximum) maximumAnnotations 184 * @throws IOException if sending the error fails. 185 */ 149 186 @GET 150 187 @Produces(MediaType.APPLICATION_XML) … … 155 192 @QueryParam("startAnnotation") int startAnnotations, 156 193 @QueryParam("orderBy") String orderBy, 157 @QueryParam("descending") boolean desc) throws IOException , HTTPException{194 @QueryParam("descending") boolean desc) throws IOException{ 158 195 159 196 Number remotePrincipalID = this.getPrincipalID(); … … 178 215 179 216 } 180 217 218 /** 219 * 220 * @param externalIdentifier the external UUID identifier of a notebook. 221 * @param notebookInfo the fresh {@link NotebookInfo} object. 222 * @return a {@link ResponseBody} element containing the just updated {@link Notebook} element 223 * and the list of actions, which are not yet specified for the notebooks. 224 * @throws IOException if sending the error fails. 225 */ 181 226 @PUT 182 227 @Consumes(MediaType.APPLICATION_XML) -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/ProjectInfoResource.java
r5690 r6021 42 42 @Path("version") 43 43 @Transactional(readOnly = true) 44 public String get Annotation() throws IOException {44 public String getVersion() throws IOException { 45 45 Number principalID = this.getPrincipalID(); 46 46 String retVal = "?.?"; -
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBDispatcherTest.java
r5850 r6021 1811 1811 }); 1812 1812 1813 ReferenceList result = dbDispatcher.getAnnotationsForNotebook(1, -1, 3, "last_modified", true);1813 ReferenceList result = dbDispatcher.getAnnotationsForNotebook(1, 1, 3, "last_modified", true); 1814 1814 assertEquals(2, result.getHref().size()); 1815 1815 assertEquals("/api/annotations/00000000-0000-0000-0000-000000000021", result.getHref().get(0).toString());
Note: See TracChangeset
for help on using the changeset viewer.