|
13 | 13 | import org.springframework.hateoas.CollectionModel; |
14 | 14 | import org.springframework.hateoas.EntityModel; |
15 | 15 | import org.springframework.hateoas.Link; |
| 16 | +import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder; |
16 | 17 | import org.springframework.http.HttpStatus; |
17 | 18 | import org.springframework.http.ResponseEntity; |
18 | 19 | import org.springframework.web.bind.annotation.*; |
@@ -52,24 +53,24 @@ private static List<Link> getDesignModelCollectionLinks() { |
52 | 53 |
|
53 | 54 |
|
54 | 55 | private static List<Link> getDesignModelLinks(UUID designModelId, String selfRel) { |
55 | | - Map<String, Object> linkMap = new HashMap<>(); |
| 56 | + Map<String, WebMvcLinkBuilder> linkMap = new HashMap<>(); |
56 | 57 |
|
57 | | - linkMap.put("designModels", methodOn(DesignModelController.class).getDesignModels()); |
58 | | - linkMap.put("designModel", methodOn(DesignModelController.class).getDesignModel(designModelId)); |
59 | | - linkMap.put("patterns", methodOn(DesignModelController.class).getDesignModelPatternInstances(designModelId)); |
60 | | - linkMap.put("edges", methodOn(DesignModelController.class).getDesignModelPatternEdges(designModelId)); |
61 | | - linkMap.put("edgeTypes", methodOn(DesignModelController.class).getDesignModelPatternEdgeTypes()); |
62 | | - linkMap.put("concreteSolutions", methodOn(DesignModelController.class).checkConcreteSolutions(designModelId)); |
63 | | - linkMap.put("aggregate", methodOn(DesignModelController.class).aggregateConcreteSolutions(designModelId, null)); |
| 58 | + linkMap.put("designModels", linkTo(methodOn(DesignModelController.class).getDesignModels())); |
| 59 | + linkMap.put("designModel", linkTo(methodOn(DesignModelController.class).getDesignModel(designModelId))); |
| 60 | + linkMap.put("patterns", linkTo(methodOn(DesignModelController.class).getDesignModelPatternInstances(designModelId))); |
| 61 | + linkMap.put("edges", linkTo(methodOn(DesignModelController.class).getDesignModelPatternEdges(designModelId))); |
| 62 | + linkMap.put("edgeTypes", linkTo(methodOn(DesignModelController.class).getDesignModelPatternEdgeTypes())); |
| 63 | + linkMap.put("concreteSolutions",linkTo( methodOn(DesignModelController.class).checkConcreteSolutions(designModelId))); |
| 64 | + linkMap.put("aggregate", linkTo(methodOn(DesignModelController.class).aggregateConcreteSolutions(designModelId, null))); |
64 | 65 |
|
65 | 66 | List<Link> linkList = new ArrayList<>(); |
66 | 67 | if (linkMap.containsKey(selfRel)) { |
67 | | - linkList.add(linkTo(linkMap.get(selfRel)).withSelfRel()); |
| 68 | + linkList.add(linkMap.get(selfRel).withSelfRel()); |
68 | 69 | } else { |
69 | 70 | log.error("_self link for " + selfRel + " not found in linkMap"); |
70 | 71 | } |
71 | | - for (Map.Entry<String, Object> linkPair : linkMap.entrySet()) { |
72 | | - linkList.add(linkTo(linkPair.getValue()).withRel(linkPair.getKey())); |
| 72 | + for (Map.Entry<String, WebMvcLinkBuilder> linkPair : linkMap.entrySet()) { |
| 73 | + linkList.add(linkPair.getValue().withRel(linkPair.getKey())); |
73 | 74 | } |
74 | 75 |
|
75 | 76 | return linkList; |
|
0 commit comments