-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from elhajuojy/AIR-6-ETQ-client-rechercher-des-…
…vols-possibles-depuis-la-barre-de-recherche Air 6 etq client rechercher des vols possibles depuis la barre de recherche
- Loading branch information
Showing
29 changed files
with
313 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- am going from safi to casablanca | ||
|
||
SELECT * FROM VOL ; | ||
--this is the perfect case | ||
SELECT * FROM VOL WHERE ville_depart = 'SAFI' OR ville_arrivee = 'CASABLANCA'; | ||
SELECT * FROM VOL WHERE ville_depart = 'SAFI' OR ville_arrivee = 'RABAT'; | ||
|
||
-- now let's trying finding a flight from safi to rabat which includes going to casablanca and then to rabat | ||
-- this is the case where we need to use the recursive query | ||
|
||
--NOW WE CAN NOW THAT THERE'S TWO FLIGHTS THAT I CAN FROM SAFI TO RABAT BUT I HAVE TO VERIFY THE TIMIMG CONDITIONS | ||
SELECT * FROM VOL f WHERE f.ville_depart = 'SAFI' OR f.ville_arrivee = 'RABAT' AND | ||
f.heure_depart < (SELECT heure_arrivee FROM VOL s WHERE s.ville_arrivee = 'RABAT' AND s.heure_depart < f.heure_arrivee ); | ||
|
||
SELECT * FROM VOL s WHERE s.ville_arrivee = 'RABAT' AND s.heure_depart > '12.44' ; | ||
|
||
SELECT * FROM VOL f WHERE f.ville_depart = 'SAFI' OR f.ville_arrivee IN | ||
(SELECT ville_arrivee FROM VOL s WHERE s.ville_arrivee = 'RABAT' AND f.ville_arrivee = s.ville_depart ); | ||
|
||
|
||
SELECT * FROM VOL as f WHERE f.ville_depart = 'SAFI' or ville_arrivee = | ||
(SELECT ville_arrivee FROM VOL as s WHERE s.ville_arrivee = 'RABAT' AND s.heure_depart < f.heure_arrivee ); | ||
|
||
|
||
|
||
-- LET'S START FROM THE BOTTOM FIRST I WILL NEED TO SPECIFY WHERE I WANT TO GO FROM WHICH IS SAFI AND THIS EXAMPLE | ||
-- NEXT I NEED TO SPECIFY WHERE I WANT TO GO TO WHICH IS RABAT | ||
-- NEXT I NEED TO VERIFY IF THERE'S POSSIBILTY TO GO FROM SAFI TO RABAT DIRECTLY | ||
-- IF NOT I NEED TO VERIFY IF THERE'S A FLIGHT FROM SAFI TO CASABLANCA AND THEN FROM CASABLANCA TO RABAT | ||
-- NEXT I NEED TO CHECK IF THE TIMING IS CORRECT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/main/java/ma/yc/airafraik/FunctionalTest/RecherchePossibleVols.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package ma.yc.airafraik.FunctionalTest; | ||
|
||
|
||
import ma.yc.airafraik.core.Print; | ||
import ma.yc.airafraik.dao.Impl.VolDaoImpl; | ||
import ma.yc.airafraik.dao.VolDao; | ||
import ma.yc.airafraik.entities.VolEntity; | ||
import pl.mjaron.etudes.Arr; | ||
|
||
import java.time.LocalTime; | ||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.Objects; | ||
|
||
public class RecherchePossibleVols { | ||
|
||
static String villeDepart = "SAFI"; | ||
static String villeArrivee = "RABAT"; | ||
|
||
public static void main(String[] args) { | ||
VolDao volDao = new VolDaoImpl(); | ||
System.out.println("Hello World!"); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
public static ArrayList<VolEntity> filterVolsParPourLesConditions(ArrayList<VolEntity> vols){ | ||
HashMap<String , String> conditions = new HashMap<>(); | ||
|
||
conditions.put("villeDepart" , villeDepart); | ||
conditions.put("villeArrivee" , villeArrivee); | ||
ArrayList<VolEntity>vols = volDao.consulterVols(conditions); | ||
|
||
ArrayList<VolEntity> filteredVols = filterVolsParPourLesConditions(vols); | ||
Print.log(filteredVols.size()); | ||
|
||
ArrayList<VolEntity> filteredVols = new ArrayList<>(); | ||
Print.log(vols.size()); | ||
|
||
// Filter vols BY dateDepart NEED TO BE THE SAME AS THE | ||
for (VolEntity volDepart : vols) { | ||
if (Objects.equals(volDepart.getVilleDepart(), villeDepart)){ | ||
for (VolEntity volEscale : vols) { | ||
if (Objects.equals(volEscale.getVilleDepart(), volDepart.getVilleArrivee()) ){ | ||
LocalTime localTimeVolDepart = LocalTime.parse(volDepart.getHeureArrivee()); | ||
LocalTime localTimeVolEscale = LocalTime.parse(volEscale.getHeureDepart()); | ||
|
||
if (localTimeVolDepart.isBefore(localTimeVolEscale)){ | ||
filteredVols.add(volEscale); | ||
Print.log("Vol Depart : " + volDepart.getVilleDepart()+ " => " + volDepart.getHeureDepart() + " Vol Escale : " + volEscale.getHeureDepart()+ " || " | ||
+ volEscale.getVilleDepart() + " => " + volEscale.getVilleArrivee() + " : " + volEscale.getHeureArrivee()); | ||
|
||
} | ||
|
||
|
||
} | ||
} | ||
} | ||
} | ||
return filteredVols; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/main/java/ma/yc/airafraik/dao/Impl/ReservationDaoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ma.yc.airafraik.dao.Impl; | ||
|
||
public class ReservationDaoImpl { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package ma.yc.airafraik.dao; | ||
|
||
import java.util.Collection; | ||
|
||
public interface ReservationDao { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...rafraik/entites/AdministrateurEntity.java → ...afraik/entities/AdministrateurEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ma.yc.airafraik.entities; | ||
|
||
public class AeroportEntity { | ||
} |
2 changes: 1 addition & 1 deletion
2
...ma/yc/airafraik/entites/ClientEntity.java → ...a/yc/airafraik/entities/ClientEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package ma.yc.airafraik.entities; | ||
|
||
public class PaymentEntity { | ||
} |
2 changes: 1 addition & 1 deletion
2
.../airafraik/entites/ReservationEntity.java → ...airafraik/entities/ReservationEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...afraik/entites/SocieteAerienneEntity.java → ...fraik/entities/SocieteAerienneEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../ma/yc/airafraik/entites/VilleEntity.java → ...ma/yc/airafraik/entities/VilleEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...c/airafraik/entites/VilleImageEntity.java → .../airafraik/entities/VilleImageEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package ma.yc.airafraik.entites; | ||
package ma.yc.airafraik.entities; | ||
|
||
|
||
import jakarta.persistence.*; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/java/ma/yc/airafraik/entities/VolEscaleEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ma.yc.airafraik.entities; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.*; | ||
import lombok.extern.java.Log; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Setter | ||
@Getter | ||
@Builder | ||
@Log | ||
@Entity | ||
@Table(name = "vol_escale") | ||
public class VolEscaleEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private int id; | ||
@Column(name = "ville_escale") | ||
private String villeEscale ; | ||
|
||
@Column(name = "heure_depart") | ||
private String heureEscaleDepart ; | ||
|
||
@ManyToOne(fetch = FetchType.EAGER) | ||
@JoinColumn(name = "vol_id") | ||
private VolEntity vol = null ; | ||
|
||
|
||
} |
Oops, something went wrong.