public ArrayList<String> queryStudyTypes(String userID, String dataName) { System.out.println("In function queryStudyTypes"); ArrayList<String> tempList = new ArrayList<String>(); try { // create first query to get the entire studyEntry block, the collection() XQuery function // does this across // all documents in the XML Collection // The goal of this query is to find all the data we need for the StudyEntry object based on // which user submitted them. For all the documents searched, the query looks to see // if any files for that subject's ECG repository were submitted by that user. If any files // were submitted, retrieve their metadata contained in the studyEntry block. System.out.println("queryDatatypes:"); String sQuery = studyBuilder.forStudyEntry() + studyBuilder.customNameBracket(dataName, EnumStudyTreeNode.DATATYPE) + studyBuilder.userDefinedWhere(userID) + studyBuilder.customOrderBySubjectID() + studyBuilder.returnTreeNodeDistinct(EnumStudyTreeNode.STUDY); System.out.println("Query to be executed = " + sQuery); ResourceSet resultSet = executeQuery(sQuery); ResourceIterator iter = resultSet.getIterator(); Resource selection = null; tempList = this.checkForDuplicates(iter, selection); for (String listing : tempList) { int i = 1; System.out.println("Entry " + i + " = " + listing); i++; } } catch (Exception ex) { System.out.println( "ExistMainDatabase.queryStudies(): AN EXCEPTION HAS BEEN CAUGHT! IF A LIST IS RETURNED, IT WILL BE EMPTY!!!"); ex.printStackTrace(); } return tempList; }