Examples of AppService


Examples of org.joget.apps.app.service.AppService

            String appVersion = request.getParameter("appVersion");
            try {
                JSONArray jsonArray = new JSONArray();

                ApplicationContext ac = AppUtil.getApplicationContext();
                AppService appService = (AppService) ac.getBean("appService");
                WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");
                AppDefinition appDef = appService.getAppDefinition(appId, appVersion);
                PackageDefinition packageDefinition = appDef.getPackageDefinition();
                Long packageVersion = (packageDefinition != null) ? packageDefinition.getVersion() : new Long(1);
                Collection<WorkflowProcess> processList = workflowManager.getProcessList(appId, packageVersion.toString());

                Map<String, String> empty = new HashMap<String, String>();
View Full Code Here

Examples of org.joget.apps.app.service.AppService

                data.addFormError(id, errorMsg);
            } else {
                //check for duplicate value
                AppDefinition appDef = AppUtil.getCurrentAppDefinition();
                String tableName = null;
                AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService");

                if (formDefId != null) {
                    tableName = appService.getFormTableName(appDef, formDefId);
                }
                if (isDuplicate(formDefId, tableName, element, data, fieldId, values)) {
                    result = false;
                    data.addFormError(id, pm.getMessage("form.duplicatevaluevalidator.e.valueAlreadyExist", this.getClassName(), null));
                }
View Full Code Here

Examples of org.joget.apps.app.service.AppService

            }
            final Map<String, String> replace = replaceMap;
                   
            String appId = auditTrail.getAppId();
            String appVersion = auditTrail.getAppVersion();
            AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService");
            final AppDefinition appDef = appService.getAppDefinition(appId, appVersion);

            if (smtpHost == null || smtpHost.trim().length() == 0) {
                return null;
            }
View Full Code Here

Examples of org.joget.apps.app.service.AppService

       
        String action = request.getParameter("action");
        String appId = request.getParameter("appId");
        String appVersion = request.getParameter("appVersion");
        ApplicationContext ac = AppUtil.getApplicationContext();
        AppService appService = (AppService) ac.getBean("appService");
        WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");
        AppDefinition appDef = appService.getAppDefinition(appId, appVersion);

        if ("getActivities".equals(action)) {
            try {
                JSONArray jsonArray = new JSONArray();
                PackageDefinition packageDefinition = appDef.getPackageDefinition();
View Full Code Here

Examples of org.joget.apps.app.service.AppService

    protected void storeToForm(WorkflowAssignment wfAssignment, Map properties, Map object) {
        String formDefId = (String) properties.get("formDefId");
        if (formDefId != null && formDefId.trim().length() > 0) {
            ApplicationContext ac = AppUtil.getApplicationContext();
            AppService appService = (AppService) ac.getBean("appService");
            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

Examples of org.joget.apps.app.service.AppService

        final Map<String, Object> result = new HashMap<String, Object>();
       
        // get service and DAO objects
        ApplicationContext ac = AppUtil.getApplicationContext();
        AppService appService = (AppService)ac.getBean("appService");
        final FormService formService = (FormService)ac.getBean("formService");
        final FormDefinitionDao formDefinitionDao = (FormDefinitionDao)ac.getBean("formDefinitionDao");
        final AppDefinition appDef = appService.getAppDefinition(appId, appVersion);
       
        if (appDef != null && formDefId != null && !formDefId.isEmpty() && primaryKeyValue != null) {
            formDefinitionDao.getHibernateTemplate().execute(new HibernateCallback() {
                @SuppressWarnings("unchecked")
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
View Full Code Here

Examples of org.joget.apps.app.service.AppService

    protected PackageActivityForm retrieveAssignmentForm(FormData formData, WorkflowAssignment assignment) {
        String activityId = assignment.getActivityId();
        String formUrl = getUrl() + "?_action=submit&activityId=" + activityId;
        AppDefinition appDef = AppUtil.getCurrentAppDefinition();
        ApplicationContext ac = AppUtil.getApplicationContext();
        AppService appService = (AppService) ac.getBean("appService");
        FormService formService = (FormService) ac.getBean("formService");
       
        formData = formService.retrieveFormDataFromRequestMap(formData, getRequestParameters());
       
        PackageActivityForm activityForm = appService.viewAssignmentForm(appDef, assignment, formData, formUrl);
        return activityForm;
    }
View Full Code Here

Examples of org.joget.apps.app.service.AppService

     * @return
     */
    protected Form retrieveDataForm(FormData formData, String primaryKeyValue) {
        Form form = null;
        ApplicationContext ac = AppUtil.getApplicationContext();
        AppService appService = (AppService) ac.getBean("appService");
        FormService formService = (FormService) ac.getBean("formService");
        AppDefinition appDef = AppUtil.getCurrentAppDefinition();
        String formId = getPropertyString("formId");

        formData = formService.retrieveFormDataFromRequestMap(formData, getRequestParameters());

        //if primary key is null, look up for primary key using userview key
        if (primaryKeyValue == null && getPropertyString("keyName") != null && (getPropertyString("loadDataWithKey") != null && "Yes".equalsIgnoreCase(getPropertyString("loadDataWithKey"))) && getPropertyString("keyName").trim().length() > 0 && getKey() != null) {
            if (FormUtil.PROPERTY_ID.equals(getPropertyString("keyName"))) {
                primaryKeyValue = getKey();
            } else {
                primaryKeyValue = appService.getPrimaryKeyWithForeignKey(appDef.getId(), appDef.getVersion().toString(), formId, getPropertyString("keyName"), getKey());
            }
        }
        // set primary key
        formData.setPrimaryKeyValue(primaryKeyValue);

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

        // retrieve form
        String formUrl = getUrl() + "?_action=submit";
        if (primaryKeyValue != null) {
            try {
                formUrl += "&" + FormUtil.PROPERTY_ID + "=" + URLEncoder.encode(primaryKeyValue, "UTF-8");
            } catch (UnsupportedEncodingException ex) {
                // ignore
            }
        }

        String submitLabel = "Submit";

        if (getPropertyString("submitButtonLabel") != null && getPropertyString("submitButtonLabel").trim().length() > 0) {
            submitLabel = getPropertyString("submitButtonLabel");
        }

        String cancelUrl = getPropertyString("redirectUrlOnCancel");
        String cancelLabel = null;
        if (cancelUrl != null && !cancelUrl.isEmpty()) {
            if (getPropertyString("cancelButtonLabel") != null && getPropertyString("cancelButtonLabel").trim().length() > 0) {
                cancelLabel = getPropertyString("cancelButtonLabel");
            } else {
                cancelLabel = "Cancel";
            }
        }
       
        Boolean readonlyLabel = "true".equalsIgnoreCase(getPropertyString("readonlyLabel"));

        form = appService.viewDataForm(appDef.getId(), appDef.getVersion().toString(), formId, null, submitLabel, cancelLabel, getPropertyString("redirectTargetOnCancel"), formData, formUrl, cancelUrl);
        if (form != null) {

            // make primary key read-only
            Element el = FormUtil.findElement(FormUtil.PROPERTY_ID, form, formData);
            if (el != null) {
View Full Code Here

Examples of org.joget.apps.app.service.AppService

     * @param activityForm
     * @return
     */
    protected Form submitAssignmentForm(FormData formData, WorkflowAssignment assignment, PackageActivityForm activityForm) {
        ApplicationContext ac = AppUtil.getApplicationContext();
        AppService appService = (AppService) ac.getBean("appService");
        FormService formService = (FormService) ac.getBean("formService");
        WorkflowManager workflowManager = (WorkflowManager) ac.getBean("workflowManager");
        String activityId = assignment.getActivityId();
        String processId = assignment.getProcessId();
       
        // get form
        Form currentForm = activityForm.getForm();

        // submit form
        formData = formService.executeFormActions(currentForm, formData);

        if (formData.getFormResult(AssignmentWithdrawButton.DEFAULT_ID) != null) {
            // withdraw assignment
            workflowManager.assignmentWithdraw(activityId);
        } else if (formData.getFormResult(AssignmentCompleteButton.DEFAULT_ID) != null) {
            // complete assignment
            Map<String, String> variableMap = AppUtil.retrieveVariableDataFromMap(getRequestParameters());
            formData = appService.completeAssignmentForm(currentForm, assignment, formData, variableMap);

            Map<String, String> errors = formData.getFormErrors();
           
            setProperty("submitted", Boolean.TRUE);
            if (!formData.getStay() && errors.isEmpty() && activityForm.isAutoContinue()) {
View Full Code Here

Examples of org.joget.apps.app.service.AppService

            Object[] fields = null;
            if (properties.get("fields") instanceof Object[]){
                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
TOP
Copyright © 2018 www.massapi.com. 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.