Martin Mucha has uploaded a new change for review.

Change subject: core: introducing ReportedConfigurations business entity.
......................................................................

core: introducing ReportedConfigurations business entity.

Change-Id: Ifceb49f7b0aeda8ed094c8a91f853744cc8facff
Signed-off-by: Martin Mucha <[email protected]>
---
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ReportedConfigurations.java
1 file changed, 143 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/72/37872/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ReportedConfigurations.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ReportedConfigurations.java
new file mode 100644
index 0000000..992aca7
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/network/ReportedConfigurations.java
@@ -0,0 +1,143 @@
+package org.ovirt.engine.core.common.businessentities.network;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Reported configuration related to sole network.
+ */
+public class ReportedConfigurations implements Serializable {
+    private static final long serialVersionUID = -6086888024266749566L;
+
+    private  boolean networkInSync;
+
+    /*
+     * all reported configurations, with flag whether each configuration is in 
sync or not.
+     */
+    private List<ReportedConfiguration> reportedConfigurationList = new 
ArrayList<>();
+
+    public ReportedConfigurations add(Type type, String value, boolean inSync) 
{
+        reportedConfigurationList.add(new ReportedConfiguration(type, value, 
inSync));
+        return this;
+    }
+
+    public ReportedConfigurations add(Type type, Integer value, boolean 
inSync) {
+        reportedConfigurationList.add(new ReportedConfiguration(type, value == 
null ? "null" : value.toString(), inSync));
+        return this;
+    }
+
+    public ReportedConfigurations add(Type type, boolean value, boolean 
inSync) {
+        reportedConfigurationList.add(new ReportedConfiguration(type, 
Boolean.toString(value), inSync));
+        return this;
+    }
+
+    public List<ReportedConfiguration> getReportedConfigurationList() {
+        return reportedConfigurationList;
+    }
+
+
+    /**
+     * all network configuration is in sync with host.
+     */
+    public boolean isNetworkInSync() {
+        return networkInSync;
+    }
+
+    public void setNetworkInSync(boolean networkInSync) {
+        this.networkInSync = networkInSync;
+    }
+
+    public enum Type {
+        MTU("mtu"),
+        BRIDGED("bridged"),
+        VLAN("vlan"),
+        OUT_AVERAGE_LINK_SHARE("outAverageLinkShare"),
+        OUT_AVERAGE_UPPER_LIMIT("outAverageUpperLimit"),
+        OUT_AVERAGE_REAL_TIME("outAverageRealTime");
+
+        private final String name;
+
+        Type(String name) {
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+    }
+
+    public static class ReportedConfiguration implements Serializable{
+
+        private static final long serialVersionUID = 5723310765332966613L;
+        private Type type;
+        private String value;
+        private boolean inSync;
+
+        private ReportedConfiguration() {
+        }
+
+        public ReportedConfiguration(Type type, String value, boolean inSync) {
+            if (type == null) {
+                throw new IllegalArgumentException();
+            }
+
+            this.type = type;
+            this.value = value;
+            this.inSync = inSync;
+        }
+
+
+        public Type getType() {
+            return type;
+        }
+
+        public void setType(Type name) {
+            this.type = name;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public void setValue(String value) {
+            this.value = value;
+        }
+
+        public boolean isInSync() {
+            return inSync;
+        }
+
+        public void setInSync(boolean inSync) {
+            this.inSync = inSync;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o)
+                return true;
+            if (!(o instanceof ReportedConfiguration))
+                return false;
+
+            ReportedConfiguration that = (ReportedConfiguration) o;
+
+            if (inSync != that.inSync)
+                return false;
+            if (type != that.type)
+                return false;
+            if (value != null ? !value.equals(that.value) : that.value != null)
+                return false;
+
+            return true;
+        }
+
+        @Override
+        public int hashCode() {
+            int result = type != null ? type.hashCode() : 0;
+            result = 31 * result + (value != null ? value.hashCode() : 0);
+            result = 31 * result + (inSync ? 1 : 0);
+            return result;
+        }
+    }
+
+}


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

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

Reply via email to