Search in sources :

Example 1 with CIResponsiblePartyPropertyType

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;
}
Also used : CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) CIResponsiblePartyDocument(org.isotc211.x2005.gmd.CIResponsiblePartyDocument) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType)

Example 2 with CIResponsiblePartyPropertyType

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());
                    }
                }
            }
        }
    }
}
Also used : CiResponsibleParty(org.n52.shetland.iso.gmd.CiResponsibleParty) ActuateType(org.w3.x1999.xlink.ActuateType) Reference(org.n52.shetland.w3c.xlink.Reference) Actuate(org.n52.shetland.w3c.xlink.Actuate) CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) VerticalDatumPropertyType(net.opengis.gml.x32.VerticalDatumPropertyType) ActuateType(org.w3.x1999.xlink.ActuateType) CodeType(org.n52.shetland.ogc.gml.CodeType) MonitoringPointType(net.opengis.waterml.x20.MonitoringPointType) ObservationProcessType(net.opengis.waterml.x20.ObservationProcessType) CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) ShapeType(net.opengis.samplingSpatial.x20.ShapeType) CollectionType(net.opengis.waterml.x20.CollectionType) MediaType(org.n52.janmayen.http.MediaType) TypeType(org.w3.x1999.xlink.TypeType) Type(org.n52.shetland.w3c.xlink.Type) VerticalDatumType(net.opengis.gml.x32.VerticalDatumType) OMObservationType(net.opengis.om.x20.OMObservationType) ShowType(org.w3.x1999.xlink.ShowType) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType) ReferenceType(org.n52.shetland.ogc.gml.ReferenceType) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType) Show(org.n52.shetland.w3c.xlink.Show) XmlObject(org.apache.xmlbeans.XmlObject) TypeType(org.w3.x1999.xlink.TypeType) ShowType(org.w3.x1999.xlink.ShowType)

Example 3 with CIResponsiblePartyPropertyType

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;
}
Also used : CIResponsiblePartyType(org.isotc211.x2005.gmd.CIResponsiblePartyType) CIResponsiblePartyDocument(org.isotc211.x2005.gmd.CIResponsiblePartyDocument) CIResponsiblePartyPropertyType(org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType)

Aggregations

CIResponsiblePartyPropertyType (org.isotc211.x2005.gmd.CIResponsiblePartyPropertyType)3 CIResponsiblePartyType (org.isotc211.x2005.gmd.CIResponsiblePartyType)3 CIResponsiblePartyDocument (org.isotc211.x2005.gmd.CIResponsiblePartyDocument)2 VerticalDatumPropertyType (net.opengis.gml.x32.VerticalDatumPropertyType)1 VerticalDatumType (net.opengis.gml.x32.VerticalDatumType)1 OMObservationType (net.opengis.om.x20.OMObservationType)1 ShapeType (net.opengis.samplingSpatial.x20.ShapeType)1 CollectionType (net.opengis.waterml.x20.CollectionType)1 MonitoringPointType (net.opengis.waterml.x20.MonitoringPointType)1 ObservationProcessType (net.opengis.waterml.x20.ObservationProcessType)1 XmlObject (org.apache.xmlbeans.XmlObject)1 MediaType (org.n52.janmayen.http.MediaType)1 CiResponsibleParty (org.n52.shetland.iso.gmd.CiResponsibleParty)1 CodeType (org.n52.shetland.ogc.gml.CodeType)1 ReferenceType (org.n52.shetland.ogc.gml.ReferenceType)1 Actuate (org.n52.shetland.w3c.xlink.Actuate)1 Reference (org.n52.shetland.w3c.xlink.Reference)1 Show (org.n52.shetland.w3c.xlink.Show)1 Type (org.n52.shetland.w3c.xlink.Type)1 ActuateType (org.w3.x1999.xlink.ActuateType)1