use of org.w3._2007.rif.If in project arctic-sea by 52North.
the class SpecimenEncoderv20 method addCurrentLocation.
private void addCurrentLocation(SFSpecimenType sfst, SfSpecimen specimen) {
if (specimen.isSetCurrentLocation()) {
if (!specimen.getCurrentLocation().getInstance().isPresent()) {
Reference reference = specimen.getCurrentLocation().getReference();
LocationPropertyType lpt = sfst.addNewCurrentLocation();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(lpt::setActuate);
reference.getArcrole().ifPresent(lpt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(lpt::setHref);
reference.getRole().ifPresent(lpt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(lpt::setShow);
reference.getTitle().ifPresent(lpt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(lpt::setType);
}
}
}
use of org.w3._2007.rif.If in project arctic-sea by 52North.
the class SpecimenEncoderv20 method addSamplingMethod.
private void addSamplingMethod(SFSpecimenType sfst, SfSpecimen specimen) {
if (specimen.isSetSamplingMethod()) {
if (!specimen.getSamplingMethod().getInstance().isPresent()) {
sfst.addNewSamplingMethod().setHref(specimen.getSamplingMethod().getReference().getHref().get().toString());
Reference reference = specimen.getCurrentLocation().getReference();
SFProcessPropertyType sfppt = sfst.addNewSamplingMethod();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(sfppt::setActuate);
reference.getArcrole().ifPresent(sfppt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(sfppt::setHref);
reference.getRole().ifPresent(sfppt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(sfppt::setShow);
reference.getTitle().ifPresent(sfppt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(sfppt::setType);
}
}
}
use of org.w3._2007.rif.If in project arctic-sea by 52North.
the class GmlEncoderv321 method createVerticalCRS.
private XmlObject createVerticalCRS(VerticalCRS verticalCRS, EncodingContext ctx) throws EncodingException {
VerticalCRSType vcrst = VerticalCRSType.Factory.newInstance();
addAbstractCRSValues(vcrst, verticalCRS);
// verticalCS
Referenceable<VerticalCS> verticalCS = verticalCRS.getVerticalCS();
VerticalCSPropertyType vcspt = vcrst.addNewVerticalCS();
if (verticalCS.isReference()) {
Reference reference = verticalCS.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(vcspt::setActuate);
reference.getArcrole().ifPresent(vcspt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(vcspt::setHref);
reference.getRole().ifPresent(vcspt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(vcspt::setShow);
reference.getTitle().ifPresent(vcspt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(vcspt::setType);
} else {
if (verticalCS.isInstance()) {
Nillable<VerticalCS> nillable = verticalCS.getInstance();
if (nillable.isPresent()) {
XmlObject xml = createVerticalCS(nillable.get(), EncodingContext.empty());
if (xml != null && xml instanceof VerticalCSType) {
vcspt.set((VerticalCSType) xml);
} else {
vcspt.setNil();
vcspt.setNilReason(Nillable.missing().get());
}
} else {
vcspt.setNil();
if (nillable.hasReason()) {
vcspt.setNilReason(nillable.getNilReason().get());
} else {
vcspt.setNilReason(Nillable.missing().get());
}
}
}
}
// verticalDatum
Referenceable<VerticalDatum> verticalDatum = verticalCRS.getVerticalDatum();
VerticalDatumPropertyType vdpt = vcrst.addNewVerticalDatum();
if (verticalDatum.isReference()) {
Reference reference = verticalDatum.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(vdpt::setActuate);
reference.getArcrole().ifPresent(vdpt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(vdpt::setHref);
reference.getRole().ifPresent(vdpt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(vdpt::setShow);
reference.getTitle().ifPresent(vdpt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(vdpt::setType);
} else {
if (verticalDatum.isInstance()) {
Nillable<VerticalDatum> nillable = verticalDatum.getInstance();
if (nillable.isPresent()) {
XmlObject xml = createVerticalDatum(nillable.get(), EncodingContext.empty());
if (xml != null && xml instanceof VerticalDatumType) {
vdpt.setVerticalDatum((VerticalDatumType) xml);
} else {
vdpt.setNil();
vdpt.setNilReason(Nillable.missing().get());
}
} else {
vdpt.setNil();
if (nillable.hasReason()) {
vdpt.setNilReason(nillable.getNilReason().get());
} else {
vdpt.setNilReason(Nillable.missing().get());
}
}
}
}
if (ctx.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
VerticalCRSPropertyType vcrspt = VerticalCRSPropertyType.Factory.newInstance();
vcrspt.setVerticalCRS(vcrst);
return vcrspt;
}
return vcrst;
}
use of org.w3._2007.rif.If in project arctic-sea by 52North.
the class GmlEncoderv321 method addAbstractDatumValues.
private void addAbstractDatumValues(AbstractDatumType adt, AbstractDatum abstractDatum, EncodingContext ctx) throws EncodingException {
addDefinitonValues(adt, abstractDatum);
if (abstractDatum.hasAnchorDefinition()) {
adt.setAnchorDefinition(createCodeType(abstractDatum.getAnchorDefinition()));
}
if (abstractDatum.hasDomainOfValidity()) {
net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity dov = adt.addNewDomainOfValidity();
Referenceable<DomainOfValidity> domainOfValidity = abstractDatum.getDomainOfValidity();
if (domainOfValidity.isReference()) {
Reference reference = domainOfValidity.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(dov::setActuate);
reference.getArcrole().ifPresent(dov::setArcrole);
reference.getHref().map(URI::toString).ifPresent(dov::setHref);
reference.getRole().ifPresent(dov::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(dov::setShow);
reference.getTitle().ifPresent(dov::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(dov::setType);
} else {
if (domainOfValidity.isInstance()) {
Nillable<DomainOfValidity> nillable = domainOfValidity.getInstance();
if (nillable.isPresent()) {
net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity xml = createDomainOfValidity(nillable.get(), EncodingContext.empty());
if (xml != null) {
dov.set(xml);
} else {
dov.setNil();
dov.setNilReason(Nillable.missing().get());
}
} else {
dov.setNil();
if (nillable.hasReason()) {
dov.setNilReason(nillable.getNilReason().get());
} else {
dov.setNilReason(Nillable.missing().get());
}
}
}
}
}
if (abstractDatum.hasRealizationEpoch()) {
adt.setRealizationEpoch(abstractDatum.getRealizationEpoch().toCalendar(Locale.ROOT));
}
abstractDatum.getScope().forEach(scope -> adt.addNewScope().setStringValue(scope));
}
use of org.w3._2007.rif.If in project arctic-sea by 52North.
the class GmlEncoderv321 method addAbstractCoordincateSystemValues.
private void addAbstractCoordincateSystemValues(AbstractCoordinateSystemType acst, AbstractCoordinateSystem abstractCoordinateSystem) throws EncodingException {
addDefinitonValues(acst, abstractCoordinateSystem);
acst.setAggregationType(AggregationType.Enum.forString(abstractCoordinateSystem.getAggregation().name()));
for (Referenceable<CoordinateSystemAxis> coordinateSystemAxis : abstractCoordinateSystem.getCoordinateSystemAxis()) {
CoordinateSystemAxisPropertyType csapt = acst.addNewAxis();
if (coordinateSystemAxis.isReference()) {
Reference reference = coordinateSystemAxis.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(csapt::setActuate);
reference.getArcrole().ifPresent(csapt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(csapt::setHref);
reference.getRole().ifPresent(csapt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(csapt::setShow);
reference.getTitle().ifPresent(csapt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(csapt::setType);
} else {
if (coordinateSystemAxis.isInstance()) {
Nillable<CoordinateSystemAxis> nillable = coordinateSystemAxis.getInstance();
if (nillable.isPresent()) {
XmlObject xml = createCoordinateSystemAxis(nillable.get(), EncodingContext.empty());
if (xml != null && xml instanceof CoordinateSystemAxisType) {
csapt.addNewCoordinateSystemAxis().set(xml);
} else {
csapt.setNil();
csapt.setNilReason(Nillable.missing().get());
}
} else {
csapt.setNil();
if (nillable.hasReason()) {
csapt.setNilReason(nillable.getNilReason().get());
} else {
csapt.setNilReason(Nillable.missing().get());
}
}
}
}
}
}
Aggregations