Package org.joget.apps.form.model

Examples of org.joget.apps.form.model.FormData


     * @return
     */
    public FormData executeFormOptionsBinders(Element element, FormData formData) {
        // create new form data if necessary
        if (formData == null) {
            formData = new FormData();
        }

        // find and call all option binders in the form
        formData = FormUtil.executeOptionBinders(element, formData);
        return formData;
View Full Code Here


     * @return
     */
    public FormData executeFormLoadBinders(Element element, FormData formData) {
        // create new form data if necessary
        if (formData == null) {
            formData = new FormData();
        }

        // find and call all option binders in the form
        formData = FormUtil.executeLoadBinders(element, formData);
        return formData;
View Full Code Here

    public String retrieveFormHtml(Form form, FormData formData) {
        String formHtml = null;
        if (form != null) {
            if (formData == null) {
                formData = new FormData();
            }
            formHtml = generateElementHtml(form, formData);
        }
        return formHtml;
    }
View Full Code Here

    public String retrieveFormErrorHtml(Form form, FormData formData) {
        String formHtml = null;
        if (form != null) {
            if (formData == null) {
                formData = new FormData();
            }
            formHtml = generateElementErrorHtml(form, formData);
        }
        return formHtml;
    }
View Full Code Here

        WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");

        Form form = null;
        WorkflowAssignment assignment = null;
        PackageActivityForm activityForm = null;
        FormData formData = new FormData();

        // get assignment by activity ID if available
        if (activityId != null && !activityId.trim().isEmpty()) {
            assignment = workflowManager.getAssignment(activityId);
        }
View Full Code Here

        FormService formService = (FormService) ac.getBean("formService");
        WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");

        Form form = null;
        WorkflowAssignment assignment = null;
        FormData formData = new FormData();

        // get assignment by activity ID if available
        if (activityId != null && !activityId.trim().isEmpty()) {
            assignment = workflowManager.getAssignment(activityId);
        }

        if (assignment != null) {
            // load assignment form
            PackageActivityForm activityForm = retrieveAssignmentForm(formData, assignment);

            // submit assignment form
            form = submitAssignmentForm(formData, assignment, activityForm);
        }

        if (form != null) {
            // generate form HTML
            String formHtml = null;

            // check for validation errors
            Map<String, String> errors = formData.getFormErrors();
            int errorCount = 0;
            if (!formData.getStay() && errors == null || errors.isEmpty()) {
                // render normal template
                formHtml = formService.generateElementHtml(form, formData);
            } else {
                // render error template
                formHtml = formService.generateElementErrorHtml(form, formData);
                errorCount = errors.size();
            }
           
            if (formData.getStay()) {
                setAlertMessage("");
                setRedirectUrl("");
            }

            // show form
            String formJson = formService.generateElementJson(form);
            setProperty("view", "formView");
            setProperty("stay", formData.getStay());
            setProperty("submitted", Boolean.TRUE);
            setProperty("errorCount", errorCount);
            setProperty("formHtml", formHtml);
            setProperty("formJson", formJson);
            if (assignment != null) {
View Full Code Here

        WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");

        Form form = null;
        WorkflowAssignment assignment = null;
        PackageActivityForm activityForm = null;
        FormData formData = new FormData();

        // get assignment by activity ID if available
        if (activityId != null && !activityId.trim().isEmpty()) {
            assignment = workflowManager.getAssignment(activityId);
        }
View Full Code Here

        FormService formService = (FormService) ac.getBean("formService");
        WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");

        Form form = null;
        WorkflowAssignment assignment = null;
        FormData formData = new FormData();

        // get assignment by activity ID if available
        if (activityId != null && !activityId.trim().isEmpty()) {
            assignment = workflowManager.getAssignment(activityId);
        }
        if (assignment == null) {
            // assignment not available, attempt to load assignment by process ID
            assignment = workflowManager.getAssignmentByProcess(processId);
        }
        if (assignment != null) {
            // load assignment form
            PackageActivityForm activityForm = retrieveAssignmentForm(formData, assignment);

            // submit assignment form
            form = submitAssignmentForm(formData, assignment, activityForm);
        } else {
            // load data form
            form = retrieveDataForm(formData, id);

            // submit data form
            form = submitDataForm(formData, form);
        }

        // determine redirect URL
        String redirectUrl = getPropertyString("redirectUrlAfterComplete");

        if (redirectUrl != null && redirectUrl.trim().length() > 0 && getPropertyString("fieldPassover") != null && getPropertyString("fieldPassover").trim().length() > 0) {
            String passoverFieldName = getPropertyString("fieldPassover");
            Element passoverElement = FormUtil.findElement(passoverFieldName, form, formData);
           
            String passoverValue = "";
           
            if (passoverElement != null) {
                passoverValue = FormUtil.getElementPropertyValue(passoverElement, formData);
            } else if (FormUtil.PROPERTY_ID.equals(passoverFieldName)) {
                passoverValue = formData.getPrimaryKeyValue();
            }
           
            if ("append".equals(getPropertyString("fieldPassoverMethod"))) {
                if (!redirectUrl.endsWith("/")) {
                    redirectUrl += "/";
                }
                redirectUrl += passoverValue;
            } else {
                if (redirectUrl.contains("?")) {
                    redirectUrl += "&";
                } else {
                    redirectUrl += "?";
                }
                redirectUrl += getPropertyString("paramName") + "=" + passoverValue;
            }
        }

        if (form != null) {
            // generate form HTML
            String formHtml = null;

            // check for validation errors
            Map<String, String> errors = formData.getFormErrors();
            int errorCount = 0;
            if (!formData.getStay() && errors == null || errors.isEmpty()) {
                // render normal template
                formHtml = formService.generateElementHtml(form, formData);
                setAlertMessage(getPropertyString("messageShowAfterComplete"));
                boolean redirectToParent = "Yes".equals(getPropertyString("showInPopupDialog"));
                setRedirectUrl(redirectUrl, redirectToParent);
            } else {
                // render error template
                formHtml = formService.generateElementErrorHtml(form, formData);
                errorCount = errors.size();
            }
           
            if (formData.getStay()) {
                setAlertMessage("");
                setRedirectUrl("");
            }

            // show form
            String formJson = formService.generateElementJson(form);
            setProperty("view", "formView");
            setProperty("errorCount", errorCount);
            setProperty("stay", formData.getStay());
            setProperty("submitted", Boolean.TRUE);
            setProperty("formHtml", formHtml);
            setProperty("formJson", formJson);
            setProperty("redirectUrlAfterComplete", redirectUrl);
            if (assignment != null) {
View Full Code Here

                fields = (Object[]) properties.get("fields");
            }
            if (formDefId != null && !formDefId.isEmpty() && fields != null && fields.length > 0) {
                AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService");
               
                FormData formData = new FormData();
                String primaryKey = appService.getOriginProcessId(wfAssignment.getProcessId());
                formData.setPrimaryKeyValue(primaryKey);
                Form loadForm = appService.viewDataForm(appDef.getId(), appDef.getVersion().toString(), formDefId, null, null, null, formData, null, null);
               
                for (Object o : fields) {
                    Map mapping = (HashMap) o;
                    String fieldId = mapping.get("field").toString();
View Full Code Here

     * @param formData
     * @return
     */
    public static FormData executeOptionBinders(Element element, FormData formData) {
        if (formData == null) {
            formData = new FormData();
        }
        FormLoadBinder binder = (FormLoadBinder) element.getOptionsBinder();
        String primaryKeyValue = (formData != null) ? element.getPrimaryKeyValue(formData) : null;
        if (binder != null && !isAjaxOptionsSupported(element, formData)) {
            FormRowSet data = binder.load(element, primaryKeyValue, formData);
View Full Code Here

TOP

Related Classes of org.joget.apps.form.model.FormData

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.