use of com.revolsys.record.io.format.gml.type.GmlFieldType in project com.revolsys.open by revolsys.
the class GmlRecordWriter method write.
@Override
public void write(final Record record) {
if (!this.opened) {
writeHeader();
}
this.out.startTag(Gml.FEATURE_MEMBER);
final RecordDefinition recordDefinition = record.getRecordDefinition();
QName qualifiedName = recordDefinition.getProperty(RecordProperties.QUALIFIED_NAME);
if (qualifiedName == null) {
final String typeName = recordDefinition.getPath();
final String path = PathUtil.getPath(typeName);
final String name = PathUtil.getName(typeName);
qualifiedName = new QName(path, name);
recordDefinition.setProperty(RecordProperties.QUALIFIED_NAME, qualifiedName);
}
this.out.startTag(qualifiedName);
for (final FieldDefinition fieldDefinition : recordDefinition.getFields()) {
final String fieldName = fieldDefinition.getName();
final Object value;
if (isWriteCodeValues()) {
value = record.getCodeValue(fieldName);
} else {
value = record.getValue(fieldName);
}
if (isValueWritable(value)) {
this.out.startTag(this.namespaceUri, fieldName);
final DataType dataType = fieldDefinition.getDataType();
final GmlFieldType fieldType = this.fieldTypes.getFieldType(dataType);
if (fieldType != null) {
fieldType.writeValue(this.out, value);
}
this.out.endTag();
}
}
this.out.endTag(qualifiedName);
this.out.endTag(Gml.FEATURE_MEMBER);
}
Aggregations