git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] brooklyn-server pull request #967: add an /applications/details endpoint whi...


Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/967#discussion_r192716302
  
    --- Diff: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java ---
    @@ -106,7 +112,16 @@
         @Context
         private UriInfo uriInfo;
     
    -    private EntityDetail fromEntity(Entity entity) {
    +    private EntitySummary fromEntity(Entity entity, boolean includeTags, int detailDepth, List<String> extraSensorGlobs, List<String> extraConfigGlobs) {
    +        if (detailDepth==0) {
    +            return new EntitySummary(
    +                entity.getId(), 
    +                entity.getDisplayName(),
    +                entity.getEntityType().getName(),
    +                entity.getCatalogItemId(),
    +                MutableMap.of("self", EntityTransformer.entityUri(entity, ui.getBaseUriBuilder())) );
    --- End diff --
    
    An observation - not something necessary but I'd suggest let's add the `self` link into the entity in all cases; this would be more consistent and would mean you could always just use the link if you wanted it, rather than have to check whether it is there and calculate it if not.  It would just mean an extra parameter in the entity detail constructor at 161 below.


---