Examples of PJsonObject


Examples of org.mapfish.print.wrapper.json.PJsonObject

                }
                try {
                    if (isRequestDataFile(requestFile)) {
                        String requestData = Files.asCharSource(requestFile, Charset.forName(Constants.DEFAULT_ENCODING)).read();

                        final PJsonObject jsonSpec;
                        if (requestFile.getName().matches(OLD_API_REQUEST_DATA_FILE)) {
                            PJsonObject oldSpec = MapPrinterServlet.parseJson(requestData, null);
                            jsonSpec = OldAPIRequestConverter.convert(oldSpec, this.mapPrinter.getConfiguration());
//                            continue;
                        } else {
                            jsonSpec = MapPrinter.parseSpec(requestData);
//                            continue;
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    @Test
    @DirtiesContext
    public void testExecute() throws Exception {
        Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config.yaml"));
        PJsonObject requestData = loadJsonRequestData();

        final AbstractJasperReportOutputFormat format = (AbstractJasperReportOutputFormat) this.outputFormat.get("pngOutputFormat");
        testPrint(config, requestData, "default-aoi", format);

        getAreaOfInterest(requestData).put("display", "CLIP");
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    private JSONObject getAreaOfInterest(PJsonObject requestData) throws JSONException {
        return getMapAttributes(requestData).getJSONObject("areaOfInterest");
    }

    private JSONObject getPagingAttributes(PJsonObject requestData) throws JSONException {
        final PJsonObject attributes = requestData.getJSONObject("attributes");
        JSONObject paging = attributes.getInternalObj().optJSONObject("paging");
        if (paging == null) {
            paging = new JSONObject();
            attributes.getInternalObj().put("paging", paging);
        }
        return paging;
    }
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

        final MockHttpServletRequest servletCreateRequest = new MockHttpServletRequest();
        final MockHttpServletResponse servletCreateResponse = new MockHttpServletResponse();

        String requestData = loadRequestDataAsString();
        servlet.createReport("docx", requestData, servletCreateRequest, servletCreateResponse);
        final PJsonObject createResponseJson = parseJSONObjectFromString(servletCreateResponse.getContentAsString());
        assertTrue(createResponseJson.has(MapPrinterServlet.JSON_PRINT_JOB_REF));
        assertEquals(HttpStatus.OK.value(), servletCreateResponse.getStatus());

        String ref = createResponseJson.getString(MapPrinterServlet.JSON_PRINT_JOB_REF);

        final String atHostRefSegment = "@" + this.servletInfo.getServletId();
        assertTrue(ref.endsWith(atHostRefSegment));
        assertTrue(ref.indexOf(atHostRefSegment) > 0);
        waitForFailure(ref);
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

        }
        return paging;
    }

    private JSONObject getMapAttributes(PJsonObject requestData) throws JSONException {
        final PJsonObject attributes = requestData.getJSONObject("attributes");
        return attributes.getInternalObj().optJSONObject("map");
    }
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

    public void testCreatePointSymbolizerExternalGraphic() throws Exception {

        JSONObject style = new JSONObject();
        style.put("externalGraphic", "mark.png");

        PointSymbolizer symbolizer = helper.createPointSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);
        transformer.transform(symbolizer); // assert it can be converted to SLD

        final Graphic graphic = symbolizer.getGraphic();
        assertNotNull(graphic);
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

        style.put("strokeLinecap", lineCap);
        style.put("graphicOpacity", 0.4);
        style.put("pointRadius", 5);
        style.put("rotation", 90);

        final PointSymbolizer symbolizer = helper.createPointSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);

        transformer.transform(symbolizer); // verify it can be encoded without exceptions

        final Graphic graphic = symbolizer.getGraphic();
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

        setUpConfigFiles();

        final MockHttpServletRequest servletCreateRequest = new MockHttpServletRequest();
        final MockHttpServletResponse servletCreateResponse = new MockHttpServletResponse();

        final PJsonObject requestJson = parseJSONObjectFromFile(MapPrinterServletTest.class, "requestData.json");
        requestJson.getInternalObj().remove("outputFilename");

        this.servlet.createReportAndGetNoAppId("png", requestJson.getInternalObj().toString(2), false, servletCreateRequest, servletCreateResponse);
        assertEquals(HttpStatus.OK.value(), servletCreateResponse.getStatus());

        assertCorrectResponse(servletCreateResponse, "config_test_outputname-");

        requestJson.getInternalObj().put("layout", "WithOutputName");

        this.servlet.createReportAndGetNoAppId("png", requestJson.getInternalObj().toString(2), false, servletCreateRequest, servletCreateResponse);
        assertEquals(HttpStatus.OK.value(), servletCreateResponse.getStatus());

        assertCorrectResponse(servletCreateResponse, "template_test_outputname-");
    }
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

        style.put("strokeOpacity", 0.2);
        style.put("strokeWidth", 2);
        style.put("strokeDashstyle", "5 2");
        style.put("strokeLinecap", "round");

        final PolygonSymbolizer symbolizer = helper.createPolygonSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);

        transformer.transform(symbolizer); // verify it converts to xml correctly

        assertStroke(0.2, "round", symbolizer.getStroke(), "#FFFFFF", new float[]{5f, 2f}, 2.0);
View Full Code Here

Examples of org.mapfish.print.wrapper.json.PJsonObject

        style.put("strokeOpacity", 0.2);
        style.put("strokeWidth", 2);
        style.put("strokeDashstyle", "5 2");
        style.put("strokeLinecap", "round");

        LineSymbolizer symbolizer = helper.createLineSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);

        transformer.transform(symbolizer); // verify it converts to xml correctly

        assertStroke(0.2, "round", symbolizer.getStroke(), "#FFFFFF", new float[]{5f, 2f}, 2.0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.