use of org.isotc211.x2005.gmd.CIAddressPropertyType 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());
}
}
}
}
}
Aggregations