Package org.joget.apps.form.model

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


        if (form != null) {
            FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");

            DataListFilterQueryObject criteria = getCriteria(properties, filterQueryObjects);

            FormRowSet rowSet = formDataDao.find(form, criteria.getQuery(), criteria.getValues(), sort, desc, start, rows);
            resultList.addAll(rowSet);
        }

        return resultList;
    }
View Full Code Here


            String state = "state";
            FormRow row = new FormRow();
            row.setId(id);
            row.setProperty("name", name);
            row.setProperty("state", state);
            FormRowSet rowSet = new FormRowSet();
            rowSet.add(row);
            appService.storeFormData(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_ID, rowSet, null);

            // load single row data
            FormRowSet loadedRowSet = appService.loadFormData(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_ID, id);
            FormRow loadedRow = loadedRowSet.get(0);
            assertTrue(name.equals(loadedRow.getProperty("name")));
           
            // store updated row data using request
            String updatedName = "updated name";
            String updatedState = "updated state";
            FormData formData = new FormData();
            formData.setPrimaryKeyValue(id);
            formData.addRequestParameterValues("name", new String[] { updatedName });
            formData.addRequestParameterValues("state", new String[] { updatedState });
            appService.submitForm(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_ID, formData, false);

            // load updated row data
            loadedRowSet = appService.loadFormData(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_ID, id);
            loadedRow = loadedRowSet.get(0);
            assertTrue(updatedName.equals(loadedRow.getProperty("name")) && updatedState.equals(loadedRow.getProperty("state")));
        } finally {
            // delete form data
            formDataDao.delete(TEST_FORM_ID, TEST_FORM_ID, new String[]{"row1"});
View Full Code Here

            // submit form
            appService.submitForm(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_D, data, true);

            // load and verify data for form D
            FormRowSet rowSetD = appService.loadFormData(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_D, valueD);
            FormRow rowD = rowSetD.iterator().next();
            boolean verifyD = valueD.equals(rowD.get("id")) && valueD.equals(rowD.get("d1")) && valueD.equals(rowD.get("d2"));
            dId = rowD.get("id").toString();
               
            // load and verify data for form C
            String generatedIdForC = (String) rowD.get("cid");
            FormRowSet rowSetC = appService.loadFormData(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_C, generatedIdForC);
            FormRow rowC = rowSetC.iterator().next();
            boolean verifyC = generatedIdForC.equals(rowC.get("id")) && valueC.equals(rowC.get("c1")) && generatedIdForC.equals(rowD.get("cid"));
            cId = rowC.get("id").toString();
           
            // load and verify data for form A
            String generatedIdForA = (String) rowC.get("aid");
            FormRowSet rowSetA = appService.loadFormData(TEST_APP_ID, TEST_APP_VERSION.toString(), TEST_FORM_A, generatedIdForA);
            FormRow rowA = rowSetA.iterator().next();
            boolean verifyA = generatedIdForA.equals(rowA.get("id")) && valueA.equals(rowA.get("a1")) && generatedIdForC.equals(rowA.get("bid"));
            aId = rowA.get("id").toString();
           
            // verify form data
            assertTrue(verifyA && verifyC && verifyD);
View Full Code Here

        return fieldNames;
    }

    @Override
    public FormRowSet formatData(FormData formData) {
        FormRowSet rowSet = null;
        FormRow result = null;

        String customHTML = (String) getProperty("value");

        if (customHTML != null && !customHTML.isEmpty()) {
            Pattern pattern = Pattern.compile("name=\\\"([a-zA-Z0-9_-]*)\\\"");
            Matcher matcher = pattern.matcher(customHTML);

            while (matcher.find()) {
                String name = matcher.group(1);

                //create dummy element object
                Element element = new TextField();
                element.setProperty("id", name);

                //get value from the formData
                String[] values = FormUtil.getElementPropertyValues(element, formData);
                if (values != null && values.length > 0) {
                    // check for empty submission via parameter
                    String[] paramValues = FormUtil.getRequestParameterValues(element, formData);
                    if (paramValues == null || paramValues.length == 0) {
                        values = new String[]{""};
                    }

                    // formulate values
                    String delimitedValue = FormUtil.generateElementPropertyValues(values);

                    if (rowSet == null) {
                        rowSet = new FormRowSet();
                        result = new FormRow();
                        rowSet.add(result);
                    }

                    // set value into Properties and FormRowSet object
                    result.setProperty(name, delimitedValue);
                }
View Full Code Here

            }

            //if store binder exist && element is not readonly, run it
            FormStoreBinder binder = element.getStoreBinder();
            if (!(element instanceof AbstractSubForm) && binder != null) {
                FormRowSet rowSet = formData.getStoreBinderData(element.getStoreBinder());

                // execute binder
                try {
                    FormRowSet binderResult = binder.store(element, rowSet, formData);
                    formData.setStoreBinderData(binder, binderResult);
                } catch (Exception e) {
                    String formId = FormUtil.getElementParameterName(form);
                    formData.addFormError(formId, "Error storing data: " + e.getMessage());
                    LogUtil.error(FormService.class.getName(), e, "Error executing store binder");
View Full Code Here

        String html = FormUtil.generateElementHtml(this, formData, template, dataModel);
        return html;
    }
   
    public FormRowSet formatData(FormData formData) {
        FormRowSet rowSet = null;

        // get value
        String id = getPropertyString(FormUtil.PROPERTY_ID);
        if (id != null) {
            String value = FormUtil.getElementPropertyValue(this, formData);
            if (value != null) {
               
                if ("true".equalsIgnoreCase(getPropertyString("encryption"))) {
                    value = SecurityUtil.encrypt(value);
                }
               
                // set value into Properties and FormRowSet object
                FormRow result = new FormRow();
                result.setProperty(id, value);
                rowSet = new FormRowSet();
                rowSet.add(result);
            }
        }

        return rowSet;
    }
View Full Code Here

        return "Radio Element";
    }

    @Override
    public FormRowSet formatData(FormData formData) {
        FormRowSet rowSet = null;

        // get value
        String id = getPropertyString(FormUtil.PROPERTY_ID);
        if (id != null) {
            String[] values = FormUtil.getElementPropertyValues(this, formData);
            if (values != null && values.length > 0) {
                // check for empty submission via parameter
                String[] paramValues = FormUtil.getRequestParameterValues(this, formData);
                if ((paramValues == null || paramValues.length == 0) && FormUtil.isFormSubmitted(this, formData)) {
                    values = new String[]{""};
                }

                // formulate values
                String delimitedValue = FormUtil.generateElementPropertyValues(values);

                // set value into Properties and FormRowSet object
                FormRow result = new FormRow();
                result.setProperty(id, delimitedValue);
                rowSet = new FormRowSet();
                rowSet.add(result);
            }
        }

        return rowSet;
    }
View Full Code Here

            AppDefinition appDef = (AppDefinition) properties.get("appDef");

            Object[] fieldMapping = (Object[]) properties.get("fieldMapping");
            String multirowBaseObjectName = (String) properties.get("multirowBaseObject");

            FormRowSet rowSet = new FormRowSet();

            if (multirowBaseObjectName != null && multirowBaseObjectName.trim().length() > 0) {
                Object[] baseObjectArray = (Object[]) getObjectFromMap(multirowBaseObjectName, object);
                if (baseObjectArray != null && baseObjectArray.length > 0) {
                    rowSet.setMultiRow(true);
                    for (int i = 0; i < baseObjectArray.length; i++) {
                        rowSet.add(getRow(wfAssignment, multirowBaseObjectName, i, fieldMapping, object));
                    }
                }
            } else {
                rowSet.add(getRow(wfAssignment, null, null, fieldMapping, object));
            }

            if (rowSet.size() > 0) {
                appService.storeFormData(appDef.getId(), appDef.getVersion().toString(), formDefId, rowSet, null);
            }
        }
    }
View Full Code Here

    }

    @Override
    public FormRowSet load(Element element, String primaryKey, FormData formData) {
        // load form data from DB
        FormRowSet rows = super.load(element, primaryKey, formData);
        if (rows != null) {
            FormRow row = null;
            if (rows.isEmpty()) {
                row = new FormRow();
                rows.add(row);
            } else {
                row = rows.iterator().next();
            }

            // handle workflow variables
            String activityId = formData.getActivityId();
            String processId = formData.getProcessId();
View Full Code Here

        return rows;
    }

    @Override
    public FormRowSet store(Element element, FormRowSet rows, FormData formData) {
        FormRowSet result = rows;
        if (rows != null && !rows.isEmpty()) {
            // store form data to DB
            result = super.store(element, rows, formData);

            // handle workflow variables
View Full Code Here

TOP

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

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.