use of com.revolsys.record.io.format.xml.XmlWriter in project com.revolsys.open by revolsys.
the class BaseDoclet method setOptions.
protected void setOptions(final String[][] options) {
for (final String[] option : options) {
final String optionName = option[0];
if (optionName.equals("-d")) {
this.destDir = option[1];
} else if (optionName.equals("-doctitle")) {
this.docTitle = option[1];
} else if (optionName.equals("-customcssurl")) {
this.customCssUrls.add(option[1]);
}
}
try {
final File dir = new File(this.destDir);
final File indexFile = new File(dir, "index.html");
final FileWriter out = new FileWriter(indexFile);
this.writer = new XmlWriter(out, false);
this.writer.setIndent(false);
this.writer.setWriteNewLine(false);
DocletUtil.copyFiles(this.destDir);
} catch (final IOException e) {
throw new IllegalArgumentException(e.fillInStackTrace().getMessage(), e);
}
}
use of com.revolsys.record.io.format.xml.XmlWriter in project com.revolsys.open by revolsys.
the class OgrVrtWriter method write.
public static void write(final File file, final RecordDefinition recordDefinition, final String dataSource) throws IOException {
try (XmlWriter writer = new XmlWriter(new FileWriter(file))) {
writer.setIndent(true);
writer.startDocument("UTF-8", "1.0");
writer.startTag("OGRVRTDataSource");
writer.startTag("OGRVRTLayer");
final String typeName = recordDefinition.getName();
writer.attribute("name", typeName);
writer.startTag("SrcDataSource");
writer.attribute("relativeToVRT", "1");
writer.text(dataSource);
writer.endTag("SrcDataSource");
writer.element(new QName("SrcLayer"), typeName);
for (final FieldDefinition attribute : recordDefinition.getFields()) {
final String fieldName = attribute.getName();
final DataType fieldType = attribute.getDataType();
final Class<?> typeClass = attribute.getTypeClass();
if (Geometry.class.isAssignableFrom(typeClass)) {
final GeometryFactory geometryFactory = recordDefinition.getGeometryFactory();
writer.element("GeometryType", "wkb" + fieldType);
if (geometryFactory != null) {
writer.element("LayerSRS", "EPSG:" + geometryFactory.getCoordinateSystemId());
}
writer.startTag("GeometryField");
writer.attribute("encoding", "WKT");
writer.attribute("field", fieldName);
writer.attribute("name", fieldName);
writer.attribute("reportSrcColumn", "FALSE");
writer.element("GeometryType", "wkb" + fieldType);
if (geometryFactory != null) {
writer.element("SRS", "EPSG:" + geometryFactory.getCoordinateSystemId());
}
writer.endTag("GeometryField");
} else {
writer.startTag("Field");
writer.attribute("name", fieldName);
String type = "String";
if (Arrays.asList(DataTypes.BYTE, DataTypes.SHORT, DataTypes.INT, DataTypes.LONG, DataTypes.BIG_INTEGER).contains(fieldType)) {
type = "Integer";
} else if (Arrays.asList(DataTypes.FLOAT, DataTypes.DOUBLE, DataTypes.DECIMAL).contains(fieldType)) {
type = "Real";
} else if (DataTypes.DATE.equals(type)) {
type = "Date";
} else if (DataTypes.DATE_TIME.equals(type)) {
type = "DateTime";
} else {
type = "String";
}
writer.attribute("type", type);
final int length = attribute.getLength();
if (length > 0) {
writer.attribute("width", length);
}
final int scale = attribute.getScale();
if (scale > 0) {
writer.attribute("scale", scale);
}
writer.attribute("src", fieldName);
writer.endTag("Field");
}
}
writer.endTag("OGRVRTLayer");
writer.endTag("OGRVRTDataSource");
writer.endDocument();
}
}
use of com.revolsys.record.io.format.xml.XmlWriter in project com.revolsys.open by revolsys.
the class MenuViewController method bootstrapNavbar.
private void bootstrapNavbar(final HttpServletRequest request, final HttpServletResponse response, final Navbar navBar) throws IOException {
if (navBar != null) {
try (final OutputStream out = response.getOutputStream();
XmlWriter writer = new XmlWriter(out, false)) {
writer.setIndent(false);
final JexlHttpServletRequestContext jexlContext = new JexlHttpServletRequestContext(request);
final List<Menu> menus = new ArrayList<>();
for (final Menu menuItem : navBar.getMenus()) {
if (menuItem.isVisible()) {
menus.add(menuItem);
}
}
final String title = navBar.getTitle();
if (Property.hasValue(title) || !menus.isEmpty()) {
BootstrapUtil.navbarStart(writer, navBar, jexlContext);
bootstrapMenu(writer, menus, 1, jexlContext);
BootstrapUtil.navbarEnd(writer);
}
writer.flush();
}
}
}
use of com.revolsys.record.io.format.xml.XmlWriter in project com.revolsys.open by revolsys.
the class AbstractKeySerializer method toString.
@Override
public String toString(final Object object) {
final StringWriter out = new StringWriter();
final XmlWriter xmlOut = new XmlWriter(out);
serialize(xmlOut, object);
xmlOut.flush();
xmlOut.close();
return out.toString();
}
use of com.revolsys.record.io.format.xml.XmlWriter in project com.revolsys.open by revolsys.
the class PageInfoHttpMessageConverter method writeWadl.
private void writeWadl(final OutputStream out, final String url, final PageInfo pageInfo) {
final XmlWriter writer = new XmlWriter(out);
writer.startDocument("UTF-8", "1.0");
writer.startTag(APPLICATION);
writer.startTag(RESOURCES);
writeWadlResource(writer, url, pageInfo, true);
writer.endTag(RESOURCES);
writer.endTag(APPLICATION);
writer.endDocument();
writer.close();
}
Aggregations