public static DSConfiguration save(DSConfiguration configuration) { DSConfigDaoImpl dao = DB.getDSConfigDao(); DataSourceConfig configModel = get(configuration); dao.save(configModel); configuration = get(configModel); return configuration; }
public static List<DSConfiguration> getConfigurations() { DSConfigDaoImpl dao = DB.getDSConfigDao(); List<DSConfiguration> configurations = new ArrayList<>(); List<DataSourceConfig> models = dao.getConfigurations(); for (DataSourceConfig model : models) { configurations.add(get(model)); } return configurations; }
private static DataSourceConfig get(DSConfiguration configuration) { DSConfigDaoImpl dao = DB.getDSConfigDao(); DataSourceConfig model = new DataSourceConfig(); if (configuration.getId() != null) { model = dao.getConfiguration(configuration.getId()); } model.setId(configuration.getId()); model.setDriver(configuration.getDriver()); model.setJNDI(configuration.isJNDI()); model.setJNDIName(configuration.getJNDIName()); model.setRDBMS(configuration.getRDBMS()); model.setPassword(configuration.getPassword()); model.setUser(configuration.getUser()); model.setURL(configuration.getURL()); model.setConfigName(configuration.getName()); return model; }
public static DSConfiguration getConfigurationByName(String configName) { DSConfigDaoImpl dao = DB.getDSConfigDao(); DSConfiguration config = get(dao.getConfigurationByName(configName)); return config; }
public static List<KeyValuePair> getKeyValuePairs() { DSConfigDaoImpl dao = DB.getDSConfigDao(); List<KeyValuePair> lst = dao.getKeyValuePairs(); return lst; }
public static boolean delete(Long configurationId) { DSConfigDaoImpl dao = DB.getDSConfigDao(); dao.delete(dao.getConfiguration(configurationId)); return true; }