RessourceLoader
This commit is contained in:
parent
4734e9bb7d
commit
35f87bd62e
@ -8,6 +8,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import carte.Carte;
|
import carte.Carte;
|
||||||
import carte.CartePiochable;
|
import carte.CartePiochable;
|
||||||
|
import personnage.CartePersonnage;
|
||||||
|
|
||||||
public class RessourceLoader {
|
public class RessourceLoader {
|
||||||
|
|
||||||
@ -50,7 +51,21 @@ public class RessourceLoader {
|
|||||||
return cartesType;
|
return cartesType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Map<Integer, CartePersonnage> getMapPersonnage(Map<Integer, Carte> cartes){
|
||||||
|
|
||||||
|
Map<Integer, CartePersonnage> cartesPersonnage = new HashMap<Integer, CartePersonnage>();
|
||||||
|
|
||||||
|
for(Integer i: cartes.keySet()) {
|
||||||
|
|
||||||
|
Carte c = cartes.get(i);
|
||||||
|
if(cartes.get(i) instanceof CartePersonnage) {
|
||||||
|
|
||||||
|
CartePersonnage carte = (CartePersonnage) c;
|
||||||
|
cartesPersonnage.put(i,carte);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cartesPersonnage;
|
||||||
|
}
|
||||||
|
|
||||||
public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
|
public static Object deserialize(byte[] data) throws IOException, ClassNotFoundException {
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(data);
|
ByteArrayInputStream in = new ByteArrayInputStream(data);
|
||||||
|
@ -28,9 +28,7 @@ public class Table {
|
|||||||
public void remplirTableQuery(String query) {
|
public void remplirTableQuery(String query) {
|
||||||
try (Connection connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ShadowHunterDatabase", "shManager", "shadowhunter1234")) { //notre utilisateur que l'on utilisera (:
|
try (Connection connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/ShadowHunterDatabase", "shManager", "shadowhunter1234")) { //notre utilisateur que l'on utilisera (:
|
||||||
|
|
||||||
System.out.println("Connected to PostgreSQL database!");
|
|
||||||
Statement statement = connection.createStatement();
|
Statement statement = connection.createStatement();
|
||||||
System.out.println("Reading records...");
|
|
||||||
ResultSet retour = statement.executeQuery(query);
|
ResultSet retour = statement.executeQuery(query);
|
||||||
while (retour.next()) {
|
while (retour.next()) {
|
||||||
list.add(new Record(retour.getString("id"), retour.getString("nom"), null, retour.getBytes("objet")));
|
list.add(new Record(retour.getString("id"), retour.getString("nom"), null, retour.getBytes("objet")));
|
||||||
@ -65,10 +63,4 @@ public class Table {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user