Package com.adobe.acs.commons.forms

Examples of com.adobe.acs.commons.forms.Form


                    }
                }
            }
        }

        return this.clean(new Form(formName, request.getResource().getPath(), map));
    }
View Full Code Here


            if (!ArrayUtils.contains(FORM_INPUTS, entry.getKey()) && StringUtils.isNotBlank(entry.getValue())) {
                cleanedMap.put(entry.getKey(), entry.getValue());
            }
        }

        return new Form(form.getName(), form.getResourcePath(), cleanedMap, form.getErrors());
    }
View Full Code Here

     *
     * @param form
     * @return
     */
    protected final Form getProtectedForm(final Form form) {
        return new Form(form.getName(),
                form.getResourcePath(),
                this.getProtectedData(form.getData()),
                this.getProtectedErrors(form.getErrors()));
    }
View Full Code Here

            final Object obj = request.getAttribute(key);
            if (obj instanceof Form) {
                return this.getProtectedForm((Form) obj);
            } else {
                log.info("Unable to find Form in Request attribute: [ {} => {} ]", key, obj);
                return new Form(formName, request.getResource().getPath());
            }
        }
    }
View Full Code Here

            log.debug("Getting FORM [ {} ] from GET parameters", formName);
            return this.getGetForm(formName, request);
        }

        log.debug("Creating empty form for FORM [ {} ]", formName);
        return new Form(formName, request.getResource().getPath());
    }
View Full Code Here

        // Get the QP lookup for this form
        final String requestData = this.decode(request.getParameter(this.getGetLookupKey(formName)));

        if (StringUtils.isBlank(requestData)) {
            return new Form(formName, request.getResource().getPath());
        }

        try {
            final JSONObject jsonData = new JSONObject(requestData);

            final String incomingFormName = jsonData.optString(KEY_FORM_NAME);

            // Double-check the form names; only inject matching forms
            if (StringUtils.equals(incomingFormName, formName)) {
                final JSONObject incomingJsonForm = jsonData.optJSONObject(KEY_FORM);
                if (incomingJsonForm != null) {
                    data = TypeUtil.toMap(incomingJsonForm, String.class);
                    log.debug("Form data: {}", data);
                }

                final JSONObject incomingJsonErrors = jsonData.optJSONObject(KEY_ERRORS);

                if (incomingJsonErrors != null) {
                    errors = TypeUtil.toMap(incomingJsonErrors, String.class);
                    log.debug("Form data: {}", errors);
                }
            }
        } catch (JSONException e) {
            log.warn("Cannot parse query parameters for request: {}", requestData);
            return new Form(formName, request.getResource().getPath());
        }

        return new Form(formName,
                request.getResource().getPath(),
                this.getProtectedData(data),
                this.getProtectedErrors(errors));
    }
View Full Code Here

TOP

Related Classes of com.adobe.acs.commons.forms.Form

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.