sort out signature of extraceField method
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronVPNIKEPolicy.java
index 96a653ba14b5b0b0a8aedaa48cd8f9da82641309..4685298aa5d42f8bba18b7ec68c11d896d947d92 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright IBM Corporation, 2015.  All rights reserved.
+ * Copyright (c) 2015 IBM Corporation and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -9,7 +9,8 @@
 package org.opendaylight.neutron.spi;
 
 import java.io.Serializable;
-
+import java.util.Iterator;
+import java.util.List;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -17,61 +18,37 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 @XmlRootElement
 @XmlAccessorType(XmlAccessType.NONE)
-public class NeutronVPNIKEPolicy implements Serializable, INeutronObject {
+public class NeutronVPNIKEPolicy extends NeutronObject<NeutronVPNIKEPolicy>
+        implements Serializable, INeutronObject<NeutronVPNIKEPolicy> {
     private static final long serialVersionUID = 1L;
 
     // See OpenStack Network API v2.0 Reference for description of
     // annotated attributes
 
-    @XmlElement (name = "id")
-    String id;
-
-    @XmlElement (name = "tenant_id")
-    String tenantID;
-
-    @XmlElement (name = "name")
+    @XmlElement(name = "name")
     String name;
 
-    @XmlElement (name = "description")
-    String description;
-
-    @XmlElement (name = "auth_algorithm")
+    @XmlElement(name = "auth_algorithm")
     String authAlgorithm;
 
-    @XmlElement (name = "encryption_algorithm")
+    @XmlElement(name = "encryption_algorithm")
     String encryptionAlgorithm;
 
-    @XmlElement (name = "phase1_negotiation_mode")
+    @XmlElement(name = "phase1_negotiation_mode")
     String phase1NegotiationMode;
 
-    @XmlElement (name = "pfs")
+    @XmlElement(name = "pfs")
     String perfectForwardSecrecy;
 
-    @XmlElement (name = "ike_version")
+    @XmlElement(name = "ike_version")
     String ikeVersion;
 
-    @XmlElement (name = "lifetime")
+    @XmlElement(name = "lifetime")
     NeutronVPNLifetime lifetime;
 
     public NeutronVPNIKEPolicy() {
     }
 
-    public String getID() {
-        return id;
-    }
-
-    public void setID(String id) {
-        this.id = id;
-    }
-
-    public String getTenantID() {
-        return tenantID;
-    }
-
-    public void setTenantID(String tenantID) {
-        this.tenantID = tenantID;
-    }
-
     public String getName() {
         return name;
     }
@@ -80,14 +57,6 @@ public class NeutronVPNIKEPolicy implements Serializable, INeutronObject {
         this.name = name;
     }
 
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
     public String getAuthAlgorithm() {
         return authAlgorithm;
     }
@@ -136,4 +105,45 @@ public class NeutronVPNIKEPolicy implements Serializable, INeutronObject {
         this.lifetime = lifetime;
     }
 
+    /**
+     * This method copies selected fields from the object and returns them
+     * as a new object, suitable for marshaling.
+     *
+     * @param fields
+     *            List of attributes to be extracted
+     * @return a NeutronVPNIKEPolicy object with only the selected fields
+     * populated
+     */
+    public NeutronVPNIKEPolicy extractFields(List<String> fields) {
+        NeutronVPNIKEPolicy ans = new NeutronVPNIKEPolicy();
+        Iterator<String> i = fields.iterator();
+        while (i.hasNext()) {
+            String s = i.next();
+            if (s.equals("id")) {
+                ans.setID(this.getID());
+            }
+            if (s.equals("name")) {
+                ans.setName(this.getName());
+            }
+            if (s.equals("tenant_id")) {
+                ans.setTenantID(this.getTenantID());
+            }
+            if (s.equals("auth_algorithm")) {
+                ans.setAuthAlgorithm(this.getAuthAlgorithm());
+            }
+            if (s.equals("encryption_algorithm")) {
+                ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
+            }
+            if (s.equals("phase1_negotiation_mode")) {
+                ans.setPhase1NegotiationMode(this.getPhase1NegotiationMode());
+            }
+            if (s.equals("pfs")) {
+                ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
+            }
+            if (s.equals("ike_version")) {
+                ans.setIkeVersion(this.getIkeVersion());
+            }
+        }
+        return ans;
+    }
 }