cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [1/2] git commit: updated refs/heads/master to aae1424
Date Tue, 06 May 2014 20:55:03 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master c9a09f548 -> aae1424f3


CLOUDSTACK-6582: cidr field removed


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/067e6b49
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/067e6b49
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/067e6b49

Branch: refs/heads/master
Commit: 067e6b49337b37a566d88d9f8b897e4f52be14a0
Parents: c9a09f5
Author: Daan Hoogland <daan@onecht.net>
Authored: Tue May 6 17:44:54 2014 +0200
Committer: Daan Hoogland <daan@onecht.net>
Committed: Tue May 6 22:49:37 2014 +0200

----------------------------------------------------------------------
 .../com/cloud/network/vpc/NetworkACLItemVO.java | 42 ++++++++------------
 1 file changed, 16 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/067e6b49/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java b/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java
index 0d2897d..6eb9cb0 100644
--- a/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java
+++ b/engine/schema/src/com/cloud/network/vpc/NetworkACLItemVO.java
@@ -16,9 +16,10 @@
 // under the License.
 package com.cloud.network.vpc;
 
-import java.util.ArrayList;
 import java.util.Date;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.StringTokenizer;
 import java.util.UUID;
 
 import javax.persistence.Column;
@@ -29,6 +30,7 @@ import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
+import javax.persistence.Transient;
 
 import com.cloud.utils.db.GenericDao;
 import com.cloud.utils.net.NetUtils;
@@ -76,8 +78,11 @@ public class NetworkACLItemVO implements NetworkACLItem {
     @Enumerated(value = EnumType.STRING)
     TrafficType trafficType;
 
-    @Column(name = "cidr", length = 2048)
-    String sourceCidrs;
+    // This is a delayed load value.  If the value is null,
+    // then this field has not been loaded yet.
+    // Call the NetworkACLItem dao to load it.
+    @Transient
+    List<String> sourceCidrs;
 
     @Column(name = "uuid")
     String uuid;
@@ -113,32 +118,12 @@ public class NetworkACLItemVO implements NetworkACLItem {
     }
 
     public void setSourceCidrList(List<String> sourceCidrs) {
-        if (sourceCidrs == null) {
-            this.sourceCidrs = null;
-        } else {
-            StringBuilder sb = new StringBuilder();
-            for (String cidr : sourceCidrs) {
-                if (sb.length() != 0) {
-                    sb.append(",");
-                }
-                sb.append(cidr);
-            }
-            this.sourceCidrs = sb.toString();
-        }
+        this.sourceCidrs = sourceCidrs;
     }
 
     @Override
     public List<String> getSourceCidrList() {
-        if (sourceCidrs == null || sourceCidrs.isEmpty()) {
-            return null;
-        } else {
-            List<String> cidrList = new ArrayList<String>();
-            String[] cidrs = sourceCidrs.split(",");
-            for (String cidr : cidrs) {
-                cidrList.add(cidr);
-            }
-            return cidrList;
-        }
+        return sourceCidrs;
     }
 
     @Override
@@ -239,7 +224,12 @@ public class NetworkACLItemVO implements NetworkACLItem {
     }
 
     public void setSourceCidrs(String sourceCidrs) {
-        this.sourceCidrs = sourceCidrs;
+        List<String> srcCidrs = new LinkedList<String>();
+        StringTokenizer st = new StringTokenizer(sourceCidrs,",;");
+        while(st.hasMoreTokens()) {
+            srcCidrs.add(st.nextToken());
+        }
+        this.sourceCidrs = srcCidrs;
     }
 
     public void setNumber(int number) {


Mime
View raw message