You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/08/26 15:33:14 UTC

svn commit: r1757882 - /qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfigurationExtractor.java

Author: rgodfrey
Date: Fri Aug 26 15:33:14 2016
New Revision: 1757882

URL: http://svn.apache.org/viewvc?rev=1757882&view=rev
Log:
QPID-7359 : Applying patch from Lorenz for final tidy-up

Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfigurationExtractor.java

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfigurationExtractor.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfigurationExtractor.java?rev=1757882&r1=1757881&r2=1757882&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfigurationExtractor.java (original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/ConfigurationExtractor.java Fri Aug 26 15:33:14 2016
@@ -81,7 +81,9 @@ public class ConfigurationExtractor
                 }
                 else if (ConfiguredObject.class.isAssignableFrom(attributeDefinition.getType()))
                 {
-                    results.put(attr.getKey(), extractConfiguredObjectValue(object, attr, attributeDefinition));
+                    results.put(attr.getKey(),
+                                extractConfiguredObjectValue((ConfiguredObject<?>) attributeDefinition.getValue(object),
+                                                             attr.getValue()));
                 }
                 else if (Collection.class.isAssignableFrom(attributeDefinition.getType())
                          && (attr.getValue() instanceof Collection)
@@ -122,15 +124,7 @@ public class ConfigurationExtractor
             Map.Entry obj = valuesIter.next();
             if(obj.getKey() instanceof ConfiguredObject)
             {
-                Object attrKeyVal = attrValue.getKey();
-                if(!(attrKeyVal instanceof String) || ((ConfiguredObject)obj.getKey()).getId().toString().equals(attrKeyVal))
-                {
-                    key = ((ConfiguredObject)obj.getKey()).getName();
-                }
-                else
-                {
-                    key = attrValue.getKey();
-                }
+                key = extractConfiguredObjectValue((ConfiguredObject) obj.getKey(), attrValue.getKey());
             }
             else
             {
@@ -139,15 +133,7 @@ public class ConfigurationExtractor
 
             if(obj.getValue() instanceof ConfiguredObject)
             {
-                Object attrValueVal = attrValue.getValue();
-                if(!(attrValueVal instanceof String) || ((ConfiguredObject)obj.getValue()).getId().toString().equals(attrValueVal))
-                {
-                    value = ((ConfiguredObject)obj.getValue()).getName();
-                }
-                else
-                {
-                    value = attrValue.getValue();
-                }
+                value = extractConfiguredObjectValue((ConfiguredObject) obj.getValue(), attrValue.getValue());
             }
             else
             {
@@ -171,32 +157,22 @@ public class ConfigurationExtractor
         Iterator<? extends ConfiguredObject> valuesIter = values.iterator();
         for (Object attrValue : (Collection) attr.getValue())
         {
-            ConfiguredObject obj = valuesIter.next();
-            if (!(attrValue instanceof String) || obj.getId().toString().equals(attrValue))
-            {
-                listResults.add(obj.getName());
-            }
-            else
-            {
-                listResults.add(attrValue);
-            }
+            listResults.add(extractConfiguredObjectValue(valuesIter.next(), attrValue));
         }
         return listResults;
     }
 
     private Object extractConfiguredObjectValue(final ConfiguredObject<?> object,
-                                                final Map.Entry<String, Object> attr,
-                                                final ConfiguredObjectAttribute attributeDefinition)
+                                                final Object attrVal)
     {
         final Object value;
-        ConfiguredObject<?> obj = (ConfiguredObject<?>) attributeDefinition.getValue(object);
-        if (!(attr.getValue() instanceof String) || obj.getId().toString().equals(attr.getValue()))
+        if(!(attrVal instanceof String) || object.getId().toString().equals(attrVal))
         {
-            value = obj.getName();
+            value = object.getName();
         }
         else
         {
-            value = attr.getValue();
+            value = attrVal;
         }
         return value;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org