Package dao

Examples of dao.DaoTheoricalTrainData


   
    if (trainsInStation != null) {
     
      List<TheoricalTrainData> new_theoricalDataList = new ArrayList<TheoricalTrainData>();
     
      DaoTheoricalTrainData daoTheoricalTrainData = new DaoTheoricalTrainData();
      DaoUser daoUser = new DaoUser();
     
      for (RealTrainData tmp_real_data : trainsInStation.datas) {
       
        // TODO: faire le -1 sur le id_RealTrainData
       
        TheoricalTrainData tmp_theorical_data = daoTheoricalTrainData.findWithNumGare(tmp_real_data.id_RealTrainData, stationDUA);
       
        if (tmp_theorical_data != null) {
       
          // Pari possible ? (au moins 10 minutes avant l'arriv�e th�orique du train)
          if (TimeTester.compareTimes(trainsInStation.time, tmp_theorical_data.arrivalTime) >= 10) {
           
            tmp_theorical_data.destinationUIC = tmp_real_data.destinationId;
            tmp_theorical_data.trainName = tmp_real_data.name;
            daoTheoricalTrainData.update(tmp_theorical_data);
           
            new_theoricalDataList.add(tmp_theorical_data);
          }
         
         
View Full Code Here


    // R�cup�ration des nouvelles donn�es
    List<TheoricalTrainData> newTheoricalTrainData = TheoricalTimeTrainFileHelper.extractStopTimes(gares, context.getRealPath(""));
    List<TheoricalTrainData> theoricalTrainDataToSave = new ArrayList<TheoricalTrainData>(newTheoricalTrainData);
   
    // R�cup�ration des anciennes donn�es stock�es en BDD
    DaoTheoricalTrainData dao = new DaoTheoricalTrainData();
    List<TheoricalTrainData> oldTheoricalTrainData = dao.getAll();
    List<TheoricalTrainData> theoricalTrainDataToDelete = new ArrayList<TheoricalTrainData>(oldTheoricalTrainData);
   
   
   
    // Parcours des listes et comparaisons
    for (TheoricalTrainData tmp_old_data : oldTheoricalTrainData) {
     
      for (TheoricalTrainData tmp_new_data : newTheoricalTrainData) {
        // Si on a les m�mes data dans la BD et dans le nouveau fichiers,
        // alors on peut garder la data en BD sans y toucher
        if (tmp_old_data.equals(tmp_new_data)) {
          theoricalTrainDataToSave.remove(tmp_new_data);
          theoricalTrainDataToDelete.remove(tmp_old_data);
          break;
        }
      }
    }
   
    // Les datas qui sont rest�es dans la liste theoricalTrainDataToSave
    // sont les nouvelles donn�es � stocker dans la BD
    dao.saveAll(theoricalTrainDataToSave);
   
    // Les datas qui sont rest�es dans la liste theoricalTrainDataToDelete
    // sont les anciennes donn�es � supprimer de la BD
    dao.deleteList(theoricalTrainDataToDelete);
  }
View Full Code Here

TOP

Related Classes of dao.DaoTheoricalTrainData

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.