Package org.joget.apps.datalist.model

Examples of org.joget.apps.datalist.model.DataListBinder


     * Retrieve a binder by ID. For now the ID is the class name
     * @param id
     * @return
     */
    public DataListBinder getBinder(String id) {
        DataListBinder binder = null;
        try {
            String className = id;
            binder = (DataListBinder) pluginManager.getPlugin(className);
        } catch (Exception ex) {
            LogUtil.error(DataListService.class.getName(), ex, "");
View Full Code Here


            Collection<DataListColumn> columns = parseColumnsFromJsonObject(obj);
            DataListColumn[] temp = (DataListColumn[]) columns.toArray(new DataListColumn[columns.size()]);
            object.setColumns(temp);

            //set binder
            DataListBinder binder = parseBinderFromJsonObject(obj);
            object.setBinder(binder);

            //set actions
            Collection<DataListAction> actions = parseActionsFromJsonObject(obj);
            DataListAction[] temp2 = (DataListAction[]) actions.toArray(new DataListAction[actions.size()]);
View Full Code Here

    public static DataListBinder parseBinderFromJsonObject(JSONObject obj) throws JSONException, InstantiationException, IllegalAccessException {
        if (!obj.isNull(PROPERTY_BINDER)) {
            JSONObject binderObj = obj.getJSONObject(PROPERTY_BINDER);
            if (binderObj.has(PROPERTY_CLASS_NAME)) {
                String className = binderObj.getString(PROPERTY_CLASS_NAME);
                DataListBinder dataListBinder = (DataListBinder) loadPlugin(className);
                if (dataListBinder != null) {
                    dataListBinder.setProperties(PropertyUtil.getPropertiesValueFromJson(binderObj.getJSONObject(PROPERTY_PROPERTIES).toString()));
                    return dataListBinder;
                }
            }
        }
        return null;
View Full Code Here

        // parse JSON from request if available
        dataList = parseFromJsonParameter(map, dataList, id, request);

        // get binder from request
        DataListBinder binder = createDataListBinderFromRequestInternal(appDef, id, binderId, request);
        if (binder != null) {
            dataList.setBinder(binder);
        }

        DataListColumn[] sourceColumns = (binder != null) ? binder.getColumns() : new DataListColumn[0];
        // sort columns by label
        List<DataListColumn> binderColumnList = Arrays.asList(sourceColumns);
        Collections.sort(binderColumnList, new Comparator<DataListColumn>() {
View Full Code Here

        model.addAttribute("template", filter.getType().getTemplate(new DataList(), filter.getName(), filter.getLabel()));
        return "dbuilder/filterTmplate";
    }

    protected DataListBinder createDataListBinderFromRequestInternal(AppDefinition appDef, String datalistId, String binderId, HttpServletRequest request) {
        DataListBinder binder = null;
        if (binderId != null && binderId.trim().length() > 0) {
            // create binder
            binder = dataListService.getBinder(binderId);

            if (request != null) {
                // get request params
                Enumeration e = request.getParameterNames();
                while (e.hasMoreElements()) {
                    String paramName = (String) e.nextElement();
                    if (paramName.startsWith(PREFIX_BINDER_PROPERTY)) {
                        String[] paramValue = (String[]) request.getParameterValues(paramName);
                        String propName = paramName.substring(PREFIX_BINDER_PROPERTY.length());
                       
                        String value = CsvUtil.getDeliminatedString(paramValue);
                       
                        if (value.contains(SecurityUtil.ENVELOPE) || value.contains(PropertyUtil.PASSWORD_PROTECTED_VALUE)) {
                            DatalistDefinition datalist = datalistDefinitionDao.loadById(datalistId, appDef);
                           
                            if (datalist != null) {
                                value = PropertyUtil.propertiesJsonStoreProcessing(datalist.getJson(), value);
                            }
                        }
                       
                        binder.setProperty(propName, AppUtil.processHashVariable(value, null, null, null));
                    }
                }
            }
        }
        return binder;
View Full Code Here

TOP

Related Classes of org.joget.apps.datalist.model.DataListBinder

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.