/** * Converts the column names to field names, using the metadata. * * @param columns a collection of column names * @param metadata The metadata * @return a collection of field names */ private Collection columnsToFields(Collection columns, DmqlParserMetadata metadata) { List fields = new ArrayList(); for (Iterator i = columns.iterator(); i.hasNext(); ) { String column = (String) i.next(); fields.add(metadata.columnToField(column)); } return fields; }
private void formatRow(SearchFormatterContext context) throws SQLException { PrintWriter out = context.getWriter(); DmqlParserMetadata metadata = context.getMetadata(); TagBuilder residentialProperty = new TagBuilder(out, "ResidentialProperty").beginContentOnNewLine(); TagBuilder listing = new TagBuilder(out, "Listing").beginContentOnNewLine(); new TagBuilder(out, "StreetAddress") .beginContentOnNewLine() .emptyTag("StreetNumber") .simpleTag("StreetName", context.getResultString("StreetName")) .simpleTag("PostalCode", context.getResultString("PostalCode")) .close(); listing.close(); TagBuilder livingArea = new TagBuilder(out, "LivingArea").beginContentOnNewLine(); TagBuilder area = new TagBuilder(out, "Area"); Table livingAreaTable = metadata.getTable("LivingArea"); String units = getUnits(livingAreaTable); if (units != null) { area.appendAttribute("Units", units); } area.beginContent().print(context.getResultString("LivingArea")).close(); livingArea.close(); residentialProperty.close(); }