Search in sources :

Example 76 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.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 77 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project geotoolkit by Geomatys.

the class WcsXMLBindingTest method marshallingTest200.

@Test
public void marshallingTest200() throws JAXBException, IOException, ParserConfigurationException, SAXException {
    org.geotoolkit.wcs.xml.v200.GetCoverageType getCoverage = new org.geotoolkit.wcs.xml.v200.GetCoverageType("test", "image/geotiff", null);
    ParametersType param = new ParametersType();
    param.setCompression(CompressionType.NONE);
    param.setInterleave(InterleaveType.PIXEL);
    param.setJpegQuality(10);
    param.setPredictor(PredictorType.NONE);
    param.setTileheight(12);
    param.setTilewidth(15);
    param.setTiling(true);
    ObjectFactory facto = new ObjectFactory();
    getCoverage.setExtension(new ExtensionType(facto.createParameters(param)));
    StringWriter sw = new StringWriter();
    marshaller.marshal(getCoverage, sw);
    String result = sw.toString();
    String expResult = "<wcs:GetCoverage version=\"2.0.1\" service=\"WCS\" " + "xmlns:wcs=\"http://www.opengis.net/wcs/2.0\" xmlns:geotiff=\"http://www.opengis.net/gmlcov/geotiff/1.0\">" + '\n' + "    <wcs:Extension>\n" + "        <geotiff:parameters>\n" + "            <geotiff:compression>None</geotiff:compression>\n" + "            <geotiff:jpeg_quality>10</geotiff:jpeg_quality>\n" + "            <geotiff:predictor>None</geotiff:predictor>\n" + "            <geotiff:interleave>Pixel</geotiff:interleave>\n" + "            <geotiff:tiling>true</geotiff:tiling>\n" + "            <geotiff:tileheight>12</geotiff:tileheight>\n" + "            <geotiff:tilewidth>15</geotiff:tilewidth>\n" + "        </geotiff:parameters>\n" + "    </wcs:Extension>\n" + "    <wcs:CoverageId>test</wcs:CoverageId>" + '\n' + "    <wcs:format>image/geotiff</wcs:format>" + '\n' + "</wcs:GetCoverage>" + '\n';
    assertXmlEquals(expResult, result, "xmlns:*");
    final org.geotoolkit.wcs.xml.v200.GetCoverageType unmarshalled = (org.geotoolkit.wcs.xml.v200.GetCoverageType) ((JAXBElement) unmarshaller.unmarshal(new StringReader(expResult))).getValue();
    assertEquals(getCoverage, unmarshalled);
    final org.geotoolkit.gml.xml.v321.RangeSetType rangeSet = new org.geotoolkit.gml.xml.v321.RangeSetType();
    final FileType ft = new FileType();
    ft.setMimeType("image/tiff");
    final String ext = ".tif";
    ft.setRangeParameters(new AssociationRoleType("cid:grey" + ext, "http://www.opengis.net/spec/GMLCOV_geotiff-coverages/1.0/conf/geotiff-coverage", "fileReference"));
    ft.setFileReference("cid:grey" + ext);
    rangeSet.setFile(ft);
    final AbstractDiscreteCoverageType cov = new AbstractDiscreteCoverageType(new CoverageDescriptionType(), rangeSet);
    final org.geotoolkit.gmlcov.xml.v100.ObjectFactory factory = new org.geotoolkit.gmlcov.xml.v100.ObjectFactory();
    JAXBElement jb = factory.createGridCoverage(cov);
    sw = new StringWriter();
    marshaller.marshal(jb, sw);
    result = sw.toString();
    System.out.println(result);
    // test the crs extension in capabilities
    List<String> supportedFormat = new ArrayList<>();
    supportedFormat.add("image/tiff");
    supportedFormat.add("application/x-netcdf");
    List<String> supportedCrs = new ArrayList<>();
    supportedCrs.add("http://www.opengis.net/def/crs/EPSG/0/4326");
    supportedCrs.add("http://www.opengis.net/def/crs/EPSG/0/666");
    ServiceMetadataType serviceMetadata = new ServiceMetadataType(supportedFormat, supportedCrs);
    CapabilitiesType capa = new CapabilitiesType(null, null, null, "2.0.1", null, null, serviceMetadata);
    sw = new StringWriter();
    marshaller.marshal(capa, sw);
    result = sw.toString();
    System.out.println(result);
    // test the crs extension in get coverage
    String subsettingCRS = "http://www.opengis.net/def/crs/EPSG/0/4326";
    String outputCRS = "http://www.opengis.net/def/crs/EPSG/0/666";
    org.geotoolkit.wcs.xml.v200.GetCoverageType getCov = new org.geotoolkit.wcs.xml.v200.GetCoverageType("CID", "geotiff", "image/tiff", subsettingCRS, outputCRS);
    sw = new StringWriter();
    marshaller.marshal(getCov, sw);
    result = sw.toString();
    System.out.println(result);
}
Also used : AssociationRoleType(org.geotoolkit.gml.xml.v321.AssociationRoleType) ArrayList(java.util.ArrayList) AbstractDiscreteCoverageType(org.geotoolkit.gmlcov.xml.v100.AbstractDiscreteCoverageType) ObjectFactory(org.geotoolkit.gmlcov.geotiff.xml.v100.ObjectFactory) StringWriter(java.io.StringWriter) CapabilitiesType(org.geotoolkit.wcs.xml.v200.CapabilitiesType) StringReader(java.io.StringReader) CoverageDescriptionType(org.geotoolkit.wcs.xml.v200.CoverageDescriptionType) ServiceMetadataType(org.geotoolkit.wcs.xml.v200.ServiceMetadataType) GetCoverageType(org.geotoolkit.wcs.xml.v100.GetCoverageType) JAXBElement(javax.xml.bind.JAXBElement) FileType(org.geotoolkit.gml.xml.v321.FileType) ExtensionType(org.geotoolkit.wcs.xml.v200.ExtensionType) ParametersType(org.geotoolkit.gmlcov.geotiff.xml.v100.ParametersType)

Example 78 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project geotoolkit by Geomatys.

the class OpenSearchXmlFactory method completeFeed.

public static FeedType completeFeed(FeedType feed, Long totalResults, Long startIndex, Long itemsPerPage) {
    final ObjectFactory factory = new ObjectFactory();
    feed.getPagingAttributes().add(factory.createTotalResults(totalResults));
    feed.getPagingAttributes().add(factory.createStartIndex(startIndex));
    feed.getPagingAttributes().add(factory.createItemsPerPage(itemsPerPage));
    CompleteQueryType query = new CompleteQueryType();
    query.setRole("request");
    feed.getPagingAttributes().add(factory.createQuery(query));
    return feed;
}
Also used : ObjectFactory(org.geotoolkit.ops.xml.v110.ObjectFactory) CompleteQueryType(org.geotoolkit.ops.xml.v110.CompleteQueryType)

Example 79 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project geotoolkit by Geomatys.

the class OpenSearchXmlFactory method buildFeed.

public static FeedType buildFeed(String id, String title, PersonType author, String source, Long totalResults, Long startIndex, Long itemsPerPage) {
    FeedType feed = new FeedType(id, title, author, source);
    final ObjectFactory factory = new ObjectFactory();
    feed.getPagingAttributes().add(factory.createTotalResults(totalResults));
    feed.getPagingAttributes().add(factory.createStartIndex(startIndex));
    feed.getPagingAttributes().add(factory.createItemsPerPage(itemsPerPage));
    return feed;
}
Also used : FeedType(org.w3._2005.atom.FeedType) ObjectFactory(org.geotoolkit.ops.xml.v110.ObjectFactory)

Example 80 with ObjectFactory

use of no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory in project geotoolkit by Geomatys.

the class SEforSLD110Test method testRule.

@Test
public void testRule() throws JAXBException, FactoryException {
    final Unmarshaller UNMARSHALLER = POOL.acquireUnmarshaller();
    final Marshaller MARSHALLER = POOL.acquireMarshaller();
    // Read test
    Object obj = UNMARSHALLER.unmarshal(FILE_SE_RULE);
    assertNotNull(obj);
    JAXBElement<?> jax = (JAXBElement<?>) obj;
    MutableRule rule = TRANSFORMER_GT.visitRule(jax.getValue());
    assertNotNull(rule);
    assertEquals(rule.getName(), valueName);
    assertEquals(rule.getDescription().getTitle().toString(), valueTitle);
    assertEquals(rule.getDescription().getAbstract().toString(), valueAbstract);
    assertEquals(rule.getMinScaleDenominator(), 500d, DELTA);
    assertEquals(rule.getMaxScaleDenominator(), 1000d, DELTA);
    assertNull(rule.getLegend());
    assertNotNull(rule.getFilter());
    assertEquals(rule.symbolizers().size(), 4);
    // Write test
    RuleType pvt = (RuleType) TRANSFORMER_OGC.visit(rule, null);
    assertNotNull(pvt);
    assertEquals(pvt.getName(), valueName);
    assertEquals(String.valueOf(pvt.getDescription().getTitle()), valueTitle);
    assertEquals(String.valueOf(pvt.getDescription().getAbstract()), valueAbstract);
    assertEquals(pvt.getMinScaleDenominator(), 500d, DELTA);
    assertEquals(pvt.getMaxScaleDenominator(), 1000d, DELTA);
    assertNull(pvt.getLegendGraphic());
    assertEquals(pvt.getSymbolizer().size(), 4);
    MARSHALLER.marshal(new ObjectFactory().createRule(pvt), TEST_FILE_SE_RULE);
    POOL.recycle(MARSHALLER);
    POOL.recycle(UNMARSHALLER);
}
Also used : MutableRule(org.geotoolkit.style.MutableRule) Marshaller(javax.xml.bind.Marshaller) ObjectFactory(org.geotoolkit.se.xml.v110.ObjectFactory) RuleType(org.geotoolkit.se.xml.v110.RuleType) JAXBElement(javax.xml.bind.JAXBElement) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)32 ArrayList (java.util.ArrayList)26 Test (org.junit.Test)26 Marshaller (javax.xml.bind.Marshaller)23 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 StringWriter (java.io.StringWriter)19 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 JAXBContext (javax.xml.bind.JAXBContext)15 QName (javax.xml.namespace.QName)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 ObjectFactory (com.opensymphony.xwork2.ObjectFactory)12 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 ObjectFactory (slash.navigation.kml.binding22.ObjectFactory)12 BigInteger (java.math.BigInteger)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11