Package org.joget.apps.form.dao

Examples of org.joget.apps.form.dao.FormDataDao


                ApplicationContext ac = AppUtil.getApplicationContext();
                AppService appService = (AppService) ac.getBean("appService");
                if (formDefId != null) {
                    String tableName = appService.getFormTableName(appDef, formDefId);

                    FormDataDao dao = (FormDataDao) ac.getBean("formDataDao");

                    FormRow formRow = dao.load(formDefId, tableName, value.toString());

                    if (formRow != null && formRow.getCustomProperties() != null && formRow.getCustomProperties().get(field) != null) {
                        value = formRow.getCustomProperties().get(field);
                    }
                }
View Full Code Here


           
        if (rowKeys != null && rowKeys.length > 0) {
            String formDefId = getPropertyString("formDefId");
            String tableName = getSelectedFormTableName(formDefId);
            if (tableName != null) {
                FormDataDao formDataDao = (FormDataDao) FormUtil.getApplicationContext().getBean("formDataDao");
                formDataDao.delete(formDefId, tableName, rowKeys);

                result = new DataListActionResult();
                result.setType(DataListActionResult.TYPE_REDIRECT);
                result.setUrl("REFERER");
            }
View Full Code Here

        List<DataListColumn> columns = new ArrayList<DataListColumn>();

        // retrieve columns
        Form form = getSelectedForm();
        if (form != null) {
            FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
            String tableName = formDataDao.getFormTableName(form);
            Collection<String> columnNames = formDataDao.getFormDefinitionColumnNames(tableName);
            for (String columnName : columnNames) {
                Element element = FormUtil.findElement(columnName, form, null, true);
                if (element != null && !(element instanceof FormContainer)) {
                    if (!(element instanceof PasswordField)) {
                        String id = element.getPropertyString(FormUtil.PROPERTY_ID);
View Full Code Here

    public DataListCollection getData(DataList dataList, Map properties, DataListFilterQueryObject[] filterQueryObjects, String sort, Boolean desc, Integer start, Integer rows) {
        DataListCollection resultList = new DataListCollection();

        Form form = getSelectedForm();
        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

    @Override
    public int getDataTotalRowCount(DataList dataList, Map properties, DataListFilterQueryObject[] filterQueryObjects) {
        int count = 0;
        Form form = getSelectedForm();
        if (form != null) {
            FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
            DataListFilterQueryObject criteria = getCriteria(properties, filterQueryObjects);

            Long rowCount = formDataDao.count(form, criteria.getQuery(), criteria.getValues());
            count = rowCount.intValue();
        }
        return count;
    }
View Full Code Here

    @Override
    public String getColumnName(String name) {
        if (name != null && !name.isEmpty() && !FormUtil.PROPERTY_ID.equals(name)) {
            Form form = getSelectedForm();
           
            FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
            Collection<String> columnNames = formDataDao.getFormDefinitionColumnNames(form.getPropertyString(FormUtil.PROPERTY_TABLE_NAME));
            if (columnNames.contains(name)) {
                name = FormUtil.PROPERTY_CUSTOM_PROPERTIES + "." + name;
            } else if (FormUtil.PROPERTY_DATE_CREATED.equals(name) || FormUtil.PROPERTY_DATE_MODIFIED.equals(name)) {
                name = "cast(" + name + " as string)";
            }
View Full Code Here

        return result;
    }

    protected boolean isDuplicate(String formDefId, String tableName, Element element, FormData formData, String fieldId, String[] values) {
        boolean result = false;
        FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");

        if (values != null && values.length > 0 && FormUtil.isElementPropertyValuesChanges(element, formData, values)) {
            for (String val : values) {
                String key = null;

                if (!FormUtil.PROPERTY_ID.equals(fieldId)) {
                    try {
                        key = formDataDao.findPrimaryKey(formDefId, tableName, fieldId, val);
                    } catch (Exception e) {
                        key = null;
                    }
                } else {
                    if (formDataDao.load(formDefId, tableName, val) != null) {
                        key = val;
                    }
                }
                if (key != null && key.trim().length() > 0) {
                    result = true;
View Full Code Here

        WorkflowAssignment wfAssignment = (WorkflowAssignment) this.getProperty("workflowAssignment");
        if ((primaryKey != null && !primaryKey.isEmpty()) || wfAssignment != null) {
            try {
                if (tableName != null && tableName.length() != 0) {
                    ApplicationContext appContext = AppUtil.getApplicationContext();
                    FormDataDao formDataDao = (FormDataDao) appContext.getBean("formDataDao");

                    if (primaryKey == null && wfAssignment != null) {

                        WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
                        WorkflowProcessLink link = workflowManager.getWorkflowProcessLink(wfAssignment.getProcessId());

                        if (link != null) {
                            primaryKey = link.getOriginProcessId();
                        } else if (primaryKey == null) {
                            primaryKey = wfAssignment.getProcessId();
                        }
                    }

                    String cacheKey = tableName + "##" + primaryKey;
                    FormRow row = formDataCache.get(cacheKey);
                    if (row == null) {       
                        row = formDataDao.loadByTableNameAndColumnName(tableName, columnName, primaryKey);
                        formDataCache.put(cacheKey, row);
                    }

                    if (row != null && row.getCustomProperties() != null) {
                        Object val = row.getCustomProperties().get(columnName);
View Full Code Here

                }

                String labelColumn = (String) getProperty("labelColumn");

                // get form data
                FormDataDao formDataDao = (FormDataDao) AppUtil.getApplicationContext().getBean("formDataDao");
                results = formDataDao.find(formDefId, tableName, condition, conditionParams, labelColumn, false, null, null);

                if (results != null) {
                    if ("true".equals(getPropertyString("addEmptyOption"))) {
                        FormRow emptyRow = new FormRow();
                        emptyRow.setProperty(FormUtil.PROPERTY_VALUE, "");
View Full Code Here

TOP

Related Classes of org.joget.apps.form.dao.FormDataDao

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.