Package org.joget.apps.form.model

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


        // get origin process id
        String originProcessId = getOriginProcessId(processId);

        // get mapped form
        if (formData == null) {
            formData = new FormData();
        }
        formData.setActivityId(activityId);
        formData.setProcessId(processId);
        formData.setPrimaryKeyValue(originProcessId);
       
View Full Code Here


    }
   
    @Override
    public FormData completeAssignmentForm(Form form, WorkflowAssignment assignment, FormData formData, Map<String, String> workflowVariableMap) {
        if (formData == null) {
            formData = new FormData();
        }

        // get assignment
        String activityId = assignment.getActivityId();
        String processId = assignment.getProcessId();
View Full Code Here

     * @return
     */
    @Override
    public FormData completeAssignmentForm(String appId, String version, String activityId, FormData formData, Map<String, String> workflowVariableMap) {
        if (formData == null) {
            formData = new FormData();
        }

        // get assignment
        WorkflowAssignment assignment = workflowManager.getAssignment(activityId);
        String processId = assignment.getProcessId();
View Full Code Here

     */
    @Override
    public WorkflowProcessResult submitFormToStartProcess(String appId, String version, String processDefId, FormData formData, Map<String, String> workflowVariableMap, String originProcessId, String formUrl) {
        WorkflowProcessResult result = null;
        if (formData == null) {
            formData = new FormData();
        }

        AppDefinition appDef = getAppDefinition(appId, version);
        PackageDefinition packageDef = appDef.getPackageDefinition();
        String processDefIdWithVersion = AppUtil.getProcessDefIdWithVersion(packageDef.getId(), packageDef.getVersion().toString(), processDefId);

        // get form
        PackageActivityForm startFormDef = viewStartProcessForm(appId, appDef.getVersion().toString(), processDefId, formData, formUrl);
        if (startFormDef != null && startFormDef.getForm() != null) {
            Form startForm = startFormDef.getForm();

            FormData formResult = formService.executeFormActions(startForm, formData);
            if (formResult.getFormResult(AssignmentCompleteButton.DEFAULT_ID) != null) {
                // validate form
                formData = FormUtil.executeElementFormatDataForValidation(startForm, formData);
                formResult = formService.validateFormData(startForm, formData);

                Map<String, String> errors = formResult.getFormErrors();
                if (!formResult.getStay() && (errors == null || errors.isEmpty())) {
                    if (originProcessId == null && formResult.getRequestParameter(FormUtil.FORM_META_ORIGINAL_ID) != null && !formResult.getRequestParameter(FormUtil.FORM_META_ORIGINAL_ID).isEmpty()) {
                        originProcessId = formResult.getRequestParameter(FormUtil.FORM_META_ORIGINAL_ID);
                    } else if (startForm.getPrimaryKeyValue(formResult) != null) {
                        originProcessId = startForm.getPrimaryKeyValue(formResult);
                    }

                    // start process
                    result = workflowManager.processStart(processDefIdWithVersion, null, workflowVariableMap, null, originProcessId, true);
                    String processId = result.getProcess().getInstanceId();
                    String originId = (originProcessId != null && originProcessId.trim().length() > 0) ? originProcessId : processId;
                    originId = getOriginProcessId(originId);

                    // set primary key
                    formResult.setPrimaryKeyValue(originId);
                    formResult.setProcessId(processId);

                    // submit form
                    formResult = formService.submitForm(startForm, formResult, true);
                    errors = formResult.getFormErrors();
                    if (!formResult.getStay() && (errors == null || errors.isEmpty())) {
                        result = workflowManager.processStartWithInstanceId(processDefIdWithVersion, processId, workflowVariableMap);

                        // set next activity if configured
                        boolean autoContinue = (startFormDef != null) && startFormDef.isAutoContinue();
                        if (!autoContinue) {
View Full Code Here

    @Override
    public Form viewDataForm(String appId, String version, String formDefId, String saveButtonLabel, String submitButtonLabel, String cancelButtonLabel, String cancelButtonTarget, FormData formData, String formUrl, String cancelUrl) {
        AppDefinition appDef = getAppDefinition(appId, version);

        if (formData == null) {
            formData = new FormData();
        }

        // get form
        Form form = loadFormByFormDefId(appDef.getId(), appDef.getVersion().toString(), formDefId, formData, null);
View Full Code Here

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

     * @param element
     * @param formData
     * @return
     */
    public static FormData executeActions(Form form, Element element, FormData formData) {
        FormData updatedFormData = formData;
        if (element == null) {
            element = form;
        }
        if (element instanceof FormAction) {
            FormAction action = (FormAction) element;
View Full Code Here

            formDefinitionDao.getHibernateTemplate().execute(new HibernateCallback() {
                @SuppressWarnings("unchecked")
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
                    // get root form
                    Form form = null;
                    FormData formData = new FormData();
                    formData.setPrimaryKeyValue(primaryKeyValue);
                    FormDefinition formDef = formDefinitionDao.loadById(formDefId, appDef);
                    if (formDef != null) {
                        String formJson = formDef.getJson();
                        if (formJson != null) {
                            formJson = AppUtil.processHashVariable(formJson, assignment, StringUtil.TYPE_JSON, null);
View Full Code Here

    }

    @Override
    public FormData actionPerformed(Form form, FormData formData) {
        FormService formService = (FormService) FormUtil.getApplicationContext().getBean("formService");
        FormData updatedFormData = formService.submitForm(form, formData, true);
        return updatedFormData;
    }
View Full Code Here

        setProperty("process", process);

        if (isUnauthorized(process.getId())) {
            // check for start mapped form
            String formUrl = getUrl() + "?_action=start";
            FormData formData = new FormData();
            formData = formService.retrieveFormDataFromRequestMap(formData, getRequestParameters());

            String primaryKey = getRequestParameterString("recordId");
            if (primaryKey != null && primaryKey.trim().length() > 0) {
                formData.setPrimaryKeyValue(primaryKey);
            }

            if (getPropertyString("keyName") != null && getPropertyString("keyName").trim().length() > 0 && getKey() != null) {
                formData.addRequestParameterValues(getPropertyString("keyName"), new String[]{getKey()});
            }

            PackageActivityForm startFormDef = appService.viewStartProcessForm(getRequestParameterString("appId"), getRequestParameterString("appVersion"), getPropertyString("processDefId"), formData, formUrl);
            if (startFormDef != null && (startFormDef.getForm() != null || PackageActivityForm.ACTIVITY_FORM_TYPE_EXTERNAL.equals(startFormDef.getType()))) {
                Form startForm = startFormDef.getForm();
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.