Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (110)
a30b9acb
creation domains, ajout diagramme de classe et capture d'écran de MCD
Oct 31, 2023
8b095738
révision de noms de classe et ajout attribute dans domain Mission
Oct 31, 2023
53cf439a
package resources/conception
Oct 31, 2023
7d5b61a5
annotation de relationnel de domaines
Oct 31, 2023
9e2a72af
Merge origin/Elly into vincent
Oct 31, 2023
f2205a49
Merge origin/vincent into Vincent
Oct 31, 2023
854e6fd7
Merge Vincent into Elly
Oct 31, 2023
d7e6e445
remplissage ChasseurController, Repository, Service et ServiceImpl
Oct 31, 2023
d72a52c7
suppression calculs.java
Oct 31, 2023
55065af3
page /inscriptionPilote affiché
Oct 31, 2023
0f385096
Merge InscriptionPilote into Elly
Oct 31, 2023
efab155a
Merge origin/Elly into Fabien
Oct 31, 2023
1f9bc60b
commit avt merge
Oct 31, 2023
dfff0951
Merge origin/Elly into johad
Oct 31, 2023
4f8a37be
method get works for now inscrire pilote
Oct 31, 2023
1a4700f5
trying method post but not work yet
Oct 31, 2023
23049da2
Merge origin/Elly into Fabien
Oct 31, 2023
4019423a
method post d'inscription pilote fonctionne
Oct 31, 2023
812eaea3
Merge origin/Elly into Fabien
Oct 31, 2023
45eeda2c
remplissage NouveauChasseur + ListeChasseur
Oct 31, 2023
d01ec533
commit avt merge
Oct 31, 2023
6a690cff
page nouvelle mission ok sauf liste pair pilote/chasseur
Nov 02, 2023
0ce64244
changement de type type_chasseur(TYpechasseur à la place de string) dans bean chasseur
Nov 02, 2023
a305bf28
Merge origin/vincent into Fabien
Nov 02, 2023
3369d275
ficheChasseur html, controller, serviceimpl
Nov 02, 2023
81be9d87
commit before merge Fabien branch
Nov 02, 2023
6ab8fa49
Merge origin/Fabien into Fabien
Nov 02, 2023
0c1c6d16
Merge Fabien into Elly
Nov 02, 2023
94e4030a
commit avt merge
Nov 02, 2023
9698efbb
correction controlleur pour la persistence en db sans REquestParameter
Nov 02, 2023
7f66966f
Merge origin/Fabien into johad
Nov 02, 2023
00965a1b
bootstrap (not finished)
Nov 02, 2023
74b43915
page nouvelle mission ok sauf liste pair pilote/chasseur
Nov 02, 2023
b4907871
Merge origin/Fabien into Elly
Nov 02, 2023
ccd7351d
Merge origin/vincent into johad
Nov 02, 2023
a4b9cd50
bootstrap works, creation of affectation (repository, service, et impl),...
Nov 02, 2023
b0636164
Merge origin/vincent into Fabien
Nov 02, 2023
db3a36f4
Merge origin/Elly into Fabien
Nov 02, 2023
43210e9b
Chasseur fonctionnel
Nov 02, 2023
3b4ee2c0
Merge origin/Elly into johad
Nov 02, 2023
4269c2c6
Merge origin/Elly into johad
Nov 02, 2023
069126c8
Merge origin/Fabien into johad
Nov 02, 2023
4cb144cc
page nouvelle mission ok sauf liste pair pilote/chasseur
Nov 02, 2023
69d9eddf
Merge origin/Elly into Fabien
Nov 02, 2023
1d08d375
modification des sections du menu Pilote
Nov 02, 2023
bd367442
Merge origin/johad into Fabien
Nov 02, 2023
6a80df1e
modification header et footer
Nov 02, 2023
d95a6817
page nouvelle mission ok sauf liste pair pilote/chasseur
Nov 02, 2023
2ff86839
page nouvelle mission ok sauf liste pair pilote/chasseur
Nov 02, 2023
1fd061ca
?
Nov 02, 2023
94088087
Merge origin/vincent into Fabien
Nov 02, 2023
8aea1d06
FichePiloteController fonctionne, ajout de fichePilote.html
Nov 02, 2023
a5656df1
ajoute affiche type_pilote sur html
Nov 02, 2023
34335625
Merge origin/Elly into Fabien
Nov 02, 2023
73470fe8
Merge origin/Elly into Fabien
Nov 02, 2023
5485ba91
Chasseur fiche et liste fonctionnel
Nov 02, 2023
422103a6
liste mission controller en cours
Nov 02, 2023
1d77a68c
ajout d'un lien pour voir la fiche d'un pilote
Nov 02, 2023
d7593c29
Merge origin/Fabien into vincent
Nov 02, 2023
579085e4
resolution conflit branche Elly
Nov 02, 2023
48ef1cdc
resolution conflit branche Vincent
Nov 02, 2023
d1e75425
bug nouveauChasseur dans la db résolu
Nov 02, 2023
ab610b4a
resolution conflit branche fabien
Nov 02, 2023
228cc87c
liste mission HTML ok
Nov 02, 2023
eb2dc3f2
resolution conflit branche vincent
Nov 02, 2023
6fd64ed5
Liste Pilote (tous, par etat, par grade, par type) functions, only par race not done (not priority)
Nov 02, 2023
db78452e
Merge branch 'johad' into Elly
Nov 02, 2023
58ef4216
temp
Nov 02, 2023
0080ee41
Merge origin/vincent into Elly
Nov 02, 2023
b1024fd0
débug changement des noms des attributs
Nov 02, 2023
4ea24ed1
liste mission HTML ok
Nov 03, 2023
eb14db18
affectation en cours, vue fonctionne comme prévu, manque à persister en db
Nov 03, 2023
2dd67367
Merge origin/Elly into vincent
Nov 03, 2023
8f9c7782
Merge origin/Elly into Fabien
Nov 03, 2023
ade738d5
Class ModifierEtatChasseur
Nov 03, 2023
7c44d669
Merge origin/Elly into johad
Nov 03, 2023
3266d5a0
Merge origin/Fabien into johad
Nov 03, 2023
567e567c
correction methode modifierEtatChasseur
Nov 03, 2023
9de9a69e
remise en forme de toute les pages html, inclusion des header et footer, du css
Nov 03, 2023
5f447cbb
css mis a jour
Nov 03, 2023
27b85cca
css appliqué à toutes les pages mais conflit pages dependantes de l'enum
Nov 03, 2023
ffc51b8d
remise en forme de toute les pages html, inclusion des header et footer, du css
Nov 03, 2023
54d90da5
commit before changer le bean Affectations sans composite key
Nov 03, 2023
3df672ab
change Affectation without composite key, Mission creation and affectation...
Nov 03, 2023
f9842fba
corrections
Nov 03, 2023
dc16fb6e
commit before push
Nov 03, 2023
2406d73e
resolutions conflits branche Elly
Nov 03, 2023
a6511175
display affectation in nouvelleMission.html works
Nov 03, 2023
2137a8e6
ajout corps fonction ChasseurService
Nov 03, 2023
8cbaee98
Merge origin/Elly into johad
Nov 03, 2023
b1d2a80e
correction renommage variable html chasseur
Nov 03, 2023
a5f9bab3
calculNbHeures après clotureMission fonctionne
Nov 03, 2023
b049b7fe
liste missions terminées
Nov 03, 2023
e5f9caa4
Merge origin/Elly into johad
Nov 03, 2023
29266cfd
css fait sur toutes les pages html
Nov 03, 2023
c5cc59ec
liste missions terminées vFinal
Nov 03, 2023
650692f2
commit merge branche Fabien
Nov 03, 2023
b6f318ef
commit après merge branche Vincent (CSS/fonts)
Nov 03, 2023
7ae67a10
css fait sur toutes les pages html
Nov 03, 2023
b9137516
Merge origin/johad into Fabien
Nov 03, 2023
Show whitespace changes
Inline
Side-by-side
nbactions.xml
0 → 100644
View file @
c873add6
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>
run
</actionName>
<packagings>
<packaging>
jar
</packaging>
</packagings>
<goals>
<goal>
process-classes
</goal>
<goal>
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
</goal>
</goals>
<properties>
<exec.vmArgs></exec.vmArgs>
<exec.args>
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>
fr.ldnr.starWars.StarWarsApplication
</exec.mainClass>
<exec.executable>
java
</exec.executable>
</properties>
</action>
<action>
<actionName>
debug
</actionName>
<packagings>
<packaging>
jar
</packaging>
</packagings>
<goals>
<goal>
process-classes
</goal>
<goal>
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
</goal>
</goals>
<properties>
<exec.vmArgs>
-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}
</exec.vmArgs>
<exec.args>
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>
fr.ldnr.starWars.StarWarsApplication
</exec.mainClass>
<exec.executable>
java
</exec.executable>
<jpda.listen>
true
</jpda.listen>
</properties>
</action>
<action>
<actionName>
profile
</actionName>
<packagings>
<packaging>
jar
</packaging>
</packagings>
<goals>
<goal>
process-classes
</goal>
<goal>
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
</goal>
</goals>
<properties>
<exec.vmArgs></exec.vmArgs>
<exec.args>
${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}
</exec.args>
<exec.mainClass>
fr.ldnr.starWars.StarWarsApplication
</exec.mainClass>
<exec.executable>
java
</exec.executable>
<exec.appArgs></exec.appArgs>
</properties>
</action>
</actions>
pom.xml
View file @
c873add6
...
...
@@ -44,6 +44,11 @@
<scope>
runtime
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
com.mysql
</groupId>
<artifactId>
mysql-connector-j
</artifactId>
...
...
src/main/java/fr/ldnr/starWars/StarWarsApplication.java
View file @
c873add6
...
...
@@ -2,6 +2,9 @@ package fr.ldnr.starWars;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.ViewControllerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
@SpringBootApplication
public
class
StarWarsApplication
{
...
...
@@ -10,4 +13,14 @@ public class StarWarsApplication {
SpringApplication
.
run
(
StarWarsApplication
.
class
,
args
);
}
@Configuration
public
static
class
WebConfig
implements
WebMvcConfigurer
{
@Override
public
void
addViewControllers
(
ViewControllerRegistry
registry
)
{
// Définir la page menu.html comme page d'accueil
registry
.
addViewController
(
"/"
).
setViewName
(
"menu"
);
}
}
}
src/main/java/fr/ldnr/starWars/bootstrap/BootstrapData.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.bootstrap
;
import
fr.ldnr.starWars.domains.Affectation
;
import
fr.ldnr.starWars.domains.Chasseur
;
import
fr.ldnr.starWars.domains.Mission
;
import
fr.ldnr.starWars.domains.Pilote
;
import
fr.ldnr.starWars.enumerations.EtatChasseur
;
import
fr.ldnr.starWars.enumerations.EtatPilote
;
import
fr.ldnr.starWars.enumerations.GradePilote
;
import
fr.ldnr.starWars.enumerations.RacePilote
;
import
fr.ldnr.starWars.enumerations.ResultatMission
;
import
fr.ldnr.starWars.enumerations.StatutMission
;
import
fr.ldnr.starWars.enumerations.TypeChasseur
;
import
fr.ldnr.starWars.enumerations.TypeMission
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.repositories.AffectationRepository
;
import
fr.ldnr.starWars.repositories.ChasseurRepository
;
import
fr.ldnr.starWars.repositories.MissionRepository
;
import
fr.ldnr.starWars.repositories.PiloteRepository
;
import
java.util.List
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
/**
*
* @author stag
*/
@Component
public
class
BootstrapData
implements
CommandLineRunner
{
PiloteRepository
piloteRepository
;
ChasseurRepository
chasseurRepository
;
MissionRepository
missionRepository
;
AffectationRepository
affectationRepository
;
public
BootstrapData
(
PiloteRepository
piloteRepository
,
ChasseurRepository
chasseurRepository
,
MissionRepository
missionRepository
,
AffectationRepository
affectationRepository
)
{
this
.
piloteRepository
=
piloteRepository
;
this
.
chasseurRepository
=
chasseurRepository
;
this
.
missionRepository
=
missionRepository
;
this
.
affectationRepository
=
affectationRepository
;
}
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
Pilote
pilote1
=
new
Pilote
();
pilote1
.
setNom
(
"MAMA"
);
pilote1
.
setPrenom
(
"Apprenti1"
);
pilote1
.
setAge
(
100
);
pilote1
.
setRace
(
RacePilote
.
CHALACTEENS
);
pilote1
.
setEtat
(
EtatPilote
.
DISPONIBLE
);
pilote1
.
setType
(
TypePilote
.
APPRENTI
);
pilote1
.
setGrade
(
GradePilote
.
OFFICIER
);
pilote1
.
setEtat
(
EtatPilote
.
DISPONIBLE
);
Pilote
pilote2
=
new
Pilote
();
pilote2
.
setNom
(
"WOW"
);
pilote2
.
setPrenom
(
"Combattant1"
);
pilote2
.
setAge
(
17
);
pilote2
.
setRace
(
RacePilote
.
CHISS
);
pilote2
.
setType
(
TypePilote
.
APPRENTI
);
pilote2
.
setGrade
(
GradePilote
.
OFFICIER
);
pilote2
.
setEtat
(
EtatPilote
.
DISPONIBLE
);
Pilote
pilote3
=
new
Pilote
();
pilote3
.
setNom
(
"WIW"
);
pilote3
.
setPrenom
(
"Combattant2"
);
pilote3
.
setAge
(
29
);
pilote3
.
setRace
(
RacePilote
.
ITHORIENS
);
pilote3
.
setType
(
TypePilote
.
COMBATTANT
);
pilote3
.
setGrade
(
GradePilote
.
CAPITAINE
);
pilote3
.
setEtat
(
EtatPilote
.
BLESSE
);
Pilote
pilote4
=
new
Pilote
();
pilote4
.
setNom
(
"WEW"
);
pilote4
.
setPrenom
(
"Combattant3"
);
pilote4
.
setAge
(
29
);
pilote4
.
setRace
(
RacePilote
.
MIRALUKAS
);
pilote4
.
setType
(
TypePilote
.
APPRENTI
);
pilote4
.
setGrade
(
GradePilote
.
OFFICIER
);
pilote4
.
setEtat
(
EtatPilote
.
MORT_AU_COMBAT
);
Pilote
pilote5
=
new
Pilote
();
pilote5
.
setNom
(
"WUW"
);
pilote5
.
setPrenom
(
"Combattant4"
);
pilote5
.
setAge
(
77
);
pilote5
.
setRace
(
RacePilote
.
NAGAIS
);
pilote5
.
setType
(
TypePilote
.
COMBATTANT
);
pilote5
.
setGrade
(
GradePilote
.
OFFICIER
);
pilote5
.
setEtat
(
EtatPilote
.
DISPONIBLE
);
Pilote
pilote6
=
new
Pilote
();
pilote6
.
setNom
(
"DUREL"
);
pilote6
.
setPrenom
(
"Johad"
);
pilote6
.
setAge
(
22
);
pilote6
.
setRace
(
RacePilote
.
HUMAINS
);
pilote6
.
setType
(
TypePilote
.
COMBATTANT
);
pilote6
.
setGrade
(
GradePilote
.
OFFICIER
);
pilote6
.
setEtat
(
EtatPilote
.
BLESSE
);
Pilote
pilote7
=
new
Pilote
();
pilote7
.
setNom
(
"DUREL"
);
pilote7
.
setPrenom
(
"Johad2"
);
pilote7
.
setAge
(
22
);
pilote7
.
setRace
(
RacePilote
.
HUMAINS
);
pilote7
.
setType
(
TypePilote
.
APPRENTI
);
pilote7
.
setGrade
(
GradePilote
.
OFFICIER
);
pilote7
.
setEtat
(
EtatPilote
.
DISPONIBLE
);
piloteRepository
.
save
(
pilote1
);
piloteRepository
.
save
(
pilote2
);
piloteRepository
.
save
(
pilote3
);
piloteRepository
.
save
(
pilote4
);
piloteRepository
.
save
(
pilote5
);
Chasseur
chasseur1
=
new
Chasseur
();
chasseur1
.
setType
(
TypeChasseur
.
X_WING
);
chasseur1
.
setEtat
(
EtatChasseur
.
OPERATIONNEL
);
Chasseur
chasseur2
=
new
Chasseur
();
chasseur2
.
setType
(
TypeChasseur
.
Y_WING
);
chasseur2
.
setEtat
(
EtatChasseur
.
EN_MISSION
);
Chasseur
chasseur3
=
new
Chasseur
();
chasseur3
.
setType
(
TypeChasseur
.
X_WING
);
chasseur3
.
setEtat
(
EtatChasseur
.
MAINTENANCE
);
Chasseur
chasseur4
=
new
Chasseur
();
chasseur4
.
setType
(
TypeChasseur
.
X_WING
);
chasseur4
.
setEtat
(
EtatChasseur
.
DETRUIT
);
Chasseur
chasseur5
=
new
Chasseur
();
chasseur5
.
setType
(
TypeChasseur
.
Y_WING
);
chasseur5
.
setEtat
(
EtatChasseur
.
OPERATIONNEL
);
chasseurRepository
.
save
(
chasseur1
);
chasseurRepository
.
save
(
chasseur2
);
chasseurRepository
.
save
(
chasseur3
);
chasseurRepository
.
save
(
chasseur4
);
chasseurRepository
.
save
(
chasseur5
);
Mission
mission1
=
new
Mission
();
mission1
.
setTitre
(
"Mission 1"
);
mission1
.
setType
(
TypeMission
.
COMBAT
);
mission1
.
setNbHeure
(
200
);
mission1
.
setResultat
(
ResultatMission
.
DEFAITE
);
mission1
.
setStatut
(
StatutMission
.
TERMINE
);
Mission
mission2
=
new
Mission
();
mission2
.
setTitre
(
"Mission 2"
);
mission2
.
setType
(
TypeMission
.
ENTRAINEMENT
);
mission2
.
setNbHeure
(
50
);
mission2
.
setResultat
(
ResultatMission
.
DEFAITE
);
mission2
.
setStatut
(
StatutMission
.
TERMINE
);
Mission
mission3
=
new
Mission
();
mission3
.
setTitre
(
"Mission 3"
);
mission3
.
setType
(
TypeMission
.
COMBAT
);
mission3
.
setStatut
(
StatutMission
.
TERMINE
);
mission3
.
setNbHeure
(
600
);
mission3
.
setResultat
(
ResultatMission
.
VICTOIRE
);
missionRepository
.
save
(
mission1
);
missionRepository
.
save
(
mission2
);
missionRepository
.
save
(
mission3
);
Affectation
affectation1
=
new
Affectation
();
affectation1
.
setMission
(
mission3
);
affectation1
.
setPilote
(
pilote3
);
affectation1
.
setChasseur
(
chasseur2
);
Affectation
affectation2
=
new
Affectation
();
affectation2
.
setMission
(
mission2
);
affectation2
.
setPilote
(
pilote1
);
affectation2
.
setChasseur
(
chasseur4
);
Affectation
affectation4
=
new
Affectation
();
affectation4
.
setMission
(
mission2
);
affectation4
.
setPilote
(
pilote4
);
affectation4
.
setChasseur
(
chasseur1
);
Affectation
affectation3
=
new
Affectation
();
affectation3
.
setMission
(
mission1
);
affectation3
.
setPilote
(
pilote5
);
affectation3
.
setChasseur
(
chasseur2
);
affectationRepository
.
save
(
affectation1
);
affectationRepository
.
save
(
affectation2
);
affectationRepository
.
save
(
affectation3
);
affectationRepository
.
save
(
affectation4
);
mission2
.
getAffectation
().
add
(
affectation2
);
pilote1
.
getAffectation
().
add
(
affectation2
);
chasseur4
.
getAffectation
().
add
(
affectation2
);
mission3
.
getAffectation
().
add
(
affectation1
);
pilote3
.
getAffectation
().
add
(
affectation1
);
chasseur2
.
getAffectation
().
add
(
affectation1
);
mission1
.
getAffectation
().
add
(
affectation3
);
pilote5
.
getAffectation
().
add
(
affectation3
);
chasseur2
.
getAffectation
().
add
(
affectation3
);
mission2
.
getAffectation
().
add
(
affectation4
);
pilote4
.
getAffectation
().
add
(
affectation4
);
chasseur1
.
getAffectation
().
add
(
affectation4
);
List
list
=
piloteRepository
.
findByEtat
(
EtatPilote
.
DISPONIBLE
);
for
(
var
pilote
:
list
)
{
System
.
out
.
println
(
"CHECK : "
+
pilote
);
}
}
}
src/main/java/fr/ldnr/starWars/calculs/Calculs.java
View file @
c873add6
...
...
@@ -4,10 +4,119 @@
*/
package
fr.ldnr.starWars.calculs
;
import
fr.ldnr.starWars.domains.Affectation
;
import
fr.ldnr.starWars.domains.Mission
;
import
fr.ldnr.starWars.domains.Pilote
;
import
fr.ldnr.starWars.enumerations.GradePilote
;
import
fr.ldnr.starWars.enumerations.StatutMission
;
import
fr.ldnr.starWars.enumerations.TypeMission
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.services.MissionService
;
import
java.util.HashSet
;
import
java.util.Set
;
/**
*
* @author stag
*/
public
class
Calculs
{
private
final
MissionService
missionService
;
public
Calculs
(
MissionService
missionService
)
{
this
.
missionService
=
missionService
;
}
public
int
calculNbHeure
(
Pilote
pilote
)
{
// boucle Set<Affectation> affectation then recuperate Mission then trier Mission par Statut TERMINE
Set
<
Mission
>
missions
=
new
HashSet
<>();
// Create a set to store missions
int
totalNbHeure
=
0
;
for
(
Affectation
affectation
:
pilote
.
getAffectation
())
{
Mission
mission
=
affectation
.
getMission
();
if
(
mission
!=
null
&&
mission
.
getStatut
().
equals
(
StatutMission
.
TERMINE
))
{
missions
.
add
(
mission
);
// recuperate nbHeure
totalNbHeure
+=
mission
.
getNbHeure
();
}
}
// return total nbHeure
return
totalNbHeure
;
}
// calcul nb de mission type COMBAT
public
int
calculNbMissionCombat
(
Pilote
pilote
)
{
int
nbMissionCombat
=
0
;
Set
<
Mission
>
missions
=
new
HashSet
<>();
// Create a set to store missions
for
(
Affectation
affectation
:
pilote
.
getAffectation
())
{
Mission
mission
=
affectation
.
getMission
();
if
(
mission
!=
null
&&
mission
.
getType
().
equals
(
TypeMission
.
COMBAT
))
{
missions
.
add
(
mission
);
// recuperate nbHeure
nbMissionCombat
++;
}
}
return
nbMissionCombat
;
}
// calcul nb de mission type ALL
public
int
calculTotalNbMission
(
Pilote
pilote
)
{
int
totalNbMission
=
0
;
Set
<
Mission
>
missions
=
new
HashSet
<>();
// Create a set to store missions
for
(
Affectation
affectation
:
pilote
.
getAffectation
())
{
Mission
mission
=
affectation
.
getMission
();
if
(
mission
!=
null
)
{
missions
.
add
(
mission
);
// recuperate nbHeure
totalNbMission
++;
}
}
return
totalNbMission
;
}
// update Grade Pilote :
// Officier < 500 heures
// Lieutenant >= 500
// Capitaine 501 - 1500 + 1 Mission COMBAT
// Major 1500-3999 + 3 TOTAL Mission
// Commandant >=4000 + 10 TOTAL Mission
public
GradePilote
checkGradePilote
(
int
nbHeures
,
int
totalNbMission
,
int
totalNbMissionCombat
)
{
// Officier: Less than 500 hours
if
(
nbHeures
<
500
)
{
return
GradePilote
.
OFFICIER
;
}
// Lieutenant: 500 hours or more
if
(
nbHeures
>=
500
)
{
return
GradePilote
.
LIEUTENANT
;
}
// Capitaine: Between 501 and 1500 hours with at least 1 Mission COMBAT
if
(
nbHeures
>
500
&&
nbHeures
<=
1500
&&
totalNbMissionCombat
>=
1
)
{
return
GradePilote
.
CAPITAINE
;
}
// Major: Between 1500 and 3999 hours with at least 3 TOTAL Missions and 1 Mission COMBAT
if
(
nbHeures
>=
1500
&&
nbHeures
<=
3999
&&
totalNbMission
>=
3
&&
totalNbMissionCombat
>=
1
)
{
return
GradePilote
.
MAJOR
;
}
// Commandant: 4000 hours or more with at least 3 TOTAL Missions and 1 Mission COMBAT
if
(
nbHeures
>=
4000
&&
totalNbMission
>=
3
&&
totalNbMissionCombat
>=
1
)
{
return
GradePilote
.
COMMANDANT
;
}
// No matching conditions, return null to indicate no grade assigned
return
null
;
}
// update Type Pilote. Apprenti < 100 heures. Combattant >= 100 heures.
public
TypePilote
checkTypePilote
(
int
nbHeures
)
{
if
(
nbHeures
<
100
)
{
return
TypePilote
.
APPRENTI
;
}
return
TypePilote
.
COMBATTANT
;
}
}
src/main/java/fr/ldnr/starWars/controllers/AffectationPiloteChasseurController.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.services.ChasseurService
;
import
fr.ldnr.starWars.services.PiloteService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
/**
*
* @author stag
*/
@Controller
public
class
AffectationPiloteChasseurController
{
private
final
PiloteService
piloteService
;
private
final
ChasseurService
chasseurService
;
public
AffectationPiloteChasseurController
(
PiloteService
piloteService
,
ChasseurService
chasseurService
)
{
this
.
piloteService
=
piloteService
;
this
.
chasseurService
=
chasseurService
;
}
@GetMapping
(
"/affectation"
)
public
String
AffecterPiloteChasseur
(
Model
model
)
{
model
.
addAttribute
(
"listePilotes"
,
piloteService
.
findAll
());
model
.
addAttribute
(
"listeChasseurs"
,
chasseurService
.
findAll
());
return
"affectation"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/ClotureMission.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.calculs.Calculs
;
import
fr.ldnr.starWars.domains.Affectation
;
import
fr.ldnr.starWars.domains.Chasseur
;
import
fr.ldnr.starWars.domains.Mission
;
import
fr.ldnr.starWars.domains.Pilote
;
import
fr.ldnr.starWars.enumerations.GradePilote
;
import
fr.ldnr.starWars.enumerations.ResultatMission
;
import
fr.ldnr.starWars.enumerations.StatutMission
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.services.MissionService
;
import
fr.ldnr.starWars.services.PiloteService
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
ClotureMission
{
private
final
MissionService
missionService
;
private
final
PiloteService
piloteService
;
public
ClotureMission
(
MissionService
missionService
,
PiloteService
piloteService
)
{
this
.
missionService
=
missionService
;
this
.
piloteService
=
piloteService
;
}
@GetMapping
(
"/clotureMission"
)
public
String
clotureMission
(
Model
model
)
{
model
.
addAttribute
(
"resultatMission"
,
missionService
.
resultatMission
());
model
.
addAttribute
(
"missions"
,
missionService
.
findByStatut
(
StatutMission
.
ENCOUR
));
return
"clotureMission"
;
}
@PostMapping
(
"/clotureMission"
)
public
String
nouvelleMissionSubmit
(
Model
model
,
@RequestParam
(
value
=
"heures"
)
String
heures
,
@RequestParam
(
value
=
"resultats"
)
String
resultats
,
@RequestParam
(
value
=
"missions"
)
String
missions
)
{
model
.
addAttribute
(
"missions"
,
missionService
.
findByStatut
(
StatutMission
.
ENCOUR
));
// recuperate Mission from db by Id
Integer
idMission
=
(
Integer
.
valueOf
(
missions
));
Mission
missionRecupere
=
missionService
.
findById
(
idMission
);
System
.
out
.
println
(
"CHECK PILOTE RECUPEREE : "
+
missionRecupere
);
// remplir nbHeures et resultat au bean de Mission
missionRecupere
.
setNbHeure
(
Integer
.
valueOf
(
heures
));
missionRecupere
.
setResultat
(
ResultatMission
.
valueOf
(
resultats
));
missionRecupere
.
setStatut
(
StatutMission
.
TERMINE
);
// persister missionRecupere dans la db
missionService
.
save
(
missionRecupere
);
// boucle tous les pilotes dans la Mission
Set
<
Pilote
>
pilotes
=
new
HashSet
<>();
// Create a set to store pilotes in the Mission
for
(
Affectation
affectation
:
missionRecupere
.
getAffectation
())
{
Pilote
pilote
=
affectation
.
getPilote
();
if
(
pilote
!=
null
)
{
pilotes
.
add
(
pilote
);
}
}
model
.
addAttribute
(
"pilotes"
,
pilotes
);
// boucle tous les chasseurs dans la Mission
Set
<
Chasseur
>
chasseurs
=
new
HashSet
<>();
// Create a set to store pilotes in the Mission
for
(
Affectation
affectation
:
missionRecupere
.
getAffectation
())
{
Chasseur
chasseur
=
affectation
.
getChasseur
();
if
(
chasseur
!=
null
)
{
chasseurs
.
add
(
chasseur
);
}
}
model
.
addAttribute
(
"chasseurs"
,
chasseurs
);
for
(
Pilote
pilote
:
pilotes
)
{
// ---------- DÉBUT CALCUL NB HEURE ET PUIS UPDATE GRADE OU TYPE
//calculNbHeure
Calculs
calculs
=
new
Calculs
(
missionService
);
// Pilote pilote = piloteService.findById(5); // DON'T DELETE THIS PLEASE !!!
int
nbHeure
=
calculs
.
calculNbHeure
(
pilote
);
System
.
out
.
println
(
"CHECK nbHeure : "
+
nbHeure
);
//calcul nb de mission de combat
int
nbMissionCombat
=
calculs
.
calculNbMissionCombat
(
pilote
);
System
.
out
.
println
(
"nbMissionCombat : "
+
nbMissionCombat
);
//calcul total nb de mission
int
totalNbMission
=
calculs
.
calculTotalNbMission
(
pilote
);
System
.
out
.
println
(
"totalNbMission : "
+
totalNbMission
);
// update Grade de pilote
GradePilote
newGrade
=
calculs
.
checkGradePilote
(
nbHeure
,
totalNbMission
,
nbMissionCombat
);
pilote
.
setGrade
(
newGrade
);
System
.
out
.
println
(
"newGrade : "
+
newGrade
);
// update Type de pilote
TypePilote
newType
=
calculs
.
checkTypePilote
(
nbHeure
);
pilote
.
setType
(
newType
);
System
.
out
.
println
(
"newType : "
+
newType
);
// then update to db
piloteService
.
save
(
pilote
);
// ---------- FIN CALCUL NB HEURE ET PUIS UPDATE GRADE OU TYPE
}
return
"clotureMission"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/FicheChasseurController.java
View file @
c873add6
...
...
@@ -4,10 +4,53 @@
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.domains.Chasseur
;
import
fr.ldnr.starWars.enumerations.EtatChasseur
;
import
fr.ldnr.starWars.services.ChasseurService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
FicheChasseurController
{
private
final
ChasseurService
chasseurService
;
Integer
idChasseur
;
public
FicheChasseurController
(
ChasseurService
chasseurService
)
{
this
.
chasseurService
=
chasseurService
;
}
@GetMapping
(
"/ficheChasseur"
)
public
String
afficherFicheChasseur
(
@RequestParam
Long
id_chasseur
,
Model
model
)
{
model
.
addAttribute
(
"ficheChasseur"
,
chasseurService
.
trouverParId
(
id_chasseur
));
model
.
addAttribute
(
"etat"
,
chasseurService
.
listeEtatChasseur
());
idChasseur
=
id_chasseur
.
intValue
();
return
"ficheChasseur"
;
}
@PostMapping
(
"/ficheChasseur"
)
public
String
afficherFicheChasseur
(
Model
model
,
@RequestParam
(
value
=
"etat"
)
String
etat
)
{
// model.getAttribute("id_chasseur");
EtatChasseur
etat2
=
EtatChasseur
.
valueOf
(
etat
);
Chasseur
chasseur
=
chasseurService
.
findById
(
idChasseur
);
chasseur
.
setEtat
(
etat2
);
chasseurService
.
save
(
chasseur
);
System
.
out
.
println
(
"chasseur : "
+
chasseur
);
model
.
addAttribute
(
"ficheChasseur"
,
chasseurService
.
trouverParId
(
idChasseur
.
longValue
()));
model
.
addAttribute
(
"etat"
,
chasseurService
.
listeEtatChasseur
());
return
"ficheChasseur"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/FichePiloteController.java
View file @
c873add6
...
...
@@ -4,10 +4,81 @@
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.calculs.Calculs
;
import
fr.ldnr.starWars.domains.Affectation
;
import
fr.ldnr.starWars.domains.Chasseur
;
import
fr.ldnr.starWars.domains.Mission
;
import
fr.ldnr.starWars.domains.Pilote
;
import
fr.ldnr.starWars.enumerations.EtatChasseur
;
import
fr.ldnr.starWars.enumerations.EtatPilote
;
import
fr.ldnr.starWars.services.MissionService
;
import
fr.ldnr.starWars.services.PiloteService
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
FichePiloteController
{
private
final
PiloteService
piloteService
;
private
final
MissionService
missionService
;
Integer
idPilote
;
public
FichePiloteController
(
PiloteService
piloteService
,
MissionService
missionService
)
{
this
.
piloteService
=
piloteService
;
this
.
missionService
=
missionService
;
}
@GetMapping
(
"/fichePilote"
)
public
String
fichePilote
(
Model
model
,
@RequestParam
(
value
=
"id_pilote"
)
String
id_pilote
)
{
Pilote
pilote
=
new
Pilote
();
pilote
=
piloteService
.
findById
(
Integer
.
valueOf
(
id_pilote
));
model
.
addAttribute
(
"pilote"
,
pilote
);
Set
<
Mission
>
missions
=
new
HashSet
<>();
// Create a set to store pilotes in the Mission
for
(
Affectation
affectation
:
pilote
.
getAffectation
())
{
Mission
mission
=
affectation
.
getMission
();
if
(
mission
!=
null
)
{
missions
.
add
(
mission
);
}
}
//System.out.println("list de missions : + " + missions);
model
.
addAttribute
(
"missions"
,
missions
);
Calculs
calculs
=
new
Calculs
(
missionService
);
int
nbHeure
=
calculs
.
calculNbHeure
(
pilote
);
model
.
addAttribute
(
"nbHeure"
,
nbHeure
);
System
.
out
.
println
(
""
);
idPilote
=
Integer
.
valueOf
(
id_pilote
);
model
.
addAttribute
(
"ficheChasseur"
,
piloteService
.
findById
(
idPilote
));
model
.
addAttribute
(
"etat"
,
piloteService
.
listEtat
());
return
"fichePilote"
;
}
@PostMapping
(
"/fichePilote"
)
public
String
afficherFichepilote
(
Model
model
,
@RequestParam
(
value
=
"etat"
)
String
etat
)
{
// model.getAttribute("id_chasseur");
EtatPilote
etat2
=
EtatPilote
.
valueOf
(
etat
);
Pilote
pilote
=
piloteService
.
findById
(
idPilote
);
pilote
.
setEtat
(
etat2
);
piloteService
.
save
(
pilote
);
System
.
out
.
println
(
"chasseur : "
+
pilote
);
model
.
addAttribute
(
"pilote"
,
piloteService
.
findById
(
idPilote
));
model
.
addAttribute
(
"etat"
,
piloteService
.
listEtat
());
return
"fichePilote"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/InscriptionPiloteController.java
View file @
c873add6
...
...
@@ -4,10 +4,63 @@
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.domains.Pilote
;
import
fr.ldnr.starWars.enumerations.EtatPilote
;
import
fr.ldnr.starWars.enumerations.GradePilote
;
import
fr.ldnr.starWars.enumerations.RacePilote
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.services.PiloteService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
InscriptionPiloteController
{
private
final
PiloteService
piloteService
;
public
InscriptionPiloteController
(
PiloteService
piloteService
)
{
this
.
piloteService
=
piloteService
;
}
@GetMapping
(
"/inscriptionPilote"
)
public
String
inscriptionPilote
(
Model
model
)
{
model
.
addAttribute
(
"racePilotes"
,
piloteService
.
listRace
());
return
"inscriptionPilote"
;
}
@PostMapping
(
"/inscriptionPilote"
)
public
String
inscrirePilote
(
Model
model
,
@RequestParam
(
value
=
"nom"
)
String
nom
,
@RequestParam
(
value
=
"prenom"
)
String
prenom
,
@RequestParam
(
value
=
"races"
)
String
race
,
@RequestParam
(
value
=
"age"
)
String
age
)
{
model
.
addAttribute
(
"racePilotes"
,
piloteService
.
listRace
());
//System.out.println(piloteService.listRace());
RacePilote
race2
=
RacePilote
.
valueOf
(
race
);
Integer
age2
=
Integer
.
valueOf
(
age
);
if
(!
nom
.
isEmpty
())
{
Pilote
pilote
=
new
Pilote
();
pilote
.
setNom
(
nom
);
pilote
.
setPrenom
(
prenom
);
pilote
.
setRace
(
race2
);
pilote
.
setAge
(
age2
);
pilote
.
setEtat
(
EtatPilote
.
DISPONIBLE
);
pilote
.
setType
(
TypePilote
.
APPRENTI
);
pilote
.
setGrade
(
GradePilote
.
OFFICIER
);
System
.
out
.
println
(
"Check pilote : "
+
pilote
);
piloteService
.
save
(
pilote
);
return
"menu"
;
}
else
{
return
"inscriptionPilote"
;
}
}
}
src/main/java/fr/ldnr/starWars/controllers/ListeChasseurController.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.services.ChasseurService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
/**
*
* @author stag
*/
@Controller
public
class
ListeChasseurController
{
private
final
ChasseurService
chasseurService
;
public
ListeChasseurController
(
ChasseurService
chasseurService
)
{
this
.
chasseurService
=
chasseurService
;
}
@GetMapping
(
"/listeChasseur"
)
public
String
ListeChasseur
(
Model
model
)
{
model
.
addAttribute
(
"listeChasseur"
,
chasseurService
.
findAll
());
return
"listeChasseur"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/ListeMissionController.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.services.MissionService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
/**
*
* @author vincent
*/
@Controller
public
class
ListeMissionController
{
private
final
MissionService
missionService
;
public
ListeMissionController
(
MissionService
missionService
)
{
this
.
missionService
=
missionService
;
}
@GetMapping
(
"/listeMission"
)
public
String
listeMission
(
Model
model
)
{
model
.
addAttribute
(
"missions"
,
missionService
.
findAll
());
return
"listeMission"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/ListePiloteController.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.services.PiloteService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
ListePiloteController
{
private
final
PiloteService
piloteService
;
public
ListePiloteController
(
PiloteService
piloteService
)
{
this
.
piloteService
=
piloteService
;
}
@GetMapping
(
"/listePilote"
)
public
String
listePilote
(
Model
model
)
{
model
.
addAttribute
(
"pilotes"
,
piloteService
.
findAll
());
model
.
addAttribute
(
"typePilotes"
,
piloteService
.
listType
());
model
.
addAttribute
(
"gradePilotes"
,
piloteService
.
listGrade
());
model
.
addAttribute
(
"etatPilotes"
,
piloteService
.
listEtat
());
model
.
addAttribute
(
"racePilotes"
,
piloteService
.
listRace
());
model
.
addAttribute
(
"gradePilotes"
,
piloteService
.
listGrade
());
return
"listePilote"
;
}
// @PostMapping("/listePilote")
// public String listePilote(Model model,
// @RequestParam(value = "typePilotes") String types,
// @RequestParam(value = "gradePilotes") String grades,
// @RequestParam(value = "etatPilotes") String etats,
// @RequestParam(value = "racePilotes") String races) {
// model.addAttribute("pilotes", piloteService.listType());
// model.addAttribute("typePilotes", piloteService.findByType(TypePilote.valueOf(types)));
// return "listePilote";
// }
}
src/main/java/fr/ldnr/starWars/controllers/ListePiloteDisponible.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.enumerations.EtatPilote
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.services.PiloteService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
/**
*
* @author stag
*/
@Controller
public
class
ListePiloteDisponible
{
private
final
PiloteService
piloteService
;
public
ListePiloteDisponible
(
PiloteService
piloteService
)
{
this
.
piloteService
=
piloteService
;
}
@GetMapping
(
"/listePiloteDisponible"
)
public
String
listePilote
(
Model
model
)
{
//model.addAttribute("etats", piloteService.listEtat());
model
.
addAttribute
(
"pilotes"
,
piloteService
.
findByEtatAndType
(
EtatPilote
.
DISPONIBLE
,
TypePilote
.
COMBATTANT
));
return
"listePiloteDisponible"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/ListePiloteParEtat.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.enumerations.EtatPilote
;
import
fr.ldnr.starWars.enumerations.GradePilote
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.services.PiloteService
;
import
java.util.ArrayList
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
ListePiloteParEtat
{
private
final
PiloteService
piloteService
;
public
ListePiloteParEtat
(
PiloteService
piloteService
)
{
this
.
piloteService
=
piloteService
;
}
@GetMapping
(
"/listePiloteParEtat"
)
public
String
listePilote
(
Model
model
)
{
model
.
addAttribute
(
"etats"
,
piloteService
.
listEtat
());
return
"listePiloteParEtat"
;
}
@PostMapping
(
"/listePiloteParEtat"
)
public
String
listePilote
(
Model
model
,
@RequestParam
(
value
=
"etats"
)
String
etats
)
{
model
.
addAttribute
(
"etats"
,
piloteService
.
listEtat
());
// if (types.equals("all")) {
// model.addAttribute("pilotes", piloteService.findAll());
// }
model
.
addAttribute
(
"pilotes"
,
piloteService
.
findByEtat
(
EtatPilote
.
valueOf
(
etats
)));
return
"listePiloteParEtat"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/ListePiloteParGrade.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.enumerations.GradePilote
;
import
fr.ldnr.starWars.services.PiloteService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
ListePiloteParGrade
{
private
final
PiloteService
piloteService
;
public
ListePiloteParGrade
(
PiloteService
piloteService
)
{
this
.
piloteService
=
piloteService
;
}
@GetMapping
(
"/listePiloteParGrade"
)
public
String
listePilote
(
Model
model
)
{
model
.
addAttribute
(
"grades"
,
piloteService
.
listGrade
());
return
"listePiloteParGrade"
;
}
@PostMapping
(
"/listePiloteParGrade"
)
public
String
listePilote
(
Model
model
,
@RequestParam
(
value
=
"grades"
)
String
grades
)
{
model
.
addAttribute
(
"grades"
,
piloteService
.
listGrade
());
// if (types.equals("all")) {
// model.addAttribute("pilotes", piloteService.findAll());
// }
model
.
addAttribute
(
"pilotes"
,
piloteService
.
findByGrade
(
GradePilote
.
valueOf
(
grades
)));
return
"listePiloteParGrade"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/ListePiloteParType.java
0 → 100644
View file @
c873add6
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.enumerations.TypePilote
;
import
fr.ldnr.starWars.services.PiloteService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
ListePiloteParType
{
private
final
PiloteService
piloteService
;
public
ListePiloteParType
(
PiloteService
piloteService
)
{
this
.
piloteService
=
piloteService
;
}
@GetMapping
(
"/listePiloteParType"
)
public
String
listePilote
(
Model
model
)
{
model
.
addAttribute
(
"types"
,
piloteService
.
listType
());
return
"listePiloteParType"
;
}
@PostMapping
(
"/listePiloteParType"
)
public
String
listePilote
(
Model
model
,
@RequestParam
(
value
=
"types"
)
String
types
)
{
model
.
addAttribute
(
"types"
,
piloteService
.
listType
());
// if (types.equals("all")) {
// model.addAttribute("pilotes", piloteService.findAll());
// }
model
.
addAttribute
(
"pilotes"
,
piloteService
.
findByType
(
TypePilote
.
valueOf
(
types
)));
return
"listePiloteParType"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/
FinMission
Controller.java
→
src/main/java/fr/ldnr/starWars/controllers/
Menu
Controller.java
View file @
c873add6
...
...
@@ -4,10 +4,18 @@
*/
package
fr.ldnr.starWars.controllers
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
/**
*
* @author
stag
* @author
Fabien
*/
public
class
FinMissionController
{
@Controller
public
class
MenuController
{
@GetMapping
(
"/menu"
)
public
String
Menu
()
{
return
"menu"
;
}
}
src/main/java/fr/ldnr/starWars/controllers/ModifierEtatChasseurController.java
0 → 100644
View file @
c873add6
///*
// * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
// * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
// */
//package fr.ldnr.starWars.controllers;
//
//import fr.ldnr.starWars.enumerations.EtatChasseur;
//import fr.ldnr.starWars.services.ChasseurService;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//
///**
// *
// * @author Johad
// */
//@Controller
//public class ModifierEtatChasseurController {
//
// private final ChasseurService chasseurService;
//
// public ModifierEtatChasseurController(ChasseurService chasseurService) {
// this.chasseurService = chasseurService;
// }
//
// @GetMapping("/modifierEtatChasseur")
// public String modifierEtatPilote(Model model) {
// model.addAttribute("etatChasseur", chasseurService.listeTypeChasseur());
// return "modifierEtatChasseur";
// }
//
// @PostMapping("/modifierEtatChasseur")
// public String modifierEtatChasseur(@RequestParam Long id_chasseur, Model model,
// @RequestParam(value="etat") String etat) {
//
// model.addAttribute("etatChasseur", chasseurService.modifierEtat(id_chasseur, EtatChasseur.valueOf(etat)));
// return "modifierEtatChasseur";
// }
//}
src/main/java/fr/ldnr/starWars/controllers/NouveauChasseurController.java
View file @
c873add6
...
...
@@ -4,10 +4,49 @@
*/
package
fr.ldnr.starWars.controllers
;
import
fr.ldnr.starWars.domains.Chasseur
;
import
fr.ldnr.starWars.enumerations.EtatChasseur
;
import
fr.ldnr.starWars.enumerations.TypeChasseur
;
import
fr.ldnr.starWars.services.ChasseurService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
*
* @author stag
*/
@Controller
public
class
NouveauChasseurController
{
private
final
ChasseurService
chasseurService
;
public
NouveauChasseurController
(
ChasseurService
cs
)
{
chasseurService
=
cs
;
}
@GetMapping
(
"/nouveauChasseur"
)
public
String
sauvegarderChasseur
(
Model
model
)
{
model
.
addAttribute
(
"type"
,
chasseurService
.
listeTypeChasseur
());
return
"nouveauChasseur"
;
}
@PostMapping
(
"/nouveauChasseur"
)
public
String
sauvegardeChasseur
(
Model
model
,
@RequestParam
(
value
=
"typeChasseur"
)
String
typeChasseur
)
{
model
.
addAttribute
(
"type"
,
chasseurService
.
listeTypeChasseur
());
if
(!
typeChasseur
.
isEmpty
())
{
Chasseur
chasseur
=
new
Chasseur
();
chasseur
.
setType
(
TypeChasseur
.
valueOf
(
typeChasseur
));
chasseur
.
setEtat
(
EtatChasseur
.
OPERATIONNEL
);
chasseurService
.
save
(
chasseur
);
return
"menu"
;
}
return
"nouveauChasseur"
;
}
}
Prev
1
2
3
4
5
Next