Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ArchiAServices
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
elisabeth kee
ArchiAServices
Commits
d1a28cb5
Commit
d1a28cb5
authored
Apr 11, 2022
by
elisabeth kee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mise à jour de tous les patchs
parent
dd0b4e78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
ProfileResource.java
...a/com/example/trial/profile/resource/ProfileResource.java
+15
-15
No files found.
src/main/java/com/example/trial/profile/resource/ProfileResource.java
View file @
d1a28cb5
...
...
@@ -71,13 +71,14 @@ public class ProfileResource {
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Path
(
"{id}/updateAge"
)
public
Response
updateAge
(
@PathParam
(
"id"
)
Long
id
,
Profile
p
)
{
int
age
=
p
.
getAge
();
public
Response
updateAge
(
@PathParam
(
"id"
)
Long
id
,
String
newAge
)
{
String
newAge2
=
newAge
.
replace
(
'"'
,
' '
);
int
newAge3
=
Integer
.
parseInt
(
newAge2
);
Optional
<
Profile
>
optional
=
profileRepository
.
findById
(
id
);
if
(
optional
.
isPresent
())
{
Profile
pBDD
=
optional
.
get
();
pBDD
.
setAge
(
age
);
pBDD
.
setAge
(
newAge3
);
profileRepository
.
save
(
pBDD
);
return
Response
.
ok
(
pBDD
).
build
();
}
else
{
...
...
@@ -107,13 +108,13 @@ public class ProfileResource {
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Path
(
"{id}/updateGender"
)
public
Response
updateGender
(
@PathParam
(
"id"
)
Long
id
,
Profile
p
)
{
String
gender
=
p
.
getGender
(
);
public
Response
updateGender
(
@PathParam
(
"id"
)
Long
id
,
String
newGender
)
{
String
newGender2
=
newGender
.
replace
(
'"'
,
' '
);
Optional
<
Profile
>
optional
=
profileRepository
.
findById
(
id
);
if
(
optional
.
isPresent
())
{
Profile
pBDD
=
optional
.
get
();
pBDD
.
setGender
(
gender
);
pBDD
.
setGender
(
newGender2
.
strip
()
);
profileRepository
.
save
(
pBDD
);
return
Response
.
ok
(
pBDD
).
build
();
}
else
{
...
...
@@ -125,13 +126,13 @@ public class ProfileResource {
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Path
(
"{id}/updatePet"
)
public
Response
updatePet
(
@PathParam
(
"id"
)
Long
id
,
Profile
p
)
{
String
pet
=
p
.
getPet
(
);
public
Response
updatePet
(
@PathParam
(
"id"
)
Long
id
,
String
newPet
)
{
String
newPet2
=
newPet
.
replace
(
'"'
,
' '
);
Optional
<
Profile
>
optional
=
profileRepository
.
findById
(
id
);
if
(
optional
.
isPresent
())
{
Profile
pBDD
=
optional
.
get
();
pBDD
.
setPet
(
pet
);
pBDD
.
setPet
(
newPet2
.
strip
()
);
profileRepository
.
save
(
pBDD
);
return
Response
.
ok
(
pBDD
).
build
();
}
else
{
...
...
@@ -143,13 +144,13 @@ public class ProfileResource {
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Path
(
"{id}/updateContact"
)
public
Response
updateContact
(
@PathParam
(
"id"
)
Long
id
,
Profile
p
)
{
String
partner
=
p
.
getContact
(
);
public
Response
updateContact
(
@PathParam
(
"id"
)
Long
id
,
String
newContact
)
{
String
newContact2
=
newContact
.
replace
(
'"'
,
' '
);
Optional
<
Profile
>
optional
=
profileRepository
.
findById
(
id
);
if
(
optional
.
isPresent
())
{
Profile
pBDD
=
optional
.
get
();
pBDD
.
setContact
(
partner
);
pBDD
.
setContact
(
newContact2
.
strip
()
);
profileRepository
.
save
(
pBDD
);
return
Response
.
ok
(
pBDD
).
build
();
}
else
{
...
...
@@ -161,13 +162,12 @@ public class ProfileResource {
@Consumes
(
MediaType
.
APPLICATION_JSON
)
@Produces
(
MediaType
.
APPLICATION_JSON
)
@Path
(
"{id}/updateLovers"
)
public
Response
updateLovers
(
@PathParam
(
"id"
)
Long
id
,
Profile
p
)
{
List
<
Lover
>
lovers
=
p
.
getLovers
();
public
Response
updateLovers
(
@PathParam
(
"id"
)
Long
id
,
List
<
Lover
>
newLovers
)
{
Optional
<
Profile
>
optional
=
profileRepository
.
findById
(
id
);
if
(
optional
.
isPresent
())
{
Profile
pBDD
=
optional
.
get
();
pBDD
.
setLovers
(
l
overs
);
pBDD
.
setLovers
(
newL
overs
);
profileRepository
.
save
(
pBDD
);
return
Response
.
ok
(
pBDD
).
build
();
}
else
{
...
...
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