Esempio n. 1
0
  public static DSConfiguration save(DSConfiguration configuration) {
    DSConfigDaoImpl dao = DB.getDSConfigDao();

    DataSourceConfig configModel = get(configuration);

    dao.save(configModel);

    configuration = get(configModel);

    return configuration;
  }
Esempio n. 2
0
  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;
  }
Esempio n. 3
0
  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;
  }
Esempio n. 4
0
  public static DSConfiguration getConfigurationByName(String configName) {
    DSConfigDaoImpl dao = DB.getDSConfigDao();
    DSConfiguration config = get(dao.getConfigurationByName(configName));

    return config;
  }
Esempio n. 5
0
  public static List<KeyValuePair> getKeyValuePairs() {
    DSConfigDaoImpl dao = DB.getDSConfigDao();
    List<KeyValuePair> lst = dao.getKeyValuePairs();

    return lst;
  }
Esempio n. 6
0
  public static boolean delete(Long configurationId) {
    DSConfigDaoImpl dao = DB.getDSConfigDao();
    dao.delete(dao.getConfiguration(configurationId));

    return true;
  }