sort out signature of extraceField method
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCPortChain.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.neutron.spi;
9
10 import java.io.Serializable;
11 import java.util.Iterator;
12 import java.util.List;
13 import java.util.Map;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
18 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
19
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22 public class NeutronSFCPortChain extends NeutronObject<NeutronSFCPortChain>
23         implements Serializable, INeutronObject<NeutronSFCPortChain> {
24
25     private static final long serialVersionUID = 1L;
26
27     // See OpenStack Networking SFC (networking-sfc) Port Chain API v1.0 Reference
28     // for description of annotated attributes
29     @XmlElement(name = "name")
30     String name;
31
32     @XmlElement(name = "port_pair_groups")
33     List<String> portPairGroupsUUID;
34
35     @XmlElement(name = "flow_classifiers")
36     List<String> flowClassifiersUUID;
37
38     @XmlElement(name = "chain_parameters")
39     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
40     Map<String, String> chainParameters;
41
42     public NeutronSFCPortChain() {
43     }
44
45     public String getName() {
46         return name;
47     }
48
49     public void setName(String name) {
50         this.name = name;
51     }
52
53     public List<String> getPortPairGroupsUUID() {
54         return portPairGroupsUUID;
55     }
56
57     public void setPortPairGroupsUUID(List<String> portPairGroupsUUID) {
58         this.portPairGroupsUUID = portPairGroupsUUID;
59     }
60
61     public List<String> getFlowClassifiersUUID() {
62         return flowClassifiersUUID;
63     }
64
65     public void setFlowClassifiersUUID(List<String> flowClassifiersUUID) {
66         this.flowClassifiersUUID = flowClassifiersUUID;
67     }
68
69     public Map<String, String> getChainParameters() {
70         return chainParameters;
71     }
72
73     public void setChainParameters(Map<String, String> chainParameters) {
74         this.chainParameters = chainParameters;
75     }
76
77     /**
78      * This method copies selected fields from the object and returns them
79      * as a new object, suitable for marshaling.
80      *
81      * @param fields List of attributes to be extracted
82      * @return an OpenStack Neutron SFC Port Chain object with only the selected fields
83      * populated
84      */
85
86     public NeutronSFCPortChain extractFields(List<String> fields) {
87         NeutronSFCPortChain ans = new NeutronSFCPortChain();
88         Iterator<String> i = fields.iterator();
89         while (i.hasNext()) {
90             String s = i.next();
91             if (s.equals("id")) {
92                 ans.setID(this.getID());
93             }
94             if (s.equals("tenant_id")) {
95                 ans.setTenantID(this.getTenantID());
96             }
97             if (s.equals("name")) {
98                 ans.setName(this.getName());
99             }
100             if (s.equals("port_pair_groups")) {
101                 ans.setPortPairGroupsUUID(this.getPortPairGroupsUUID());
102             }
103             if (s.equals("flow_classifiers")) {
104                 ans.setFlowClassifiersUUID(this.getFlowClassifiersUUID());
105             }
106             if (s.equals("chain_parameters")) {
107                 ans.setChainParameters(this.getChainParameters());
108             }
109         }
110         return ans;
111     }
112
113     @Override
114     public String toString() {
115         return "NeutronSFCPortChain[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\''
116                 + ", portPairGroupsUUID=" + portPairGroupsUUID + ", flowClassifiersUUID='" + flowClassifiersUUID + '\''
117                 + ", chainParameters=" + chainParameters + ']';
118     }
119 }