Package org.joget.commons.spring.model

Examples of org.joget.commons.spring.model.Setting


        if (directoryManager != null && directoryManager.getDirectoryManagerImpl() != null
            && directoryManager.getCustomDirectoryManagerClassName() != null) {
           
            SetupManager setupManager = (SetupManager) appContext.getBean("setupManager");
            if (setupManager != null) {
                Setting setting = setupManager.getSettingByProperty("directoryManagerImpl");
                if (setting != null && setting.getValue() != null && !setting.getValue().isEmpty()) {
                    if (setting.getValue().equals(directoryManager.getCustomDirectoryManagerClassName())) {
                        return true;
                    }
                } else {
                    return true;
                }
View Full Code Here


    private DirectoryManager getCustomDirectoryManagerImpl() {
        try {
            String propertiesName = DirectoryUtil.IMPL_PROPERTIES;
            String className = "";
           
            Setting setting = getSetupManager().getSettingByProperty("directoryManagerImpl");
            if (setting != null && setting.getValue() != null && !setting.getValue().isEmpty()) {
                className = setting.getValue();
            } else {
                className = getCustomDirectoryManagerClassName();
            }
           
            if (className != null && className.equals(getCustomDirectoryManagerClassName())) {
                propertiesName = DirectoryUtil.CUSTOM_IMPL_PROPERTIES;
            }
           
            if (className != null && !className.isEmpty()) {

                DirectoryManagerPlugin directoryManagerPlugin = (DirectoryManagerPlugin) getPluginManager().getPlugin(className);

                if (directoryManagerPlugin != null) {

                    //get plugin properties (if any)
                    Map propertyMap = new HashMap();
                    Setting propertySetting = getSetupManager().getSettingByProperty(propertiesName);
                   
                    if (propertySetting == null && getCustomDirectoryManagerClassName() != null) {
                        String properties = "";
                       
                        try {
                            properties = PropertyUtil.getDefaultPropertyValues(((PropertyEditable) directoryManagerPlugin).getPropertyOptions());
                            properties = properties.replaceAll("\\\\n", "\\n");
                        } catch (Exception e){}
                       
                        propertySetting = new Setting();
                        propertySetting.setProperty(propertiesName);
                        propertySetting.setValue(properties);
                       
                        getSetupManager().saveSetting(propertySetting);
                    }
                   
                    if (propertySetting != null && propertySetting.getValue() != null && propertySetting.getValue().trim().length() > 0) {
                        String properties = propertySetting.getValue();
                        properties = StringUtil.decryptContent(properties);
                        if (!(directoryManagerPlugin instanceof PropertyEditable)) {
                            propertyMap = CsvUtil.getPluginPropertyMap(properties);
                        } else {
                            propertyMap = PropertyUtil.getPropertiesValueFromJson(properties);
View Full Code Here

   
    public static void updateFileSizeLimit() {
        fileSizeLimit = -1;
       
        SetupManager setupManager = (SetupManager) SecurityUtil.getApplicationContext().getBean("setupManager");
        Setting setting = setupManager.getSettingByProperty("fileSizeLimit");

        if (setting != null && setting.getValue() != null && !setting.getValue().isEmpty()) {
            try {
                fileSizeLimit = Integer.parseInt(setting.getValue());
            } catch (Exception e) {
                LogUtil.debug(FileStore.class.getName(), "System Setting for File Size limit is not a valid number");
            }
        }
    }
View Full Code Here

        return getSetupDao().find(condition, params, sort, desc, start, rows);
    }

    public Setting getSettingByProperty(String property) {
        if (cache != null) {
            Setting setting = null;
            synchronized(cache) {
                Element element = null;
                String profile = DynamicDataSourceManager.getCurrentProfile();
                element = cache.get(profile);
                if (element == null) {
View Full Code Here

            return (result.isEmpty()) ? null : result.iterator().next();
        }
    }

    public String getSettingValue(String property) {       
        Setting setting = getSettingByProperty(property);
        String value = (setting != null) ? setting.getValue() : null;
        return value;
    }
View Full Code Here

        String value = (setting != null) ? setting.getValue() : null;
        return value;
    }

    public void deleteSetting(String property) {
        Setting setting = getSettingByProperty(property);
        if (setting != null) {
            getSetupDao().delete(setting);
        }
    }
View Full Code Here

    @RequestMapping(value = "/console/app/(*:appId)/(~:version)/message/importpo/submit", method = RequestMethod.POST)
    public String consoleAppMessageInportPOUpload(ModelMap map, @RequestParam String appId, @RequestParam(required = false) String version) throws Exception {
        AppDefinition appDef = appService.getAppDefinition(appId, version);
       
        Setting setting = setupManager.getSettingByProperty("systemLocale");
        String systemLocale = (setting != null) ? setting.getValue() : null;
        if (systemLocale == null || systemLocale.equalsIgnoreCase("")) {
            systemLocale = "en_US";
        }
       
        String errorMsg = null;
View Full Code Here

            if (booleanSettingsList.contains(paramName)) {
                settingsIsNotNull.add(paramName);
                paramValue = "true";
            }

            Setting setting = setupManager.getSettingByProperty(paramName);
            if (setting == null) {
                setting = new Setting();
                setting.setProperty(paramName);
                setting.setValue(paramValue);
            } else {
                setting.setValue(paramValue);
            }
           
            if (SetupManager.MASTER_LOGIN_PASSWORD.equals(paramName)) {
                if (SetupManager.SECURE_VALUE.equals(paramValue)) {
                    setting.setValue(setupManager.getSettingValue(SetupManager.MASTER_LOGIN_PASSWORD));
                } else {
                    setting.setValue(SecurityUtil.encrypt(paramValue));
                }
            }
           
            if (HostManager.isVirtualHostEnabled() && ("dataFileBasePath".equals(paramName) || "designerwebBaseUrl".equals(paramName))) {
                setting.setValue("");
            }
           
            setupManager.saveSetting(setting);
        }

        for (String s : booleanSettingsList) {
            if (!settingsIsNotNull.contains(s)) {
                Setting setting = setupManager.getSettingByProperty(s);
                if (setting == null) {
                    setting = new Setting();
                    setting.setProperty(s);
                }
                setting.setValue("false");
                setupManager.saveSetting(setting);
            }
        }

        pluginManager.refresh();
View Full Code Here

        } else {
            settingName = DirectoryUtil.IMPL_PROPERTIES;
        }
       
        //save plugin
        Setting setting = setupManager.getSettingByProperty("directoryManagerImpl");
        if (setting == null) {
            setting = new Setting();
            setting.setProperty("directoryManagerImpl");
        }
        setting.setValue(id);
        setupManager.saveSetting(setting);

        Setting propertySetting = setupManager.getSettingByProperty(settingName);
        if (propertySetting == null) {
            propertySetting = new Setting();
            propertySetting.setProperty(settingName);
        }

        if (pluginProperties == null) {
            //request params
            Map<String, String> propertyMap = new HashMap();
            Enumeration<String> e = request.getParameterNames();
            while (e.hasMoreElements()) {
                String paramName = e.nextElement();

                if (!paramName.startsWith("param_")) {
                    String[] paramValue = (String[]) request.getParameterValues(paramName);
                    propertyMap.put(paramName, CsvUtil.getDeliminatedString(paramValue));
                }
            }

            // form csv properties
            StringWriter sw = new StringWriter();
            try {
                CSVWriter writer = new CSVWriter(sw);
                Iterator it = propertyMap.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry<String, String> pairs = (Map.Entry) it.next();
                    writer.writeNext(new String[]{pairs.getKey(), pairs.getValue()});
                }
                writer.close();
            } catch (Exception ex) {
                LogUtil.error(getClass().getName(), ex, "");
            }
            String pluginProps = sw.toString();
            propertySetting.setValue(pluginProps);
        } else {
            propertySetting.setValue(PropertyUtil.propertiesJsonStoreProcessing(propertySetting.getValue(), pluginProperties));
        }
        setupManager.saveSetting(propertySetting);

        String contextPath = WorkflowUtil.getHttpServletRequest().getContextPath();
        String url = contextPath + "/web/console/setting/directory";
View Full Code Here

        return "console/setting/messageImport";
    }

    @RequestMapping(value = "/console/setting/message/import/submit", method = RequestMethod.POST)
    public String consoleSettingMessagePOFileUpload(ModelMap map) throws Exception {
        Setting setting = setupManager.getSettingByProperty("systemLocale");
        String systemLocale = (setting != null) ? setting.getValue() : null;
        if (systemLocale == null || systemLocale.equalsIgnoreCase("")) {
            systemLocale = "en_US";
        }
       
        String errorMsg = null;
View Full Code Here

TOP

Related Classes of org.joget.commons.spring.model.Setting

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.