1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
@WebService(endpointInterface="esbConnexion.FonctionUsed", serviceName="IncidentService", portName="IncidentServicePort", targetNamespace="http://esbConnexion/")
public class Requests implements FonctionUsed{
public Incident[] GetListe(){
ArrayList<Incident> GetListeG2R = GetListeIncident();
return GetListeG2R.toArray(new Incident[GetListeG2R.size()]);
}
public ArrayList<Incident> GetListeIncident() {
ConnectBase connexion = ConnectBase.getInstance();
Requests r = new Requests();
ResultSet rs = null;
rs = r.SelectIncident(connexion);
try {
while (rs.next()) {
listeIncident.add(new Incident(rs.getInt("numero"), rs.getInt("g2r_impacte"),
rs.getString("detail"), rs.getDate("date_debut"), rs.getBoolean("impact_client"),
rs.getString("etat_antenne")));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
CloseConnect.closeConnection(connexion.getConnection());
return listeIncident;
}
public Incident FindIncient(int numero){
ConnectBase connexion = ConnectBase.getInstance();
ResultSet rs = null;
try {
PreparedStatement ps = connexion.getConnection().prepareStatement(FOUNDINCIDENT);
ps.setInt(1, numero);
rs = ps.executeQuery();
System.out.println(rs);
while (rs.next()) {
I = new Incident(rs.getInt("numero"), rs.getInt("g2r_impacte"),
rs.getString("detail"), rs.getDate("date_debut"), rs.getBoolean("impact_client"),
rs.getString("etat_antenne"));
}
return I;
} catch (SQLException ex) {
System.out.println("Connexion à la base de données impossible");
}
CloseConnect.closeConnection(connexion.getConnection());
return null;
}
} |
Partager