Examples of PJsonObject


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

    @Override
    public final PrintJobStatus call() throws Exception {
        SecurityContextHolder.setContext(this.securityContext);
        Timer.Context timer = this.metricRegistry.timer(getClass().getName() + " call()").time();
        PJsonObject spec = null;
        MapPrinter mapPrinter = null;
        try {
            spec = PrintJob.this.requestData;
            mapPrinter = PrintJob.this.mapPrinterFactory.create(getAppId());
            final MapPrinter finalMapPrinter = mapPrinter;
View Full Code Here

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

        for (Iterator<String> iterator = this.json.keys(); iterator.hasNext();) {
            String styleKey = iterator.next();
            if (styleKey.equals(JSON_STYLE_PROPERTY) || styleKey.equals(MapfishJsonStyleParserPlugin.JSON_VERSION)) {
                continue;
            }
            PJsonObject styleJson = this.json.getJSONObject(styleKey);
            final List<Rule> currentRules = createStyleRule(styleKey, styleJson, styleProperty);
            for (Rule currentRule : currentRules) {
                if (currentRule != null) {
                    styleRules.add(currentRule);
                }
View Full Code Here

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

        return this.parserHelper.createStyle(rules);
    }

    private Rule createRule(final String jsonKey) {
        PJsonObject ruleJson = this.json.getJSONObject(jsonKey);
        Filter filter = Filter.INCLUDE;
        if (!jsonKey.equals(JSON_FILTER_INCLUDE)) {
            try {
                filter = ECQL.toFilter(jsonKey, this.styleBuilder.getFilterFactory());
            } catch (CQLException e) {
                throw new RuntimeException("Error compiling rule filter: " + jsonKey, e);
            }
        }

        PJsonArray symbolizerJsonArray = ruleJson.getJSONArray(JSON_SYMB);
        Symbolizer[] symbolizers = new Symbolizer[symbolizerJsonArray.size()];

        for (int i = 0; i < symbolizerJsonArray.size(); i++) {
            final PJsonObject symbolizerJson = symbolizerJsonArray.getJSONObject(i);
            updateSymbolizerProperties(ruleJson, symbolizerJson);

            SymbolizerType type = SymbolizerType.valueOf(symbolizerJson.getString(JSON_TYPE).toUpperCase());
            symbolizers[i] = type.parseJson(this.parserHelper, symbolizerJson);
            if (symbolizers[i] == null) {
                throw new RuntimeException("Error creating symbolizer " + symbolizerJson.getString(JSON_TYPE) + " in rule " + jsonKey);
            }
        }

        Map<String, String> ruleValues = buildValuesMap(ruleJson, new PJsonObject(new JSONObject(), "empty"));
        double minScale = getScaleDenominator(ruleValues, JSON_MIN_SCALE, Double.MIN_VALUE);
        double maxScale = getScaleDenominator(ruleValues, JSON_MAX_SCALE, Double.MAX_VALUE);
        final Rule rule = this.styleBuilder.createRule(symbolizers, minScale, maxScale);
        rule.setFilter(filter);
        return rule;
View Full Code Here

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

                writer.close();

            } else {
                final InputStream inFile = getInputStream(cli.spec);
                final String jsonConfiguration = CharStreams.toString(new InputStreamReader(inFile, Constants.DEFAULT_ENCODING));
                PJsonObject jsonSpec = MapPrinter.parseSpec(jsonConfiguration);

                if (cli.v2Api) {
                    PJsonObject oldApiSpec = jsonSpec;
                    LOGGER.info("Converting request data from V2 API request data to V3 API");
                    jsonSpec = OldAPIRequestConverter.convert(oldApiSpec, this.mapPrinter.getConfiguration());
                }

                outFile = getOutputStream(cli.output, this.mapPrinter.getOutputFormat(jsonSpec).getFileSuffix());
View Full Code Here

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

    @RequestMapping(value = REPORT_URL + ".{format:\\w+}", method = RequestMethod.POST)
    public final void createReport(@PathVariable final String format,
                                   @RequestBody final String requestData,
                                   final HttpServletRequest createReportRequest,
                                   final HttpServletResponse createReportResponse) throws JSONException, NoSuchAppException {
        PJsonObject spec = parseJson(requestData, createReportResponse);

        String appId = spec.optString(JSON_APP, DEFAULT_CONFIGURATION_FILE_KEY);
        createReport(appId, format, requestData, createReportRequest, createReportResponse);
    }
View Full Code Here

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

                                                @RequestBody final String requestData,
                                                @RequestParam(value = "inline", defaultValue = "false") final boolean inline,
                                                final HttpServletRequest createReportRequest,
                                                final HttpServletResponse createReportResponse)
            throws IOException, ServletException, InterruptedException, JSONException, NoSuchAppException {
        PJsonObject spec = parseJson(requestData, createReportResponse);

        String appId = spec.optString(JSON_APP, DEFAULT_CONFIGURATION_FILE_KEY);
        createReportAndGet(appId, format, requestData, inline, createReportRequest, createReportResponse);
    }
View Full Code Here

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

                template.getConfiguration()));
        this.values.put(TEMPLATE_KEY, template);
        this.values.put(PDF_CONFIG, template.getPdfConfig());
        this.values.put(SUBREPORT_DIR, jasperTemplateBuild.getAbsolutePath());

        final PJsonObject jsonAttributes = requestData.getJSONObject(MapPrinterServlet.JSON_ATTRIBUTES);

        Map<String, Attribute> attributes = Maps.newHashMap(template.getAttributes());
        populateFromAttributes(template, parser, attributes, jsonAttributes);
    }
View Full Code Here

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

                Object defaultVal = pAtt.getDefault();
                PObject jsonToUse = requestJsonAttributes;
                if (defaultVal != null) {
                    final JSONObject obj = new JSONObject();
                    obj.put(attributeName, defaultVal);
                    PObject[] pValues = new PObject[]{requestJsonAttributes, new PJsonObject(obj, "default_" + attributeName)};
                    jsonToUse = new PMultiObject(pValues);
                }
                value = parser.parsePrimitive(attributeName, pAtt.getValueClass(), jsonToUse);
            } else if (attribute instanceof DataSourceAttribute) {
                DataSourceAttribute dsAttribute = (DataSourceAttribute) attribute;
View Full Code Here

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

    }

    private void addAttributes(@Nonnull final Template template,
                               @Nonnull final Values dataSourceValue) throws JSONException {
        dataSourceValue.populateFromAttributes(template, this.parser, this.attributes,
                new PJsonObject(new JSONObject(), "DataSourceProcessorAttributes"));
    }
View Full Code Here

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

        try {
            jsonSpec = new JSONObject(spec);
        } catch (JSONException e) {
            throw new RuntimeException("Cannot parse the spec file", e);
        }
        return new PJsonObject(jsonSpec, "spec");
    }
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.