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