Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
abbenhoumi
IntegrationProjet
Commits
4fe641dc
Commit
4fe641dc
authored
Mar 31, 2020
by
Bane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip creation de nouvelle poubelle
parent
e8291549
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
3 deletions
+30
-3
pom.xml
pom.xml
+8
-3
src/main/java/isima/f2/contrats/IPoubelle.java
src/main/java/isima/f2/contrats/IPoubelle.java
+1
-0
src/main/java/isima/f2/controllers/PoubelleController.java
src/main/java/isima/f2/controllers/PoubelleController.java
+17
-0
src/main/java/isima/f2/services/ImpPoubelle.java
src/main/java/isima/f2/services/ImpPoubelle.java
+4
-0
No files found.
pom.xml
View file @
4fe641dc
...
...
@@ -59,9 +59,14 @@
<artifactId>
json
</artifactId>
<version>
20190722
</version>
</dependency>
</dependencies>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.8.6
</version>
</dependency>
</dependencies>
<build>
<plugins>
...
...
src/main/java/isima/f2/contrats/IPoubelle.java
View file @
4fe641dc
...
...
@@ -13,4 +13,5 @@ public interface IPoubelle {
public
List
<
Poubelle
>
getPoubelles
();
public
void
viderPoubelle
(
long
id
);
public
void
updateContenuPoubelle
(
long
id
,
double
contenu
);
public
void
creerPoubelle
(
Poubelle
nouvellePoubelle
);
}
src/main/java/isima/f2/controllers/PoubelleController.java
View file @
4fe641dc
...
...
@@ -3,6 +3,7 @@ package isima.f2.controllers;
import
java.util.List
;
import
java.util.Map
;
import
com.google.gson.Gson
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -45,4 +46,20 @@ public class PoubelleController {
public
String
testpost
(
@RequestParam
Map
<
String
,
String
>
allParams
)
{
return
"Les paramètres sont"
+
allParams
.
entrySet
();
}
@PostMapping
(
"/nouvelle"
)
@ResponseBody
public
String
creerPoubelle
(
@RequestParam
Map
<
String
,
String
>
allParams
)
{
String
poubelleJSON
=
allParams
.
get
(
"poubelle"
);
poubelleJSON
=
poubelleJSON
.
replace
(
"Poubelle"
,
""
);
System
.
out
.
println
(
"Poubellllllllllllleeeeeeeee ******** : "
+
poubelleJSON
);
Gson
gson
=
new
Gson
();
Poubelle
nouvellePoubelle
=
gson
.
fromJson
(
poubelleJSON
,
Poubelle
.
class
);
//update poubelle id ===> last id + 1
nouvellePoubelle
.
setId
((
long
)(
poubelles
.
getPoubelles
().
size
()+
1
));
//nouvellePoubelle.setId(6L);
System
.
out
.
println
(
"**************** "
+
nouvellePoubelle
.
toString
()
+
"****************"
);
poubelles
.
creerPoubelle
(
nouvellePoubelle
);
return
"La nouvelle poubelle a été créée avec succes"
;
}
}
src/main/java/isima/f2/services/ImpPoubelle.java
View file @
4fe641dc
...
...
@@ -55,4 +55,8 @@ public class ImpPoubelle implements IPoubelle{
poubelleDAO
.
updatePoubelleSetCapacity
(
id
,
contenu
);
}
@Override
public
void
creerPoubelle
(
Poubelle
nouvellePoubelle
)
{
poubelleDAO
.
save
(
nouvellePoubelle
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment