Skip to content

Commit

Permalink
Merge pull request #12 from elhajuojy/AIR-1-etq-client-je-veux-accede…
Browse files Browse the repository at this point in the history
…r-a-la-page-daccueil

Air 1 etq client je veux acceder a la page daccueil
  • Loading branch information
elhajoujy authored Oct 19, 2023
2 parents a2c583f + b789c89 commit a233305
Show file tree
Hide file tree
Showing 37 changed files with 1,361 additions and 235 deletions.
42 changes: 37 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@
<artifactId>jakarta.mail</artifactId>
<version>2.0.1</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.0.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>jakarta.persistence</groupId>-->
<!-- <artifactId>jakarta.persistence-api</artifactId>-->
<!-- <version>3.0.0</version>-->
<!-- </dependency>-->

<dependency>
<groupId>org.hibernate</groupId>
Expand All @@ -52,6 +53,13 @@
<artifactId>HikariCP</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>2.0.0-M1</version>
</dependency>


<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down Expand Up @@ -98,6 +106,30 @@
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>

<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.9</version>
<!-- Specify configuration, executions for liberty-maven-plugin -->
</plugin>


</plugins>

</build>
<pluginRepositories>
<!-- Configure Sonatype OSS Maven snapshots repository -->
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</project>
Binary file added screenshoot/RechercheVolResultsPage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 0 additions & 119 deletions src/main/java/ma/yc/airafraik/CustomPresistenceUnitInfo.java

This file was deleted.

6 changes: 6 additions & 0 deletions src/main/java/ma/yc/airafraik/LibertyConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ma.yc.airafraik;

public class LibertyConfiguration {
//something todo here

}
7 changes: 4 additions & 3 deletions src/main/java/ma/yc/airafraik/dao/Impl/VolDaoImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,17 @@ public boolean supprimerVols(VolEntity[] vols) {
}

@Override
public VolEntity consulterVol() {
return null;
public VolEntity consulterVol(String id) {
Integer volId = Integer.parseInt(id);
return this.entityManager.find(VolEntity.class, volId);
}

@Override
public ArrayList<VolEntity> consulterVols(HashMap<String, String> conditions) {
// EntityManager entityManager = this.hyperJpa.getEntityManager();
String jpql = "SELECT v FROM VolEntity v WHERE ";
for (String key : conditions.keySet()) {
jpql += "v." + key + " = '" + conditions.get(key) + "' OR ";
jpql += "v." + key + " = '" + conditions.get(key) + "' AND ";
}
//remove the last AND
jpql = jpql.substring(0, jpql.length() - 4);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ma/yc/airafraik/dao/VolDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface VolDao {
public boolean supprimerVols();
public boolean supprimerVols(VolEntity[] vols);

public VolEntity consulterVol();
public VolEntity consulterVol(String id);
public ArrayList<VolEntity> consulterVols(HashMap<String, String> conditions);
public Collection<VolEntity> consulterVols();
}
10 changes: 10 additions & 0 deletions src/main/java/ma/yc/airafraik/entities/AvionEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ma.yc.airafraik.entities;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;

@Entity
public class AvionEntity {
@Id
private int idAvion;
}
1 change: 1 addition & 0 deletions src/main/java/ma/yc/airafraik/entities/VolEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class VolEntity {
private int nomberDePlaces ;



@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "vol_id")
private VolEntity vol ;
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/ma/yc/airafraik/service/SearchVolsService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package ma.yc.airafraik.service;

import ma.yc.airafraik.entities.ReservationEntity;
import ma.yc.airafraik.entities.VolEntity;

import java.util.Collection;

public interface SearchVolsService {


public Collection<VolEntity> searchVols(String villeDepart, String villeArrivee, String dateDepart, String dateArrivee, String nombrePassagers);

VolEntity searchVolParId(String id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ public class ReservationServiceImpl implements ReservationService {

private PaiementService paiementService ;

public ReservationServiceImpl() {
}

public ReservationServiceImpl(PaiementService paiementService) {
this.paiementService = paiementService;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package ma.yc.airafraik.service.impl;

import ma.yc.airafraik.dao.Impl.VolDaoImpl;
import ma.yc.airafraik.dao.VolDao;
import ma.yc.airafraik.entities.ReservationEntity;
import ma.yc.airafraik.entities.VolEntity;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;

public class SearchVolsServiceImpl implements ma.yc.airafraik.service.SearchVolsService{

private VolDao volDao ;

public SearchVolsServiceImpl() {
this.volDao = new VolDaoImpl();
}

@Override
public Collection<VolEntity> searchVols(String villeDepart, String villeArrivee, String dateDepart, String dateArrivee, String nombrePassagers) {
//TODO : implement searchVols BY FILTERING THE DATA FROM THE CONTROLLER AND RETURNING THE RESULT FROM THE DAO
HashMap<String,String> conditions = new HashMap<>();
conditions.put("villeDepart",villeDepart);
// conditions.put("villeArrivee",villeArrivee);
// conditions.put("dateDepart",dateDepart);
// conditions.put("dateArrive",dateArrivee);
// conditions.put("nombrePassagers",nombrePassagers);

return this.volDao.consulterVols(conditions);
}

@Override
public VolEntity searchVolParId(String id) {
if (id == null) return null;
VolEntity vol = this.volDao.consulterVol(id);


return vol;


}
}
59 changes: 59 additions & 0 deletions src/main/java/ma/yc/airafraik/web/Admin/DashboardController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package ma.yc.airafraik.web.Admin;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import ma.yc.airafraik.dto.Account;
import ma.yc.airafraik.service.AccountService;
import ma.yc.airafraik.service.impl.AccountAdminServiceImpl;

import java.io.IOException;

@WebServlet(name = "DashboardController", value = "/admin-dashboard")
public class DashboardController extends HttpServlet {

private AccountService accountService ;

@Override
public void init() throws ServletException {
this.accountService = new AccountAdminServiceImpl();
}

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("views/admin/dashboard.jsp").forward(req,resp);

}

@Override
protected void doHead(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doHead(req, resp);
}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPost(req, resp);
}

@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doPut(req, resp);
}

@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doDelete(req, resp);
}

@Override
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.doOptions(req, resp);
}

@Override
public void destroy() {
super.destroy();
}
}
5 changes: 1 addition & 4 deletions src/main/java/ma/yc/airafraik/web/ClientHomeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.setContentType("text/html");
double solde = this.paiementService.verifierSolde();
solde = 100;
req.setAttribute("solde", solde);
req.getRequestDispatcher("home.jsp").forward(req, resp);
req.getRequestDispatcher("index.jsp").forward(req, resp);
}
}
Loading

0 comments on commit a233305

Please sign in to comment.