use of org.n52.shetland.w3c.xlink.Referenceable in project arctic-sea by 52North.
the class AbstractWmlEncoderv20 method addRelatedParty.
private void addRelatedParty(MonitoringPointType mpt, List<Referenceable<CiResponsibleParty>> relatedParties) throws EncodingException {
for (Referenceable<CiResponsibleParty> relatedParty : relatedParties) {
CIResponsiblePartyPropertyType citppt = mpt.addNewRelatedParty();
if (relatedParty.isReference()) {
Reference reference = relatedParty.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(citppt::setActuate);
reference.getArcrole().ifPresent(citppt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(citppt::setHref);
reference.getRole().ifPresent(citppt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(citppt::setShow);
reference.getTitle().ifPresent(citppt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(citppt::setType);
} else {
if (relatedParty.isInstance()) {
Nillable<CiResponsibleParty> nillable = relatedParty.getInstance();
if (nillable.isPresent()) {
XmlObject xml = encodeObjectToXml(nillable.get().getDefaultElementEncoding(), nillable.get());
if (xml != null && xml instanceof CIResponsiblePartyType) {
citppt.setCIResponsibleParty((CIResponsiblePartyType) xml);
} else {
citppt.setNil();
citppt.setNilReason(Nillable.missing().get());
}
} else {
citppt.setNil();
if (nillable.hasReason()) {
citppt.setNilReason(nillable.getNilReason().get());
} else {
citppt.setNilReason(Nillable.missing().get());
}
}
}
}
}
}
use of org.n52.shetland.w3c.xlink.Referenceable in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodePhone.
private void encodePhone(CITelephonePropertyType citpt, Referenceable<CiTelephone> referenceable) {
if (referenceable.isReference()) {
Reference reference = referenceable.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(citpt::setActuate);
reference.getArcrole().ifPresent(citpt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(citpt::setHref);
reference.getRole().ifPresent(citpt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(citpt::setShow);
reference.getTitle().ifPresent(citpt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(citpt::setType);
} else {
if (referenceable.isInstance()) {
Nillable<CiTelephone> nillable = referenceable.getInstance();
if (nillable.isPresent()) {
CiTelephone ciTelephone = referenceable.getInstance().get();
CITelephoneType citt = citpt.addNewCITelephone();
if (ciTelephone.isSetVoice()) {
citt.setVoiceArray(listToCharacterStringPropertyTypeArray(ciTelephone.getVoice()));
}
if (ciTelephone.isSetFacsimile()) {
citt.setFacsimileArray(listToCharacterStringPropertyTypeArray(ciTelephone.getFacsimile()));
}
if (ciTelephone.isSetId()) {
citt.setId(ciTelephone.getId());
}
if (ciTelephone.isSetUuid()) {
citt.setUuid(ciTelephone.getUuid());
}
} else {
if (nillable.hasReason()) {
citpt.setNilReason(nillable.getNilReason().get());
}
}
}
}
}
use of org.n52.shetland.w3c.xlink.Referenceable in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeContact.
private void encodeContact(CIContactPropertyType cicpt, Referenceable<CiContact> referenceable) {
if (referenceable.isReference()) {
Reference reference = referenceable.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(cicpt::setActuate);
reference.getArcrole().ifPresent(cicpt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(cicpt::setHref);
reference.getRole().ifPresent(cicpt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(cicpt::setShow);
reference.getTitle().ifPresent(cicpt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(cicpt::setType);
} else {
if (referenceable.isInstance()) {
Nillable<CiContact> nillable = referenceable.getInstance();
if (nillable.isPresent()) {
CiContact ciContact = referenceable.getInstance().get();
CIContactType cict = cicpt.addNewCIContact();
if (ciContact.getAddress() != null) {
encodeCiAddress(cict.addNewAddress(), ciContact.getAddress());
}
if (ciContact.getContactInstructionsNillable() != null) {
if (ciContact.getContactInstructionsNillable().isPresent()) {
cict.addNewContactInstructions().setCharacterString(ciContact.getContactInstructions());
} else if (ciContact.getContactInstructionsNillable().hasReason()) {
cict.addNewContactInstructions().setNilReason(ciContact.getContactInstructionsNillable().getNilReason().get());
}
}
if (ciContact.isSetHoursOfService()) {
if (ciContact.getHoursOfServiceNillable().isPresent()) {
cict.addNewHoursOfService().setCharacterString(ciContact.getHoursOfService());
} else if (ciContact.getHoursOfServiceNillable().hasReason()) {
cict.addNewHoursOfService().setNilReason(ciContact.getHoursOfServiceNillable().getNilReason().get());
}
}
if (ciContact.getOnlineResourceReferenceable() != null) {
encodeOnlineResource(cict.addNewOnlineResource(), ciContact.getOnlineResourceReferenceable());
}
if (ciContact.isSetPhone()) {
encodePhone(cict.addNewPhone(), ciContact.getPhone());
}
} else {
if (nillable.hasReason()) {
cicpt.setNilReason(nillable.getNilReason().get());
}
}
}
}
}
use of org.n52.shetland.w3c.xlink.Referenceable in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeCiAddress.
private void encodeCiAddress(CIAddressPropertyType ciapt, Referenceable<CiAddress> referenceable) {
if (referenceable.isReference()) {
Reference reference = referenceable.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(ciapt::setActuate);
reference.getArcrole().ifPresent(ciapt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(ciapt::setHref);
reference.getRole().ifPresent(ciapt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(ciapt::setShow);
reference.getTitle().ifPresent(ciapt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(ciapt::setType);
} else {
if (referenceable.isInstance()) {
Nillable<CiAddress> nillable = referenceable.getInstance();
if (nillable.isPresent()) {
CiAddress ciAddress = referenceable.getInstance().get();
CIAddressType ciat = ciapt.addNewCIAddress();
if (ciAddress.isSetAdministrativeArea()) {
ciat.addNewAdministrativeArea().setCharacterString(ciAddress.getAdministrativeArea());
}
if (ciAddress.isSetCity()) {
ciat.addNewCity().setCharacterString(ciAddress.getCity());
}
if (ciAddress.isSetCountry()) {
ciat.addNewCountry().setCharacterString(ciAddress.getCountry());
}
if (ciAddress.isSetPostalCode()) {
ciat.addNewPostalCode().setCharacterString(ciAddress.getPostalCode());
}
if (ciAddress.hasDeliveryPoints()) {
ciat.setDeliveryPointArray(listToCharacterStringPropertyTypeArray(ciAddress.getDeliveryPoints()));
}
if (ciAddress.hasElectronicMailAddresses()) {
ciat.setElectronicMailAddressArray(listToCharacterStringPropertyTypeArray(Lists.newArrayList(ciAddress.getElectronicMailAddresses())));
}
if (ciAddress.isSetId()) {
ciat.setId(ciAddress.getId());
}
if (ciAddress.isSetUuid()) {
ciat.setUuid(ciAddress.getUuid());
}
} else {
if (nillable.hasReason()) {
ciapt.setNilReason(nillable.getNilReason().get());
}
}
}
}
}
use of org.n52.shetland.w3c.xlink.Referenceable 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;
}
Aggregations