Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
alfa
Commits
17669612
Commit
17669612
authored
1 week ago
by
Martin
Browse files
Options
Downloads
Patches
Plain Diff
OZG-7872 revert switch case
parent
28a05fb3
No related branches found
Branches containing commit
No related tags found
1 merge request
!26
OZG-7872 OZG-8039 add related resource link on postfach
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
alfa-service/src/main/java/de/ozgcloud/alfa/common/command/CommandModelAssembler.java
+14
-25
14 additions, 25 deletions
...e/ozgcloud/alfa/common/command/CommandModelAssembler.java
with
14 additions
and
25 deletions
alfa-service/src/main/java/de/ozgcloud/alfa/common/command/CommandModelAssembler.java
+
14
−
25
View file @
17669612
...
...
@@ -34,6 +34,7 @@ import org.springframework.hateoas.EntityModel;
import
org.springframework.hateoas.Link
;
import
org.springframework.hateoas.LinkRelation
;
import
org.springframework.hateoas.server.RepresentationModelAssembler
;
import
org.springframework.hateoas.server.mvc.WebMvcLinkBuilder
;
import
org.springframework.stereotype.Component
;
import
de.ozgcloud.alfa.bescheid.BescheidController
;
...
...
@@ -86,31 +87,19 @@ class CommandModelAssembler implements RepresentationModelAssembler<Command, Ent
Link
effectedResourceLinkByOrderType
(
Command
entity
)
{
var
type
=
entity
.
getCommandOrder
().
getType
();
if
(
type
==
CommandOrder
.
Type
.
FORWARDING
)
{
return
linkTo
(
methodOn
(
ForwardingController
.
class
).
findByVorgangId
(
entity
.
getVorgangId
())).
withRel
(
REL_EFFECTED_RESOURCE
);
}
if
(
type
==
CommandOrder
.
Type
.
KOMMENTAR
)
{
return
linkTo
(
KommentarController
.
class
).
slash
(
entity
.
getRelationId
()).
withRel
(
REL_EFFECTED_RESOURCE
);
}
if
(
type
==
CommandOrder
.
Type
.
VORGANG
)
{
return
linkTo
(
VorgangController
.
class
).
slash
(
entity
.
getRelationId
()).
withRel
(
REL_EFFECTED_RESOURCE
);
}
if
(
type
==
CommandOrder
.
Type
.
VORGANG_LIST
)
{
return
linkTo
(
VorgangController
.
class
).
withRel
(
REL_EFFECTED_RESOURCE
);
}
if
(
type
==
CommandOrder
.
Type
.
WIEDERVORLAGE
)
{
return
linkTo
(
WiedervorlageController
.
class
).
slash
(
entity
.
getRelationId
()).
withRel
(
REL_EFFECTED_RESOURCE
);
}
if
(
type
==
CommandOrder
.
Type
.
BESCHEID
)
{
return
linkTo
(
methodOn
(
BescheidController
.
class
).
getDraft
(
entity
.
getVorgangId
())).
withRel
(
REL_EFFECTED_RESOURCE
);
}
if
(
type
==
CommandOrder
.
Type
.
DOCUMENT
)
{
return
linkTo
(
DocumentController
.
class
).
slash
(
entity
.
getCreatedResource
()).
withRel
(
REL_EFFECTED_RESOURCE
);
}
if
(
type
==
CommandOrder
.
Type
.
COLLABORATION
)
{
return
linkTo
(
methodOn
(
CollaborationByVorgangController
.
class
).
getAllByVorgangId
(
entity
.
getVorgangId
())).
withRel
(
REL_EFFECTED_RESOURCE
);
}
throw
new
IllegalArgumentException
(
"Unknown CommandOrder: "
+
entity
.
getOrder
());
WebMvcLinkBuilder
linkBuilder
=
switch
(
type
)
{
case
FORWARDING
->
linkTo
(
methodOn
(
ForwardingController
.
class
).
findByVorgangId
(
entity
.
getVorgangId
()));
case
KOMMENTAR
->
linkTo
(
KommentarController
.
class
).
slash
(
entity
.
getRelationId
());
case
VORGANG
->
linkTo
(
VorgangController
.
class
).
slash
(
entity
.
getRelationId
());
case
VORGANG_LIST
->
linkTo
(
VorgangController
.
class
);
case
WIEDERVORLAGE
->
linkTo
(
WiedervorlageController
.
class
).
slash
(
entity
.
getRelationId
());
case
BESCHEID
->
linkTo
(
methodOn
(
BescheidController
.
class
).
getDraft
(
entity
.
getVorgangId
()));
case
DOCUMENT
->
linkTo
(
DocumentController
.
class
).
slash
(
entity
.
getCreatedResource
());
case
COLLABORATION
->
linkTo
(
methodOn
(
CollaborationByVorgangController
.
class
).
getAllByVorgangId
(
entity
.
getVorgangId
()));
default
->
throw
new
IllegalArgumentException
(
"Unknown CommandOrder: "
+
entity
.
getOrder
());
};
return
linkBuilder
.
withRel
(
REL_EFFECTED_RESOURCE
);
}
public
CollectionModel
<
EntityModel
<
Command
>>
toCollectionModel
(
Stream
<
Command
>
entities
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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