Loading data-discovery/src/main/java/vlkb/output/XmlSerializer.java +39 −63 Original line number Diff line number Diff line Loading @@ -148,61 +148,46 @@ final class XmlSerializer out.write( "<VOTABLE version='1.1'>" ); out.write( "<DESCRIPTION> " + searchOutputData.versionString + " SUBSURVCOUNT: " + searchOutputData.subsurveyArr.length + " </DESCRIPTION>" ); " subsurvey count: " + searchOutputData.subsurveyArr.length + " </DESCRIPTION>" ); if((searchOutputData.subsurveyArr != null) && (searchOutputData.subsurveyArr.length > 0)) { Subsurvey[] subsurv = searchOutputData.subsurveyArr; // assumes ORDERED subsurveyArray: by surveyname List<StarTable> tableList = new ArrayList(); String prevSurveyname = searchOutputData.subsurveyArr[0].surveyname.trim(); for(Subsurvey subsurvey : searchOutputData.subsurveyArr) String prevSurveyname;// = subsurv[0].surveyname.trim(); int ix = 0; do { prevSurveyname = subsurv[ix].surveyname.trim(); if(prevSurveyname.equals(subsurvey.surveyname.trim())) do { StarTable table = makeSubsurveyTable( subsurvey ); StarTable table = makeSubsurveyTable( subsurv[ix] ); tableList.add(table); ix++; } else { out.write( "<RESOURCE>" ); out.write( "<DESCRIPTION> " + prevSurveyname + " </DESCRIPTION>" ); /* PLACEHOLDER FOR RESOURCE PARAM table.setParameter(new DescribedValue( new DefaultValueInfo("subsurveyCount",Integer.class, "Count of subsurveys with found datacube(s)" ), subsurveyArr.length ) ); table.setParameter(new DescribedValue( new DefaultValueInfo( "survey", String.class, "Survey name" ), subsurvey.surveyname ) ); */ while((ix < subsurv.length) && prevSurveyname.equals(subsurv[ix].surveyname.trim())); StarTable[] tables = tableList.toArray(new StarTable[0]); for ( int i = 0; i < tables.length; i++ ) { VOSerializer.makeSerializer( DataFormat.TABLEDATA, tables[i] ).writeInlineTableElement( out ); } writeResourceSurvey(out, prevSurveyname, tables); tableList.clear(); out.write( "</RESOURCE>" ); prevSurveyname = subsurvey.surveyname.trim(); StarTable table = makeSubsurveyTable( subsurvey ); tableList.add(table); } while(ix < subsurv.length); } out.write( "</VOTABLE>" ); out.flush(); } if(!tableList.isEmpty()) private static void writeResourceSurvey(BufferedWriter out, String description, StarTable[] tables) throws IOException { out.write( "<RESOURCE>" ); out.write( "<DESCRIPTION> " + prevSurveyname + " </DESCRIPTION>" ); out.write( "<DESCRIPTION> " + description + " </DESCRIPTION>" ); /* PLACEHOLDER FOR RESOURCE PARAM Loading @@ -217,23 +202,14 @@ final class XmlSerializer subsurvey.surveyname ) ); */ StarTable[] tables = tableList.toArray(new StarTable[0]); for ( int i = 0; i < tables.length; i++ ) { VOSerializer.makeSerializer( DataFormat.TABLEDATA, tables[i] ).writeInlineTableElement( out ); } tableList.clear(); out.write( "</RESOURCE>" ); } } out.write( "</VOTABLE>" ); out.flush(); } private static StarTable makeSubsurveyTable(Subsurvey subsurvey) Loading Loading
data-discovery/src/main/java/vlkb/output/XmlSerializer.java +39 −63 Original line number Diff line number Diff line Loading @@ -148,61 +148,46 @@ final class XmlSerializer out.write( "<VOTABLE version='1.1'>" ); out.write( "<DESCRIPTION> " + searchOutputData.versionString + " SUBSURVCOUNT: " + searchOutputData.subsurveyArr.length + " </DESCRIPTION>" ); " subsurvey count: " + searchOutputData.subsurveyArr.length + " </DESCRIPTION>" ); if((searchOutputData.subsurveyArr != null) && (searchOutputData.subsurveyArr.length > 0)) { Subsurvey[] subsurv = searchOutputData.subsurveyArr; // assumes ORDERED subsurveyArray: by surveyname List<StarTable> tableList = new ArrayList(); String prevSurveyname = searchOutputData.subsurveyArr[0].surveyname.trim(); for(Subsurvey subsurvey : searchOutputData.subsurveyArr) String prevSurveyname;// = subsurv[0].surveyname.trim(); int ix = 0; do { prevSurveyname = subsurv[ix].surveyname.trim(); if(prevSurveyname.equals(subsurvey.surveyname.trim())) do { StarTable table = makeSubsurveyTable( subsurvey ); StarTable table = makeSubsurveyTable( subsurv[ix] ); tableList.add(table); ix++; } else { out.write( "<RESOURCE>" ); out.write( "<DESCRIPTION> " + prevSurveyname + " </DESCRIPTION>" ); /* PLACEHOLDER FOR RESOURCE PARAM table.setParameter(new DescribedValue( new DefaultValueInfo("subsurveyCount",Integer.class, "Count of subsurveys with found datacube(s)" ), subsurveyArr.length ) ); table.setParameter(new DescribedValue( new DefaultValueInfo( "survey", String.class, "Survey name" ), subsurvey.surveyname ) ); */ while((ix < subsurv.length) && prevSurveyname.equals(subsurv[ix].surveyname.trim())); StarTable[] tables = tableList.toArray(new StarTable[0]); for ( int i = 0; i < tables.length; i++ ) { VOSerializer.makeSerializer( DataFormat.TABLEDATA, tables[i] ).writeInlineTableElement( out ); } writeResourceSurvey(out, prevSurveyname, tables); tableList.clear(); out.write( "</RESOURCE>" ); prevSurveyname = subsurvey.surveyname.trim(); StarTable table = makeSubsurveyTable( subsurvey ); tableList.add(table); } while(ix < subsurv.length); } out.write( "</VOTABLE>" ); out.flush(); } if(!tableList.isEmpty()) private static void writeResourceSurvey(BufferedWriter out, String description, StarTable[] tables) throws IOException { out.write( "<RESOURCE>" ); out.write( "<DESCRIPTION> " + prevSurveyname + " </DESCRIPTION>" ); out.write( "<DESCRIPTION> " + description + " </DESCRIPTION>" ); /* PLACEHOLDER FOR RESOURCE PARAM Loading @@ -217,23 +202,14 @@ final class XmlSerializer subsurvey.surveyname ) ); */ StarTable[] tables = tableList.toArray(new StarTable[0]); for ( int i = 0; i < tables.length; i++ ) { VOSerializer.makeSerializer( DataFormat.TABLEDATA, tables[i] ).writeInlineTableElement( out ); } tableList.clear(); out.write( "</RESOURCE>" ); } } out.write( "</VOTABLE>" ); out.flush(); } private static StarTable makeSubsurveyTable(Subsurvey subsurvey) Loading