Skip to content
This repository was archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
[#1] extended hal links
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Pozzi committed Oct 11, 2019
1 parent 76d3674 commit 4767d0f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/main/java/de/bonndan/nivio/api/LandscapeDTOFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import de.bonndan.nivio.model.Landscape;
import de.bonndan.nivio.output.docs.DocsController;
import de.bonndan.nivio.output.jgraphx.JGraphXRenderController;
import org.springframework.http.MediaType;

import java.io.IOException;

Expand All @@ -29,11 +30,22 @@ public static LandscapeDTO from(Landscape item) {
}

public static void addLinks(LandscapeDTO dto) {
dto.add(linkTo(methodOn(ApiController.class).landscape(dto.getIdentifier())).withSelfRel());
dto.add(linkTo(methodOn(ApiController.class).landscape(dto.getIdentifier()))
.withSelfRel()
.withMedia(MediaType.APPLICATION_JSON_UTF8_VALUE)
);
dto.add(linkTo(methodOn(ApiController.class).items(dto.getIdentifier())).withRel("items"));
dto.add(linkTo(methodOn(ApiController.class).reindex(dto.getIdentifier())).withRel("reindex"));
dto.add(linkTo(methodOn(ApiController.class).reindex(dto.getIdentifier()))
.withRel("reindex")
.withMedia(MediaType.APPLICATION_JSON_UTF8_VALUE)
.withTitle("Reindex the source")
);
try {
dto.add(linkTo(methodOn(JGraphXRenderController.class).pngResource(dto.getIdentifier())).withRel("png"));
dto.add(linkTo(methodOn(JGraphXRenderController.class).pngResource(dto.getIdentifier()))
.withRel("png")
.withMedia(MediaType.IMAGE_PNG_VALUE)
.withTitle("Rendered Landscape")
);
} catch (IOException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit 4767d0f

Please sign in to comment.