// public method to find child information public void FindChildInformation(String tsn, String[] arguments, AdditionalFunctions func) { WritableSheet sheet2 = copy.getSheet(1); Label label = null; String children[] = null; String temp = "", current_tsn = "", dateCreated = ""; int dateCheck = 1; temp = "SELECT distinct tsn from Tree where parent_tsn='" + tsn + "'"; try { result = statement.executeQuery(temp); metadata = result.getMetaData(); int numberOfRows = 0; if (result.last()) numberOfRows = result.getRow(); if (numberOfRows > 0 && metadata.getColumnCount() > 0) { result.first(); children = new String[numberOfRows]; for (int j = 0; j < numberOfRows; j++) { children[j] = result.getString(1); result.next(); } } for (int j = 0; j < numberOfRows; j++) { int current_tsnId = Integer.parseInt(children[j]); if (current_tsnId >= 999000000) { temp = "SELECT distinct Tree.tsn,unit_name1,unit_name2,unit_name3,unit_name4,scientificName,`usage`," + "taxon_author,parent_tsn,rank_name, pages, publicationId, userId, dateCreated, nameType FROM Tree," + " BaseObject, TaxonConcepts, TaxonAuthors,TaxonUnitTypes" + " WHERE Tree.tsn=TaxonConcepts.tsn AND Tree.tsn='" + current_tsnId + "' AND " + "BaseObject.id=TaxonConcepts.id AND TaxonAuthors.taxon_author_id=Tree.taxon_author_id AND " + "Tree.rank_id=TaxonUnitTypes.rank_id"; System.out.println(temp); result = statement.executeQuery(temp); metadata = result.getMetaData(); int RowNumber = 0; if (result.last()) RowNumber = result.getRow(); if (RowNumber > 0 && metadata.getColumnCount() > 0) { current_tsn = result.getString(1); dateCreated = result.getString(14); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Date d1 = df.parse(dateCreated); Date d2 = null; if (date_from.compareTo("all") != 0) { d2 = df.parse(date_from); if (d2.before(d1) || d2.equals(d1)) dateCheck = 1; else dateCheck = 0; } if (date_to.compareTo("today") != 0) { d2 = df.parse(date_to); if (d1.before(d2) || d1.equals(d2)) dateCheck = 1; else dateCheck = 0; } if (result.getString(7).compareTo("public") == 0 && result.getString(15).compareTo("Regular scientific name") == 0 && result.getString(12).compareTo("") != 0 && dateCheck == 1) { String scientificName = result.getString(6); String taxon_author = result.getString(8); String publicationId = result.getString(12); for (int k = 0; k < 4; k++) { if (result.getString(k + 2).compareTo("null") != 0) { label = new Label(k, row + 1, result.getString(k + 2)); sheet2.addCell(label); } } label = new Label(4, row + 1, taxon_author); sheet2.addCell(label); label = new Label(5, row + 1, result.getString(10)); sheet2.addCell(label); String parent_tsn = result.getString(9); String userId = result.getString(13); WritePublication(publicationId, row + 1); label = new Label(18, row + 1, func.GetSubmitter(userId)); sheet2.addCell(label); label = new Label(6, row + 1, func.GetParent(parent_tsn)); sheet2.addCell(label); row = row + 1; } } } continue; } for (int j = 0; j < numberOfRows; j++) { if (HasChildren(children[j]) == true) FindChildInformation(children[j], arguments, func); else continue; } } catch (Exception e) { e.printStackTrace(); System.exit(1); } } // end of FindChildInformation