if (datasetIDs.size() > LIMIT_FOR_IN) c = DatasetMapper.buildDatasetsTree(null); else c = DatasetMapper.buildDatasetsTree(datasetIDs);
c = DatasetMapper.buildDatasetsTree(datasetIDs);
    public List retrieveDatasetsTree(List datasetIDs, boolean annotated)        throws DSOutOfServiceException, DSAccessException    {        Criteria c;        if (datasetIDs.size() > LIMIT_FOR_IN)             c = DatasetMapper.buildDatasetsTree(null);        else c = DatasetMapper.buildDatasetsTree(datasetIDs);        List datasets = (List) gateway.retrieveListData(Dataset.class, c);        List results = new ArrayList();        if (datasets == null || datasets.size() == 0) return results;        if (!annotated) {            DatasetMapper.fillDatasetsTree(datasets, results, datasetIDs);            return results;        }        //Retrieve the user ID.        UserCredentials uc = (UserCredentials)                            registry.lookup(LookupNames.USER_CREDENTIALS);        List ids = DatasetMapper.prepareListImagesID(datasets);        if (ids.size() > LIMIT_FOR_IN) ids = null;        c = AnnotationMapper.buildImageAnnotationCriteria(ids, uc.getUserID());        List isAnnotations =             (List) gateway.retrieveListSTSData("ImageAnnotation", c);        c = AnnotationMapper.buildDatasetAnnotationCriteria(datasetIDs,                 uc.getUserID());        List dsAnnotations =             (List) gateway.retrieveListSTSData("DatasetAnnotation", c);        DatasetMapper.fillDatasetsTree(datasets, results, datasetIDs,                 dsAnnotations, isAnnotations);        return results;    }