Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Plan
Issues
27
Issue boards
Milestones
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
ARSnova
ARSnova Backend
Commits
1a53e14f
Commit
1a53e14f
authored
7 years ago
by
Daniel Gerhardt
Browse files
Options
Downloads
Patches
Plain Diff
Add support for requests with multiple entity IDs
parent
2502ca5e
Branches
Branches containing commit
1 merge request
!89
Foundation for development of version 3.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/thm/arsnova/controller/AbstractEntityController.java
+8
-0
8 additions, 0 deletions
...a/de/thm/arsnova/controller/AbstractEntityController.java
with
8 additions
and
0 deletions
src/main/java/de/thm/arsnova/controller/AbstractEntityController.java
+
8
−
0
View file @
1a53e14f
...
...
@@ -31,9 +31,11 @@ import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
javax.naming.OperationNotSupportedException
;
import
java.io.IOException
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -49,6 +51,7 @@ public abstract class AbstractEntityController<E extends Entity> {
protected
static
final
String
DEFAULT_ID_MAPPING
=
"/{id}"
;
protected
static
final
String
DEFAULT_FIND_MAPPING
=
"/find"
;
protected
static
final
String
GET_MAPPING
=
DEFAULT_ID_MAPPING
;
protected
static
final
String
GET_MULTIPLE_MAPPING
=
DEFAULT_ROOT_MAPPING
;
protected
static
final
String
PUT_MAPPING
=
DEFAULT_ID_MAPPING
;
protected
static
final
String
POST_MAPPING
=
DEFAULT_ROOT_MAPPING
;
protected
static
final
String
PATCH_MAPPING
=
DEFAULT_ID_MAPPING
;
...
...
@@ -66,6 +69,11 @@ public abstract class AbstractEntityController<E extends Entity> {
return
entityService
.
get
(
id
);
}
@GetMapping
(
GET_MULTIPLE_MAPPING
)
public
Iterable
<
E
>
getMultiple
(
@RequestParam
final
Collection
<
String
>
ids
)
{
return
entityService
.
get
(
ids
);
}
@PutMapping
(
PUT_MAPPING
)
public
void
put
(
@RequestBody
final
E
entity
)
{
E
oldEntity
=
entityService
.
get
(
entity
.
getId
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment