Package org.mapfish.print.wrapper

Examples of org.mapfish.print.wrapper.PArray


     */
    @SuppressWarnings("unchecked")
    public DataSourceAttributeValue parseAttribute(@Nonnull final MapfishParser parser,
                                                   @Nonnull final Template template,
                                                   @Nullable final PArray jsonValue) throws JSONException {
        final PArray pValue;

        if (jsonValue != null) {
            pValue = jsonValue;
        } else {
            pValue = this.defaults;
        }

        if (pValue == null) {
            throw new PrintException("Missing required attribute: " + this.configName);
        }

        final DataSourceAttributeValue value = new DataSourceAttributeValue();
        value.attributesValues = new Map[pValue.size()];
        for (int i = 0; i < pValue.size(); i++) {
            PObject rowData = pValue.getObject(i);
            final Values valuesForParsing = new Values();
            valuesForParsing.populateFromAttributes(template, parser, this.attributes, rowData);
            value.attributesValues[i] = valuesForParsing.asMap();
        }

View Full Code Here


    }

    @Override
    public final PArray optArray(final String key) {
        for (PObject obj : this.objs) {
            PArray result = obj.optArray(key);
            if (result != null) {
                return result;
            }
        }
            return null;
View Full Code Here

                value = new URL(layer.getString(name));
            } catch (MalformedURLException e) {
                throw ExceptionUtils.getRuntimeException(e);
            }
        } else if (type.isArray()) {
            final PArray array = layer.getArray(name);
            value = Array.newInstance(type.getComponentType(), array.size());

            for (int i = 0; i < array.size(); i++) {
                Object arrayValue = parseArrayValue(errorOnExtraProperties, extraPropertyToIgnore, type.getComponentType(), i, array);
                if (arrayValue == null) {
                    throw new IllegalArgumentException("Arrays cannot have null values in them.  Error found with: " + array +
                                                       " when being converted to a " + type.getComponentType());
                }
View Full Code Here

            while (keys.hasNext()) {
                List<String> valuesAsList = Lists.newArrayList();

                String headerName = keys.next();
                final PArray values = this.requestHeaders.optArray(headerName);
                if (values != null) {
                    for (int i = 0; i < values.size(); i++) {
                        valuesAsList.add(values.getString(i));
                    }
                } else {
                    valuesAsList.add(this.requestHeaders.getString(headerName));
                }
View Full Code Here

        }
        return mapProcessor;
    }

    private static PObject getOldMapPage(final PJsonObject oldRequest) {
        final PArray pages = oldRequest.getArray("pages");

        PObject mapPage = null;
        for (int i = 0; i < pages.size(); i++) {
            final PObject page = pages.getObject(i);

            if (isMapPage(page)) {
                if (mapPage == null) {
                    mapPage = page;
                } else {
View Full Code Here

        if (!oldRequest.has("layers")) {
            return;
        }

        PArray oldLayers = oldRequest.getArray("layers");
        for (int i = oldLayers.size() - 1; i > -1; i--) {
            PJsonObject oldLayer = (PJsonObject) oldLayers.getObject(i);
            layers.put(OldAPILayerConverter.convert(oldLayer));
        }
    }
View Full Code Here

        }
        return tableProcessor;
    }

    private static PObject getOldTablePage(final PJsonObject oldRequest) {
        final PArray pages = oldRequest.getArray("pages");

        PObject tablePage = null;
        for (int i = 0; i < pages.size(); i++) {
            final PObject page = pages.getObject(i);

            if (isTablePage(page)) {
                if (tablePage == null) {
                    tablePage = page;
                } else {
View Full Code Here

    private static List<String> getTableColumnKeys(final PJsonObject oldTablePage) {
        final PJsonObject table = oldTablePage.optJSONObject("table");
        final List<String> columnKeys = new LinkedList<String>();
        if (table != null) {
            final PArray columns = table.optArray("columns", new PJsonArray(table, new JSONArray(), "columns"));

            for (int i = 0; i < columns.size(); i++) {
                columnKeys.add(columns.getString(i));
            }
        }

        return columnKeys;
    }
View Full Code Here

            final PJsonObject oldTablePage) {
        final PJsonObject table = oldTablePage.optJSONObject("table");

        final List<JSONArray> tableData = new LinkedList<JSONArray>();
        if (table != null) {
            final PArray oldTableRows = table.optArray("data", new PJsonArray(table, new JSONArray(), "data"));

            for (int i = 0; i < oldTableRows.size(); i++) {
                final PObject oldRow = oldTableRows.getObject(i);
                if (!oldRow.keys().hasNext()) {
                    // row is empty, skip
                    continue;
                }
View Full Code Here

        if (objectParams != null) {
            Iterator<String> customParamsIter = objectParams.keys();
            while (customParamsIter.hasNext()) {
                String key = customParamsIter.next();
                if (objectParams.isArray(key)) {
                    final PArray array = objectParams.optArray(key);
                    for (int i = 0; i < array.size(); i++) {
                        params.put(key, array.getString(i));
                    }
                } else {
                    params.put(key, objectParams.optString(key, ""));
                }
            }
View Full Code Here

TOP

Related Classes of org.mapfish.print.wrapper.PArray

Copyright © 2018 www.massapicom. 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.