use of org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeResponsibleParty.
private XmlObject encodeResponsibleParty(CiResponsibleParty responsibleParty, EncodingContext context) throws EncodingException {
if (responsibleParty.isSetSimpleAttrs()) {
CIResponsiblePartyPropertyType cirppt = CIResponsiblePartyPropertyType.Factory.newInstance(getXmlOptions());
cirppt.setHref(responsibleParty.getSimpleAttrs().getHref());
if (responsibleParty.getSimpleAttrs().isSetTitle()) {
cirppt.setTitle(responsibleParty.getSimpleAttrs().getTitle());
}
if (responsibleParty.getSimpleAttrs().isSetRole()) {
cirppt.setRole(responsibleParty.getSimpleAttrs().getRole());
}
return cirppt;
}
CIResponsiblePartyType cirpt = CIResponsiblePartyType.Factory.newInstance(getXmlOptions());
if (responsibleParty.isSetIndividualName()) {
cirpt.addNewIndividualName().setCharacterString(responsibleParty.getIndividualName());
}
if (responsibleParty.isSetOrganizationName()) {
cirpt.addNewOrganisationName().setCharacterString(responsibleParty.getOrganizationName());
}
if (responsibleParty.isSetPositionName()) {
cirpt.addNewPositionName().setCharacterString(responsibleParty.getPositionName());
}
// set contact
if (responsibleParty.isSetContactInfo()) {
encodeContact(cirpt.addNewContactInfo(), responsibleParty.getContactInfo());
}
// set role
encodeRole(cirpt.addNewRole(), responsibleParty.getRoleNillable());
if (responsibleParty.isSetId()) {
cirpt.setId(responsibleParty.getId());
}
if (responsibleParty.isSetUuid()) {
cirpt.setUuid(responsibleParty.getUuid());
}
if (context.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
CIResponsiblePartyPropertyType cirppt = CIResponsiblePartyPropertyType.Factory.newInstance(getXmlOptions());
cirppt.setCIResponsibleParty(cirpt);
return cirppt;
} else if (context.has(XmlBeansEncodingFlags.DOCUMENT)) {
CIResponsiblePartyDocument cirpd = CIResponsiblePartyDocument.Factory.newInstance(getXmlOptions());
cirpd.setCIResponsibleParty(cirpt);
return cirpd;
}
return cirpt;
}
use of org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType 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.isotc211.x2005.gmd.CIResponsiblePartyPropertyType in project arctic-sea by 52North.
the class Iso19139GmdEncoder method encodeResponsibleParty.
private XmlObject encodeResponsibleParty(SmlResponsibleParty responsibleParty, EncodingContext additionalValues) throws EncodingException {
if (responsibleParty.isSetHref()) {
CIResponsiblePartyPropertyType cirppt = CIResponsiblePartyPropertyType.Factory.newInstance(getXmlOptions());
cirppt.setHref(responsibleParty.getHref());
if (responsibleParty.isSetTitle()) {
cirppt.setTitle(responsibleParty.getTitle());
}
if (responsibleParty.isSetRole()) {
cirppt.setRole(responsibleParty.getRole());
}
return cirppt;
}
CIResponsiblePartyType cirpt = CIResponsiblePartyType.Factory.newInstance(getXmlOptions());
if (responsibleParty.isSetIndividualName()) {
cirpt.addNewIndividualName().setCharacterString(responsibleParty.getIndividualName());
}
if (responsibleParty.isSetOrganizationName()) {
cirpt.addNewOrganisationName().setCharacterString(responsibleParty.getOrganizationName());
}
if (responsibleParty.isSetPositionName()) {
cirpt.addNewPositionName().setCharacterString(responsibleParty.getPositionName());
}
// set contact
encodeContact(cirpt.addNewContactInfo().addNewCIContact(), responsibleParty);
// set role
encodeRole(cirpt.addNewRole(), responsibleParty.getRoleObject());
if (additionalValues.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
CIResponsiblePartyPropertyType cirppt = CIResponsiblePartyPropertyType.Factory.newInstance(getXmlOptions());
cirppt.setCIResponsibleParty(cirpt);
return cirppt;
} else if (additionalValues.has(XmlBeansEncodingFlags.DOCUMENT)) {
CIResponsiblePartyDocument cirpd = CIResponsiblePartyDocument.Factory.newInstance(getXmlOptions());
cirpd.setCIResponsibleParty(cirpt);
}
return cirpt;
}
Aggregations