OSDir


[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_r192711842
  
    --- Diff: rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ApplicationResource.java ---
    @@ -194,16 +218,42 @@ private EntityDetail fromEntity(Entity entity) {
                     Entity entity = mgmt().getEntityManager().getEntity(entityId.trim());
                     while (entity != null && entity.getParent() != null) {
                         if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) {
    -                        entitySummaries.add(addSensors(fromEntity(entity), entity, extraSensors));
    +                        entitySummaries.add(addSensorsByName((EntityDetail)fromEntity(entity, false, -1, null, null), entity, extraSensors));
                         }
                         entity = entity.getParent();
                     }
                 }
             }
             return entitySummaries;
         }
    +    
    +    @Override
    +    public List<EntitySummary> details(String entityIds, boolean includeAllApps, String extraSensorsGlobsS, String extraConfigGlobsS, int depth) {
    +        List<String> extraSensorGlobs = JavaStringEscapes.unwrapOptionallyQuotedJavaStringList(extraSensorsGlobsS);
    +
    +        Map<String, EntitySummary> entitySummaries = MutableMap.of();
    +        if (includeAllApps) {
    +            for (Entity application : mgmt().getApplications()) {
    +                entitySummaries.put(application.getId(), fromEntity(application, true, depth, extraSensorGlobs, extraSensorGlobs));
    +            }
    +        }
    +
    +        if (Strings.isNonBlank(entityIds)) {
    +            List<String> extraEntities = JavaStringEscapes.unwrapOptionallyQuotedJavaStringList(entityIds);
    +            for (String entityId: extraEntities) {
    +                Entity entity = mgmt().getEntityManager().getEntity(entityId.trim());
    +                while (entity != null && !entitySummaries.containsKey(entity.getId())) {
    +                    if (Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.SEE_ENTITY, entity)) {
    +                        entitySummaries.put(entity.getId(), fromEntity(entity, true, depth, extraSensorGlobs, extraSensorGlobs));
    --- End diff --
    
    same as above


---