brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [2/7] git commit: Sort sensors/config/effectors in catalog summaries by name
Date Fri, 18 Jul 2014 12:38:25 GMT
Sort sensors/config/effectors in catalog summaries by name


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/1035445a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/1035445a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/1035445a

Branch: refs/heads/master
Commit: 1035445ac91dffc5f7d6b0b3b37ffd27641d0086
Parents: 64880aa
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Thu Jul 10 13:26:22 2014 +0100
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Wed Jul 16 19:19:50 2014 +0100

----------------------------------------------------------------------
 .../rest/transform/CatalogTransformer.java        | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/1035445a/usage/rest-server/src/main/java/brooklyn/rest/transform/CatalogTransformer.java
----------------------------------------------------------------------
diff --git a/usage/rest-server/src/main/java/brooklyn/rest/transform/CatalogTransformer.java
b/usage/rest-server/src/main/java/brooklyn/rest/transform/CatalogTransformer.java
index c8164e6..a69f94d 100644
--- a/usage/rest-server/src/main/java/brooklyn/rest/transform/CatalogTransformer.java
+++ b/usage/rest-server/src/main/java/brooklyn/rest/transform/CatalogTransformer.java
@@ -42,6 +42,7 @@ import brooklyn.rest.domain.EffectorSummary;
 import brooklyn.rest.domain.EntityConfigSummary;
 import brooklyn.rest.domain.PolicyConfigSummary;
 import brooklyn.rest.domain.SensorSummary;
+import brooklyn.rest.domain.SummaryComparators;
 import brooklyn.rest.util.BrooklynRestResourceUtils;
 import brooklyn.util.collections.MutableMap;
 
@@ -58,15 +59,18 @@ public class CatalogTransformer {
         EntityDynamicType typeMap = EntityTypes.getDefinedEntityType(spec.getType());
         EntityType type = typeMap.getSnapshot();
 
-        Set<EntityConfigSummary> config = Sets.newLinkedHashSet();
-        Set<SensorSummary> sensors = Sets.newLinkedHashSet();
-        Set<EffectorSummary> effectors = Sets.newLinkedHashSet();
+        Set<EntityConfigSummary> config = Sets.newTreeSet(SummaryComparators.nameComparator());
+        Set<SensorSummary> sensors = Sets.newTreeSet(SummaryComparators.nameComparator());
+        Set<EffectorSummary> effectors = Sets.newTreeSet(SummaryComparators.nameComparator());
 
-        for (ConfigKey<?> x: type.getConfigKeys()) config.add(EntityTransformer.entityConfigSummary(x,
typeMap.getConfigKeyField(x.getName())));
-        for (Sensor<?> x: type.getSensors()) sensors.add(SensorTransformer.sensorSummaryForCatalog(x));
-        for (Effector<?> x: type.getEffectors()) effectors.add(EffectorTransformer.effectorSummaryForCatalog(x));
+        for (ConfigKey<?> x: type.getConfigKeys())
+            config.add(EntityTransformer.entityConfigSummary(x, typeMap.getConfigKeyField(x.getName())));
+        for (Sensor<?> x: type.getSensors())
+            sensors.add(SensorTransformer.sensorSummaryForCatalog(x));
+        for (Effector<?> x: type.getEffectors())
+            effectors.add(EffectorTransformer.effectorSummaryForCatalog(x));
 
-        return new CatalogEntitySummary(item.getId(), item.getName(), 
+        return new CatalogEntitySummary(item.getId(), item.getName(),
             item.getRegisteredTypeName(), item.getJavaType(), 
             item.getRegisteredTypeName(),
             item.getPlanYaml(),


Mime
View raw message