Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Foundation
IT
Websites
membership.eclipse.org
Commits
0a2e1315
Commit
0a2e1315
authored
Dec 15, 2021
by
Martin Lowe
🇨🇦
Browse files
Change org info update to create orginfo when missing instead of failing
parent
f6f54d41
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/eclipsefoundation/react/resources/OrganizationResource.java
View file @
0a2e1315
...
...
@@ -154,18 +154,23 @@ public class OrganizationResource extends AbstractRESTResource {
@Path
(
"{orgID:\\d+}"
)
public
Response
update
(
@PathParam
(
"orgID"
)
String
organizationID
,
OrganizationInfoUpdateRequest
updateRequest
)
{
// get ref and update the object
OrganizationInformation
infoRef
=
eclipseDBDao
.
getReference
(
Integer
.
valueOf
(
organizationID
),
OrganizationInformation
.
class
);
if
(
infoRef
==
null
)
{
return
Response
.
status
(
404
).
build
();
MultivaluedMap
<
String
,
String
>
params
=
new
MultivaluedMapImpl
<>();
params
.
add
(
DefaultUrlParameterNames
.
ID
.
getName
(),
organizationID
);
List
<
OrganizationInformation
>
infoRefs
=
eclipseDBDao
.
get
(
new
RDBMSQuery
<>(
wrap
,
filters
.
get
(
OrganizationInformation
.
class
),
params
));
// if ref doesn't exist, create one
OrganizationInformation
infoRef
;
if
(
infoRefs
.
isEmpty
())
{
infoRef
=
new
OrganizationInformation
();
infoRef
.
setOrganizationID
(
Integer
.
valueOf
(
organizationID
));
}
else
{
infoRef
=
infoRefs
.
get
(
0
);
}
infoRef
.
setCompanyUrl
(
updateRequest
.
getCompanyUrl
());
infoRef
.
setShortDescription
(
updateRequest
.
getDescription
());
infoRef
.
setLongDescription
(
updateRequest
.
getDescription
());
// create the param map and update the org info
MultivaluedMap
<
String
,
String
>
params
=
new
MultivaluedMapImpl
<>();
params
.
add
(
DefaultUrlParameterNames
.
ID
.
getName
(),
organizationID
);
// update the org info
List
<
OrganizationInformation
>
updatedOrg
=
eclipseDBDao
.
add
(
new
RDBMSQuery
<>(
wrap
,
filters
.
get
(
OrganizationInformation
.
class
),
params
),
Arrays
.
asList
(
infoRef
));
if
(
updatedOrg
.
isEmpty
())
{
...
...
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