Kanagaraj M has uploaded a new change for review.

Change subject: engine: sorting gluster volume options
......................................................................

engine: sorting gluster volume options

Sorting the gluster volume options returned from vdsm
based on their keys.
Replaced HashSet with TreeSet to preserve the ordering.

Change-Id: Iea091e1d06fefb9ef4710ab68896614fcc01bb9f
Bug-Url: https://bugzilla.redhat.com/973635
Signed-off-by: Kanagaraj M <[email protected]>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeOptionInfo.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeOptionsInfoReturnForXmlRpc.java
2 files changed, 11 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/15773/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeOptionInfo.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeOptionInfo.java
index 398ff2a..b6a2424 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeOptionInfo.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeOptionInfo.java
@@ -7,7 +7,7 @@
  *
  * @see GlusterVolumeOptionEntity
  */
-public class GlusterVolumeOptionInfo implements Serializable {
+public class GlusterVolumeOptionInfo implements Serializable, 
Comparable<GlusterVolumeOptionInfo> {
     private static final long serialVersionUID = -5145858224564431004L;
 
     private String key;
@@ -69,4 +69,12 @@
                 && option.getDescription()
                 .equals(description));
     }
+
+    @Override
+    public int compareTo(GlusterVolumeOptionInfo option) {
+        if (this.getKey() != null && option.getKey() != null) {
+            return this.getKey().compareTo(option.getKey());
+        }
+        return 0;
+    }
 }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeOptionsInfoReturnForXmlRpc.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeOptionsInfoReturnForXmlRpc.java
index 9f49492..0e7d6ee 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeOptionsInfoReturnForXmlRpc.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeOptionsInfoReturnForXmlRpc.java
@@ -1,8 +1,8 @@
 package org.ovirt.engine.core.vdsbroker.gluster;
 
-import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeSet;
 
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo;
 import org.ovirt.engine.core.vdsbroker.irsbroker.StatusReturnForXmlRpc;
@@ -12,7 +12,7 @@
     // We are ignoring missing fields after the status, because on failure it 
is
     // not sent.
     // [XmlRpcMissingMapping(MappingAction.Ignore), 
XmlRpcMember("volumeOptionsDefaults")]
-    public Set<GlusterVolumeOptionInfo> optionsHelpSet = new 
HashSet<GlusterVolumeOptionInfo>();
+    public Set<GlusterVolumeOptionInfo> optionsHelpSet = new 
TreeSet<GlusterVolumeOptionInfo>();
 
     @SuppressWarnings("unchecked")
     public GlusterVolumeOptionsInfoReturnForXmlRpc(Map<String, Object> 
innerMap) {


-- 
To view, visit http://gerrit.ovirt.org/15773
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea091e1d06fefb9ef4710ab68896614fcc01bb9f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Kanagaraj M <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to