Search in sources :

Example 51 with ObjectFactory

use of net.opengis.filter.v_1_1_0.ObjectFactory in project testnorge by navikt.

the class RefusjonDTO method toXmlElement.

@Override
public XMLRefusjon toXmlElement() {
    ObjectFactory factory = new ObjectFactory();
    XMLRefusjon xmlRefusjon = factory.createXMLRefusjon();
    if (endringIRefusjonListe != null) {
        XMLEndringIRefusjonsListe xmlEndringIRefusjonsListe = factory.createXMLEndringIRefusjonsListe();
        xmlEndringIRefusjonsListe.withEndringIRefusjon(EndringIRefusjonDTO.convert(endringIRefusjonListe));
        xmlRefusjon.withEndringIRefusjonListe(factory.createXMLRefusjonEndringIRefusjonListe(xmlEndringIRefusjonsListe));
    }
    xmlRefusjon.setRefusjonsbeloepPrMnd(factory.createXMLRefusjonRefusjonsbeloepPrMnd(refusjonsbeloepPrMnd != null ? BigDecimal.valueOf(refusjonsbeloepPrMnd) : null));
    xmlRefusjon.setRefusjonsopphoersdato(factory.createXMLRefusjonRefusjonsopphoersdato(refusjonsopphoersdato));
    return xmlRefusjon;
}
Also used : ObjectFactory(no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory) XMLEndringIRefusjonsListe(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLEndringIRefusjonsListe) XMLRefusjon(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLRefusjon)

Example 52 with ObjectFactory

use of net.opengis.filter.v_1_1_0.ObjectFactory in project testnorge by navikt.

the class SykepengerIArbeidsgiverperiodenDTO method toXmlElement.

@Override
public XMLSykepengerIArbeidsgiverperioden toXmlElement() {
    ObjectFactory factory = new ObjectFactory();
    XMLSykepengerIArbeidsgiverperioden xmlSykepengerIArbeidsgiverperioden = factory.createXMLSykepengerIArbeidsgiverperioden();
    if (arbeidsgiverperiodeListe != null) {
        XMLArbeidsgiverperiodeListe xmlArbeidsgiverperiodeListe = factory.createXMLArbeidsgiverperiodeListe();
        xmlArbeidsgiverperiodeListe.withArbeidsgiverperiode(PeriodeDTO.convert(arbeidsgiverperiodeListe));
        xmlSykepengerIArbeidsgiverperioden.setArbeidsgiverperiodeListe(factory.createXMLSykepengerIArbeidsgiverperiodenArbeidsgiverperiodeListe(xmlArbeidsgiverperiodeListe));
    }
    xmlSykepengerIArbeidsgiverperioden.setBruttoUtbetalt(factory.createXMLSykepengerIArbeidsgiverperiodenBruttoUtbetalt(bruttoUtbetalt != null ? BigDecimal.valueOf(bruttoUtbetalt) : null));
    xmlSykepengerIArbeidsgiverperioden.setBegrunnelseForReduksjonEllerIkkeUtbetalt(factory.createXMLSykepengerIArbeidsgiverperiodenBegrunnelseForReduksjonEllerIkkeUtbetalt(begrunnelseForReduksjonEllerIkkeUtbetalt));
    return xmlSykepengerIArbeidsgiverperioden;
}
Also used : ObjectFactory(no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory) XMLArbeidsgiverperiodeListe(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLArbeidsgiverperiodeListe) XMLSykepengerIArbeidsgiverperioden(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLSykepengerIArbeidsgiverperioden)

Example 53 with ObjectFactory

use of net.opengis.filter.v_1_1_0.ObjectFactory in project testnorge by navikt.

the class UtsettelseAvForeldrepengerDTO method toXmlElement.

@Override
public XMLUtsettelseAvForeldrepenger toXmlElement() {
    ObjectFactory factory = new ObjectFactory();
    XMLUtsettelseAvForeldrepenger xmlUtsettelseAvForeldrepenger = factory.createXMLUtsettelseAvForeldrepenger();
    xmlUtsettelseAvForeldrepenger.setPeriode(factory.createXMLUtsettelseAvForeldrepengerPeriode(periode != null ? periode.toXmlElement() : null));
    xmlUtsettelseAvForeldrepenger.setAarsakTilUtsettelse(factory.createXMLUtsettelseAvForeldrepengerAarsakTilUtsettelse(aarsakTilUtsettelse));
    return xmlUtsettelseAvForeldrepenger;
}
Also used : ObjectFactory(no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory) XMLUtsettelseAvForeldrepenger(no.seres.xsd.nav.inntektsmelding_m._20181211.XMLUtsettelseAvForeldrepenger)

Example 54 with ObjectFactory

use of net.opengis.filter.v_1_1_0.ObjectFactory in project phoss-smp by phax.

the class MainCreate1MillionEndpoints method main.

public static void main(final String[] args) throws Throwable {
    final SMPServerRESTTestRule aRule = new SMPServerRESTTestRule(ClassPathResource.getAsFile("test-smp-server-mongodb.properties").getAbsolutePath());
    aRule.before();
    try {
        // Set the special PhotonSecurityManager factory
        PhotonSecurityManager.setFactory(new PhotonSecurityManagerFactoryMongoDB());
        final ObjectFactory aObjFactory = new ObjectFactory();
        final PeppolDocumentTypeIdentifier aDT = EPredefinedDocumentTypeIdentifier.INVOICE_EN16931_PEPPOL_V30.getAsDocumentTypeIdentifier();
        final String sDT = aDT.getURIEncoded();
        final PeppolProcessIdentifier aProcID = EPredefinedProcessIdentifier.BIS3_BILLING.getAsProcessIdentifier();
        final StopWatch aSWOverall = StopWatch.createdStarted();
        for (int i = 639276; i < 1_000_000; ++i) {
            final StopWatch aSW = StopWatch.createdStarted();
            final PeppolParticipantIdentifier aPI = PeppolIdentifierFactory.INSTANCE.createParticipantIdentifierWithDefaultScheme("9999:test-philip-" + StringHelper.getLeadingZero(i, 7));
            final String sPI = aPI.getURIEncoded();
            final ServiceMetadataType aSM = new ServiceMetadataType();
            final ServiceInformationType aSI = new ServiceInformationType();
            aSI.setParticipantIdentifier(new SimpleParticipantIdentifier(aPI));
            aSI.setDocumentIdentifier(aDT);
            {
                final ProcessListType aPL = new ProcessListType();
                final ProcessType aProcess = new ProcessType();
                aProcess.setProcessIdentifier(aProcID);
                final ServiceEndpointList aSEL = new ServiceEndpointList();
                final EndpointType aEndpoint = new EndpointType();
                aEndpoint.setEndpointReference(W3CEndpointReferenceHelper.createEndpointReference("http://test.smpserver/as2"));
                aEndpoint.setRequireBusinessLevelSignature(false);
                aEndpoint.setCertificate("blacert");
                aEndpoint.setServiceDescription("Unit test service");
                aEndpoint.setTechnicalContactUrl("https://github.com/phax/phoss-smp");
                aEndpoint.setTransportProfile(ESMPTransportProfile.TRANSPORT_PROFILE_AS2.getID());
                aSEL.addEndpoint(aEndpoint);
                aProcess.setServiceEndpointList(aSEL);
                aPL.addProcess(aProcess);
                aSI.setProcessList(aPL);
            }
            aSM.setServiceInformation(aSI);
            try (final WebScoped aWS = new WebScoped(new MockHttpServletRequest())) {
                // Delete old - don't care about the result
                if (false)
                    ClientBuilder.newClient().target(aRule.getFullURL()).path(sPI).path("services").path(sDT).request().header(CHttpHeader.AUTHORIZATION, CREDENTIALS.getRequestValue()).delete();
                // Create a new
                final Response aResponseMsg = ClientBuilder.newClient().target(aRule.getFullURL()).path(sPI).path("services").path(sDT).request().header(CHttpHeader.AUTHORIZATION, CREDENTIALS.getRequestValue()).put(Entity.xml(aObjFactory.createServiceMetadata(aSM)));
                _testResponseJerseyClient(aResponseMsg, 200);
            }
            aSW.stop();
            LOGGER.info(sPI + " took " + aSW.getMillis() + " ms");
        }
        aSWOverall.stop();
        LOGGER.info("Overall process took " + aSWOverall.getMillis() + " ms or " + aSWOverall.getDuration());
    } finally {
        aRule.after();
    }
}
Also used : WebScoped(com.helger.web.scope.mgr.WebScoped) PhotonSecurityManagerFactoryMongoDB(com.helger.phoss.smp.backend.mongodb.PhotonSecurityManagerFactoryMongoDB) MockHttpServletRequest(com.helger.servlet.mock.MockHttpServletRequest) PeppolProcessIdentifier(com.helger.peppolid.peppol.process.PeppolProcessIdentifier) ServiceInformationType(com.helger.xsds.peppol.smp1.ServiceInformationType) SimpleParticipantIdentifier(com.helger.peppolid.simple.participant.SimpleParticipantIdentifier) SMPServerRESTTestRule(com.helger.phoss.smp.mock.SMPServerRESTTestRule) StopWatch(com.helger.commons.timing.StopWatch) PeppolParticipantIdentifier(com.helger.peppolid.peppol.participant.PeppolParticipantIdentifier) Response(javax.ws.rs.core.Response) ProcessType(com.helger.xsds.peppol.smp1.ProcessType) ObjectFactory(com.helger.xsds.peppol.smp1.ObjectFactory) PeppolDocumentTypeIdentifier(com.helger.peppolid.peppol.doctype.PeppolDocumentTypeIdentifier) EndpointType(com.helger.xsds.peppol.smp1.EndpointType) ProcessListType(com.helger.xsds.peppol.smp1.ProcessListType) ServiceMetadataType(com.helger.xsds.peppol.smp1.ServiceMetadataType) ServiceEndpointList(com.helger.xsds.peppol.smp1.ServiceEndpointList)

Example 55 with ObjectFactory

use of net.opengis.filter.v_1_1_0.ObjectFactory in project ddf by codice.

the class CswEndpoint method getInsertResultFromResponse.

private InsertResultType getInsertResultFromResponse(CreateResponse createResponse) throws CswException {
    InsertResultType result = new InsertResultType();
    WKTReader reader = new WKTReader();
    for (Metacard metacard : createResponse.getCreatedMetacards()) {
        BoundingBoxType boundingBox = new BoundingBoxType();
        Geometry geometry = null;
        String bbox = null;
        try {
            if (metacard.getAttribute(CswConstants.BBOX_PROP) != null) {
                bbox = metacard.getAttribute(CswConstants.BBOX_PROP).getValue().toString();
                geometry = reader.read(bbox);
            } else if (StringUtils.isNotBlank(metacard.getLocation())) {
                bbox = metacard.getLocation();
                geometry = reader.read(bbox);
            }
        } catch (ParseException e) {
            LOGGER.debug("Unable to parse BoundingBox : {}", bbox, e);
        }
        BriefRecordType briefRecordType = new BriefRecordType();
        if (geometry != null) {
            Envelope bounds = geometry.getEnvelopeInternal();
            if (bounds != null) {
                boundingBox.setCrs(CswConstants.SRS_NAME);
                boundingBox.setLowerCorner(Arrays.asList(bounds.getMinX(), bounds.getMinY()));
                boundingBox.setUpperCorner(Arrays.asList(bounds.getMaxX(), bounds.getMaxY()));
                briefRecordType.getBoundingBox().add(new net.opengis.ows.v_1_0_0.ObjectFactory().createBoundingBox(boundingBox));
            }
        }
        SimpleLiteral identifier = new SimpleLiteral();
        identifier.getContent().add(metacard.getId());
        briefRecordType.getIdentifier().add(new JAXBElement<>(CswConstants.DC_IDENTIFIER_QNAME, SimpleLiteral.class, identifier));
        SimpleLiteral title = new SimpleLiteral();
        title.getContent().add(metacard.getTitle());
        briefRecordType.getTitle().add(new JAXBElement<>(CswConstants.DC_TITLE_QNAME, SimpleLiteral.class, title));
        SimpleLiteral type = new SimpleLiteral();
        type.getContent().add(metacard.getContentTypeName());
        briefRecordType.setType(type);
        result.getBriefRecord().add(briefRecordType);
    }
    return result;
}
Also used : WKTReader(org.locationtech.jts.io.WKTReader) Envelope(org.locationtech.jts.geom.Envelope) BriefRecordType(net.opengis.cat.csw.v_2_0_2.BriefRecordType) BoundingBoxType(net.opengis.ows.v_1_0_0.BoundingBoxType) Geometry(org.locationtech.jts.geom.Geometry) Metacard(ddf.catalog.data.Metacard) ObjectFactory(net.opengis.cat.csw.v_2_0_2.ObjectFactory) SimpleLiteral(net.opengis.cat.csw.v_2_0_2.dc.elements.SimpleLiteral) MimeTypeParseException(javax.activation.MimeTypeParseException) ParseException(org.locationtech.jts.io.ParseException) InsertResultType(net.opengis.cat.csw.v_2_0_2.InsertResultType)

Aggregations

Test (org.junit.Test)23 JAXBElement (javax.xml.bind.JAXBElement)22 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)18 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 ObjectFactory (no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory)16 Marshaller (javax.xml.bind.Marshaller)14 JAXBContext (javax.xml.bind.JAXBContext)13 QName (javax.xml.namespace.QName)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 XStream (com.thoughtworks.xstream.XStream)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)12 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)12 StringWriter (java.io.StringWriter)11 ArrayList (java.util.ArrayList)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11 MarshallingContext (com.thoughtworks.xstream.converters.MarshallingContext)10 HierarchicalStreamWriter (com.thoughtworks.xstream.io.HierarchicalStreamWriter)10 BigInteger (java.math.BigInteger)10