Changeset 3369


Ignore:
Timestamp:
08/13/13 12:31:23 (11 years ago)
Author:
olhsha
Message:

adding and testing the method which retrieves the list of annotations that refer to the sources from the input list.

Location:
DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/AnnotationDao.java

    r3367 r3369  
    105105    public List<ResourceREF> getAnnotationREFs(List<Number> annotationIDs);
    106106   
    107    
     107    /**
     108     *
     109     * @param sourceIDs
     110     * @return the list of annotationdIDs of the annotations that are having target sources from "sourceIDs" list
     111     */
    108112    public List<Number> getAnnotationIDsForSources(List<Number> sourceIDs);
    109113   
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDao.java

    r3367 r3369  
    8080            if (!annotationIDs.isEmpty()) {
    8181                String values = makeListOfValues(annotationIDs);
    82                 table = "( SELECT "+annotationStar + "WHERE "+ annotation_id +"IN " + values + ") ";
     82                table = "( SELECT DISTINCT "+annotationStar + "WHERE "+ annotation_id +"IN " + values + ") ";
    8383            }
    8484            else{
     
    133133        }       
    134134        String values = makeListOfValues(sourceIDs);
    135         StringBuilder query = new StringBuilder("SELECT ");
     135        StringBuilder query = new StringBuilder("SELECT DISTINCT ");
    136136        query.append(annotation_id).append(" FROM ").append(annotationsSourcesTableName).append(" WHERE ").append(source_id).append(" IN ");
    137137        query.append(values);
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/test/java/eu/dasish/annotation/backend/dao/impl/JdbcAnnotationDaoTest.java

    r3364 r3369  
    362362        assertEquals(expBody, result.getBody().getAny().get(0).toString());
    363363    }
    364 
    365     @Test
    366     @Ignore
     364   
     365   
     366    /**
     367     * testing public List<Number> getAnnotationIDsForSources(List<Number> sourceIDs);
     368   
     369    **/
     370    @Test   
     371    public void testGetAnnotationIDsForSources() {
     372        System.out.println("test getAnnotationIDs for sources");
     373        List<Number> sources = new ArrayList<Number>();
     374        sources.add(1);
     375        sources.add(2);
     376        List<Number> result = jdbcAnnotationDao.getAnnotationIDsForSources(sources);
     377        assertEquals (2, result.size());
     378        //assertEquals(2, result.get(0));
     379        //assertEquals(3, result.get(1));
     380    }
     381   
     382    @Test   
    367383    public void testGetExternalID() {
    368384        System.out.println("getAnnotationID");
Note: See TracChangeset for help on using the changeset viewer.