use of org.isotc211.x2005.gmd.EXExtentPropertyType in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeEXExtent.
private XmlObject encodeEXExtent(EXExtent exExtent, EncodingContext context) throws EncodingException {
EXExtentType exet = EXExtentType.Factory.newInstance();
if (exExtent.hasDescription()) {
exet.addNewDescription().setCharacterString(exExtent.getDescription());
}
if (exExtent.hasVerticalExtent()) {
for (Referenceable<EXVerticalExtent> verticalExtent : exExtent.getExVerticalExtent()) {
EXVerticalExtentPropertyType exvept = exet.addNewVerticalElement();
if (verticalExtent.isReference()) {
Reference reference = verticalExtent.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(exvept::setActuate);
reference.getArcrole().ifPresent(exvept::setArcrole);
reference.getHref().map(URI::toString).ifPresent(exvept::setHref);
reference.getRole().ifPresent(exvept::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(exvept::setShow);
reference.getTitle().ifPresent(exvept::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(exvept::setType);
} else {
if (verticalExtent.isInstance()) {
Nillable<EXVerticalExtent> nillable = verticalExtent.getInstance();
if (nillable.isPresent()) {
XmlObject xml = encodeEXVerticalExtent(nillable.get(), EncodingContext.empty());
if (xml != null && xml instanceof EXVerticalExtentType) {
exvept.setEXVerticalExtent((EXVerticalExtentType) xml);
} else {
exvept.setNil();
exvept.setNilReason(Nillable.missing().get());
}
} else {
exvept.setNil();
if (nillable.hasReason()) {
exvept.setNilReason(nillable.getNilReason().get());
} else {
exvept.setNilReason(Nillable.missing().get());
}
}
}
}
}
}
if (context.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
EXExtentPropertyType exept = EXExtentPropertyType.Factory.newInstance(getXmlOptions());
exept.setEXExtent(exet);
return exept;
} else if (context.has(XmlBeansEncodingFlags.DOCUMENT)) {
EXExtentDocument exed = EXExtentDocument.Factory.newInstance(getXmlOptions());
exed.setEXExtent(exet);
return exed;
}
return exet;
}
Aggregations