Package org.opencustomer.db.vo.system

Examples of org.opencustomer.db.vo.system.ConfigurationVO


    private ConfigurationUtil() {
    }

    public static String getStringValue(ConfigurationKey key, List<ConfigurationVO> configurations) {
        ConfigurationVO vo = getConfiguration(key, configurations);
       
        if(vo.getValue() == null)
            if(key.getDefaultValue() == null)
                return null;
            else
                return (String)key.getDefaultValue();
        else
            return vo.getValue();
    }
View Full Code Here


        else
            return vo.getValue();
    }

    public static int getIntValue(ConfigurationKey key, List<ConfigurationVO> configurations) {
        ConfigurationVO vo = getConfiguration(key, configurations);
       
        if(vo.getValue() == null) {
            if(key.getDefaultValue() == null)
                return 0;
            else
                return (Integer)key.getDefaultValue();
        } else
            return Integer.parseInt(vo.getValue());
    }
View Full Code Here

        } else
            return Integer.parseInt(vo.getValue());
    }

    public static boolean getBooleanValue(ConfigurationKey key, List<ConfigurationVO> configurations) {
        ConfigurationVO vo = getConfiguration(key, configurations);
       
        if(vo.getValue() == null) {
            if(key.getDefaultValue() == null)
                return false;
            else
                return (Boolean)key.getDefaultValue();
        } else
            return Boolean.parseBoolean(vo.getValue());
    }
View Full Code Here

        } else
            return Boolean.parseBoolean(vo.getValue());
    }
   
    public static ConfigurationVO getConfiguration(ConfigurationKey key, List<ConfigurationVO> configurations) {
        ConfigurationVO configuration = null;
       
        for(ConfigurationVO vo : configurations) {
            if(key.toString().equals(vo.getKey())) {
                configuration = vo;
            }       
        }
       
        if(configuration == null) {
            configuration = new ConfigurationVO();
            configuration.setKey(key.toString());
            if(key.getDefaultValue() != null)
                configuration.setValue(String.valueOf(key.getDefaultValue()));
           
            configurations.add(configuration);
        }
       
        return configuration;
View Full Code Here

        try {
            HibernateContext.beginTransaction();
           
            ConfigurationDAO dao = new ConfigurationDAO();
            while(configurations.hasNext()) {
                ConfigurationVO configuration = configurations.next();
               
                if (configuration.getId() == null) {
                    if(configuration.getValue() != null) {
                        if (log.isDebugEnabled())
                            log.debug("create configuration");

                        dao.insert(configuration, user);
                    }
                } else {
                    if(configuration.getValue() != null) {
                        if (log.isDebugEnabled())
                            log.debug("save configuration (ID:" + configuration.getId() + ")");
                       
                        dao.update(configuration, user);
                    } else {
                        if (log.isDebugEnabled())
                            log.debug("delete configuration (ID:" + configuration.getId() + ")");
                       
                        dao.delete(configuration);
                        configurations.remove();
                    }
                }
View Full Code Here

    @Override
    public void readForm(PageLdapForm form, ActionMessages errors, HttpServletRequest request) {
        List<ConfigurationVO> configurations = (List<ConfigurationVO>)getPanel().getAttribute("configurations");

        ConfigurationVO authenticationEnabled = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_AUTHENTICATION_ENABLED, configurations);
        authenticationEnabled.setValue(String.valueOf(form.isAuthenticationEnabled()));
       
        ConfigurationVO addressExportEnabled = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_ADDRESS_EXPORT_ENABLED, configurations);
        addressExportEnabled.setValue(String.valueOf(form.isAddressExportEnabled()));
       
        ConfigurationVO addressInitalExport = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_ADDRESS_INITIAL_EXPORT, configurations);
        addressInitalExport.setValue(String.valueOf(form.isAddressInitialExport()));
       
        ConfigurationVO server = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_SERVER, configurations);
        server.setValue(form.getServer());
       
        ConfigurationVO port = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_PORT, configurations);
        port.setValue(form.getPort());
       
        ConfigurationVO adminUser = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_ADMIN_USER, configurations);
        adminUser.setValue(form.getAdminUser());

        ConfigurationVO adminPassword = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_ADMIN_PASSWORD, configurations);
        adminPassword.setValue(form.getAdminPassword());

        ConfigurationVO baseDn = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_BASE_DN, configurations);
        baseDn.setValue(form.getBaseDn());

        ConfigurationVO addressPrefix = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_ADDRESS_PREFIX, configurations);
        addressPrefix.setValue(form.getAddressPrefix());

        ConfigurationVO addressCompanyPrefix = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_ADDRESS_COMPANY_PREFIX, configurations);
        addressCompanyPrefix.setValue(form.getAddressCompanyPrefix());

        ConfigurationVO addressPersonPrefix = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_ADDRESS_PERSON_PREFIX, configurations);
        addressPersonPrefix.setValue(form.getAddressPersonPrefix());

        ConfigurationVO userPrefix = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_USER_PREFIX, configurations);
        userPrefix.setValue(form.getUserPrefix());

        ConfigurationVO groupPrefix = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_GROUP_PREFIX, configurations);
        groupPrefix.setValue(form.getGroupPrefix());

        ConfigurationVO systemUser = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.LDAP_SYSTEM_USER, configurations);
        systemUser.setValue(form.getSystemUser());
    }
View Full Code Here

    @Override
    public void readForm(PageStandardForm form, ActionMessages errors, HttpServletRequest request) {
        List<ConfigurationVO> configurations = (List<ConfigurationVO>)getPanel().getAttribute("configurations");

        ConfigurationVO maxFailedLogins = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.MAX_FAILED_LOGINS, configurations);
        maxFailedLogins.setValue(String.valueOf(form.getMaxFailedLogins()));
       
        ConfigurationVO defaultTimeLock = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.DEFAULT_TIMELOCK, configurations);
        defaultTimeLock.setValue(String.valueOf(form.getDefaultTimeLock()));
       
        ConfigurationVO defaultIpPattern = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.DEFAULT_IPPATTERN, configurations);
        defaultIpPattern.setValue(form.getDefaultIpPattern());
       
        ConfigurationVO mailServer = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.MAIL_SMTP_SERVER, configurations);
        mailServer.setValue(form.getMailSmtpServer());

        ConfigurationVO showOverview = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.SHOW_OVERVIEW, configurations);
        showOverview.setValue(String.valueOf(form.isShowOverview()));
       
        ConfigurationVO multipleLogins = ConfigurationUtil.getConfiguration(SystemConfiguration.Key.MULTIPLE_LOGINS, configurations);
        multipleLogins.setValue(String.valueOf(form.isMultipleLogins()));
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.db.vo.system.ConfigurationVO

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.