Esempio n. 1
0
  public void createSimulation(HttpServletRequest req, Configuration conf) {
    cleanSimulation(req);

    String cdSimulation = getCdSimulation(req, conf.getId());

    Simulation sim;

    // Create a new simulation if configurations have been changed
    if (conf.isChangedConfiguration() == true && conf.isKeepProperties() == false) {
      sim = new Simulation(conf, cdSimulation);
    } else {
      sim = (Simulation) ReMoto.simulations.get(cdSimulation);

      if (sim == null) sim = new Simulation(conf, cdSimulation);
    }

    new Thread(sim).start();
  }
Esempio 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);
  }