use of org.n52.shetland.w3c.xlink.Show in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseOnlineResource.
private OwsOnlineResource parseOnlineResource(OnlineResourceType onlineResource) {
if (onlineResource == null) {
return null;
}
URI href = Optional.ofNullable(onlineResource.getHref()).map(Strings::emptyToNull).map(URI::create).orElse(null);
URI role = Optional.ofNullable(onlineResource.getRole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
URI arcrole = Optional.ofNullable(onlineResource.getArcrole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
Show show = Optional.ofNullable(onlineResource.getShow()).map(Object::toString).map(Show::valueOf).orElse(null);
Actuate actuate = Optional.ofNullable(onlineResource.getActuate()).map(Object::toString).map(Actuate::valueOf).orElse(null);
String title = onlineResource.getTitle();
return new OwsOnlineResource(href, role, arcrole, title, show, actuate);
}
use of org.n52.shetland.w3c.xlink.Show in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseMetadata.
// private Set<OwsDomainMetadata> parseDomainMetadata(DomainMetadataType[]
// metadata) {
// return
// Optional.ofNullable(metadata).map(Arrays::stream).orElseGet(Stream::empty).map(this::parseDomainMetadata)
// .filter(Objects::nonNull).collect(toSet());
// }
private OwsMetadata parseMetadata(MetadataType metadata) {
if (metadata == null) {
return null;
}
URI href = Optional.ofNullable(metadata.getHref()).map(Strings::emptyToNull).map(URI::create).orElse(null);
URI role = Optional.ofNullable(metadata.getRole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
URI arcrole = Optional.ofNullable(metadata.getArcrole()).map(Strings::emptyToNull).map(URI::create).orElse(null);
Show show = Optional.ofNullable(metadata.getShow()).map(Object::toString).map(Show::valueOf).orElse(null);
Actuate actuate = Optional.ofNullable(metadata.getActuate()).map(Object::toString).map(Actuate::valueOf).orElse(null);
URI about = Optional.ofNullable(metadata.getAbout()).map(Strings::emptyToNull).map(URI::create).orElse(null);
String title = metadata.getTitle();
return new OwsMetadata(href, role, arcrole, title, show, actuate, about);
}
use of org.n52.shetland.w3c.xlink.Show 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;
}
use of org.n52.shetland.w3c.xlink.Show in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeOnlineResource.
private void encodeOnlineResource(CIOnlineResourcePropertyType ciorpt, Referenceable<CiOnlineResource> referenceable) {
if (referenceable.isReference()) {
Reference reference = referenceable.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(ciorpt::setActuate);
reference.getArcrole().ifPresent(ciorpt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(ciorpt::setHref);
reference.getRole().ifPresent(ciorpt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(ciorpt::setShow);
reference.getTitle().ifPresent(ciorpt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(ciorpt::setType);
} else {
if (referenceable.isInstance()) {
Nillable<CiOnlineResource> nillable = referenceable.getInstance();
if (nillable.isPresent()) {
CIOnlineResourceType ciort = ciorpt.addNewCIOnlineResource();
encodeOnlineResource(ciort, referenceable.getInstance().get());
} else {
if (nillable.hasReason()) {
ciorpt.setNilReason(nillable.getNilReason().get());
}
}
}
}
}
use of org.n52.shetland.w3c.xlink.Show in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeEXVerticalExtent.
private XmlObject encodeEXVerticalExtent(EXVerticalExtent exVerticalExtent, EncodingContext context) throws EncodingException {
EXVerticalExtentType exvet = EXVerticalExtentType.Factory.newInstance();
if (exVerticalExtent.isSetId()) {
exvet.setId(exVerticalExtent.getId());
}
if (exVerticalExtent.isSetUuid()) {
exvet.setUuid(exVerticalExtent.getUuid());
}
// min value
Nillable<Double> minNillable = exVerticalExtent.getMinimumValue();
RealPropertyType rptMinValue = exvet.addNewMinimumValue();
if (minNillable.isPresent()) {
rptMinValue.setReal(minNillable.get());
} else {
rptMinValue.setNil();
if (minNillable.hasReason()) {
rptMinValue.setNilReason(minNillable.getNilReason().get());
} else {
rptMinValue.setNilReason(Nillable.missing().get());
}
}
// max value
Nillable<Double> maxNillable = exVerticalExtent.getMaximumValue();
RealPropertyType rptMinMaxValue = exvet.addNewMaximumValue();
if (maxNillable.isPresent()) {
rptMinMaxValue.setReal(maxNillable.get());
} else {
rptMinMaxValue.setNil();
if (maxNillable.hasReason()) {
rptMinMaxValue.setNilReason(maxNillable.getNilReason().get());
} else {
rptMinMaxValue.setNilReason(Nillable.missing().get());
}
}
// verticalCRS
SCCRSPropertyType sccrspt = exvet.addNewVerticalCRS();
Referenceable<ScCRS> verticalCRS = exVerticalExtent.getVerticalCRS();
if (verticalCRS.isReference()) {
Reference reference = verticalCRS.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(sccrspt::setActuate);
reference.getArcrole().ifPresent(sccrspt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(sccrspt::setHref);
reference.getRole().ifPresent(sccrspt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(sccrspt::setShow);
reference.getTitle().ifPresent(sccrspt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(sccrspt::setType);
} else {
if (verticalCRS.isInstance()) {
Nillable<ScCRS> nillable = verticalCRS.getInstance();
if (nillable.isPresent()) {
XmlObject xml = encodeObjectToXml(GmlConstants.NS_GML_32, nillable.get().getAbstractCrs());
if (xml != null && xml instanceof AbstractCRSType) {
final XmlObject substituteElement = XmlHelper.substituteElement(sccrspt.addNewAbstractCRS(), xml);
substituteElement.set(xml);
} else {
sccrspt.setNil();
sccrspt.setNilReason(Nillable.missing().get());
}
} else {
sccrspt.setNil();
if (nillable.hasReason()) {
sccrspt.setNilReason(nillable.getNilReason().get());
} else {
sccrspt.setNilReason(Nillable.missing().get());
}
}
}
}
if (context.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
EXVerticalExtentPropertyType exvept = EXVerticalExtentPropertyType.Factory.newInstance(getXmlOptions());
exvept.setEXVerticalExtent(exvet);
return exvept;
} else if (context.has(XmlBeansEncodingFlags.DOCUMENT)) {
EXVerticalExtentDocument exved = EXVerticalExtentDocument.Factory.newInstance(getXmlOptions());
exved.setEXVerticalExtent(exvet);
return exved;
}
return exvet;
}
Aggregations