Exemplo n.º 1
0
  public Configuration reloadConfiguration(HttpServletRequest req, int idConfiguration) {
    // Load configuration properties
    ConfigurationDAO confDAO = new ConfigurationDAO();

    Configuration conf = confDAO.getConfiguration(idConfiguration);

    req.getSession().setAttribute("configuration", conf);

    return conf;
  }
Exemplo n.º 2
0
  public boolean saveUserConfiguration(HttpServletRequest req, Configuration conf, User user) {
    if (conf == null || user == null) {
      return false;
    }

    req.getSession().setAttribute("idSimulation", Integer.toString(conf.getId()));

    // Save configuration properties
    ConfigurationDAO simDAO = new ConfigurationDAO();

    return simDAO.saveConfiguration(conf, user);
  }
Exemplo n.º 3
0
  public Configuration loadConfiguration(HttpServletRequest req, int idConfiguration) {
    User user = getUser(req);

    if (idConfiguration < 0) {
      idConfiguration = user.getIdConfigurationDefault();
    }

    Simulation sim = getSimulation(req, idConfiguration);
    Configuration conf = null;

    if (sim != null) conf = sim.getConfiguration();

    // Load configuration properties
    if (conf == null) {
      ConfigurationDAO confDAO = new ConfigurationDAO();

      conf = confDAO.getConfiguration(idConfiguration);
    }

    req.getSession().setAttribute("configuration", conf);

    return conf;
  }