Skip to content
Snippets Groups Projects
Commit c3ff2f6d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6676 CR extract method

parent 9b58497d
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ import java.util.Objects; ...@@ -6,6 +6,7 @@ import java.util.Objects;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.hateoas.EntityModel; import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.LinkRelation; import org.springframework.hateoas.LinkRelation;
import org.springframework.hateoas.server.RepresentationModelProcessor; import org.springframework.hateoas.server.RepresentationModelProcessor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -36,14 +37,19 @@ class CollaborationVorgangProcessor implements RepresentationModelProcessor<Enti ...@@ -36,14 +37,19 @@ class CollaborationVorgangProcessor implements RepresentationModelProcessor<Enti
return model; return model;
} }
var searchOrgnisationsEinheitLink = linkTo(methodOn(OrganisationsEinheitController.class).search(null)).withRel(
REL_SEARCH_ORGANISATIONS_EINHEIT);
var searchFachstelleLink = linkTo(methodOn(FachstelleController.class).search(null)).withRel(REL_SEARCH_FACHSTELLE);
return ModelBuilder.fromModel(model) return ModelBuilder.fromModel(model)
.ifMatch(() -> !collaborationService.hasCollaboration(vorgang.getId())) .ifMatch(() -> !collaborationService.hasCollaboration(vorgang.getId()))
.addLinks(searchOrgnisationsEinheitLink, searchFachstelleLink) .addLinks(buildSearchOrganisationsEinheitLink(), buildSearchFachstelleLink())
.addLink(linkTo(methodOn(CollaborationController.class).getAllByVorgangId(vorgang.getId())).withRel(REL_COLLABORATIONS)) .addLink(linkTo(methodOn(CollaborationController.class).getAllByVorgangId(vorgang.getId())).withRel(REL_COLLABORATIONS))
.buildModel(); .buildModel();
} }
private Link buildSearchOrganisationsEinheitLink() {
return linkTo(methodOn(OrganisationsEinheitController.class).search(null)).withRel(
REL_SEARCH_ORGANISATIONS_EINHEIT);
}
private Link buildSearchFachstelleLink() {
return linkTo(methodOn(FachstelleController.class).search(null)).withRel(REL_SEARCH_FACHSTELLE);
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment