Changeset 6021


Ignore:
Timestamp:
02/23/15 15:53:03 (9 years ago)
Author:
olhsha@mpi.nl
Message:

Javadocs are updated for NotebookResource? andProjectResourceInfo, + very minor correction for retrieval of annotations for notebooks.

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  
    359359     *
    360360     * @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".
    362362     * @param maximumAnnotations the maximum # of annotations in the output list expected.
    363363     * @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  
    634634
    635635    /////////////////////////////////////////////////////////////
     636 
    636637    @Override
    637638    public ReferenceList getAnnotationsForNotebook(Number notebookID, int startAnnotation, int maximumAnnotations, String orderedBy, boolean desc) {
    638639        List<Number> annotationIDs = annotationDao.getAnnotations(notebookID);
    639640
    640         if (startAnnotation < -1) {
     641        if (startAnnotation < 0) {
    641642            logger.info("Variable's startAnnotation value " + startAnnotation + " is invalid. I will return null.");
    642643            return null;
     
    648649        }
    649650
    650         int offset = (startAnnotation > 0) ? startAnnotation - 1 : 0;
     651        int offset = startAnnotation - 1;
    651652        String direction = desc ? "DESC" : "ASC";
    652653        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  
    5959    }
    6060
    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    */
    6268    @GET
    6369    @Produces(MediaType.APPLICATION_XML)
     
    7783    }
    7884
     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     */
    7990    @GET
    8091    @Produces(MediaType.APPLICATION_XML)
     
    90101    }
    91102
     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     */
    92112    @GET
    93113    @Produces(MediaType.APPLICATION_XML)
     
    115135        }
    116136    }
    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   
    122146
    123147    @GET
     
    125149    @Path("{notebookid: " + BackendConstants.regExpIdentifier + "}/metadata")
    126150    @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{
    128152        Number remotePrincipalID = this.getPrincipalID();
    129153        if (remotePrincipalID == null) {
     
    147171    }
    148172
     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     */
    149186    @GET
    150187    @Produces(MediaType.APPLICATION_XML)
     
    155192            @QueryParam("startAnnotation") int startAnnotations,
    156193            @QueryParam("orderBy") String orderBy,
    157             @QueryParam("descending") boolean desc) throws IOException, HTTPException {
     194            @QueryParam("descending") boolean desc) throws IOException{
    158195
    159196        Number remotePrincipalID = this.getPrincipalID();
     
    178215
    179216    }
    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     */
    181226    @PUT
    182227    @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  
    4242    @Path("version")
    4343    @Transactional(readOnly = true)
    44     public String getAnnotation() throws IOException {
     44    public String getVersion() throws IOException {
    4545        Number principalID = this.getPrincipalID();
    4646        String retVal = "?.?";
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/DBDispatcherTest.java

    r5850 r6021  
    18111811        });
    18121812
    1813         ReferenceList result = dbDispatcher.getAnnotationsForNotebook(1, -1, 3, "last_modified", true);
     1813        ReferenceList result = dbDispatcher.getAnnotationsForNotebook(1, 1, 3, "last_modified", true);
    18141814        assertEquals(2, result.getHref().size());
    18151815        assertEquals("/api/annotations/00000000-0000-0000-0000-000000000021", result.getHref().get(0).toString());
Note: See TracChangeset for help on using the changeset viewer.