checkstyle: enable JavadocTagContinuationIndentation
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSFCPortPair.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.HashMap;
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 final class NeutronSFCPortPair extends NeutronBaseAttributes<NeutronSFCPortPair> implements Serializable {
23
24     private static final long serialVersionUID = 1L;
25
26     // See OpenStack Networking SFC (networking-sfc) Port Pair API v1.0 Reference
27     // for description of annotated attributes
28     @XmlElement(name = "ingress")
29     String ingressPortUUID;
30
31     @XmlElement(name = "egress")
32     String egressPortUUID;
33
34     @XmlElement(name = "service_function_parameters")
35     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
36     Map<String, String> serviceFunctionParameters;
37
38     public NeutronSFCPortPair() {
39     }
40
41     public String getIngressPortUUID() {
42         return ingressPortUUID;
43     }
44
45     public void setIngressPortUUID(String ingressPortUUID) {
46         this.ingressPortUUID = ingressPortUUID;
47     }
48
49     public String getEgressPortUUID() {
50         return egressPortUUID;
51     }
52
53     public void setEgressPortUUID(String egressPortUUID) {
54         this.egressPortUUID = egressPortUUID;
55     }
56
57     public Map<String, String> getServiceFunctionParameters() {
58         return serviceFunctionParameters;
59     }
60
61     public void setServiceFunctionParameters(Map<String, String> serviceFunctionParameters) {
62         this.serviceFunctionParameters = serviceFunctionParameters;
63     }
64
65     /**
66      * This method copies selected fields from the object and returns them
67      * as a new object, suitable for marshaling.
68      *
69      * @param fields List of attributes to be extracted
70      * @return an OpenStack Neutron SFC Port Pair object with only the selected fields
71      *             populated
72      */
73
74     public NeutronSFCPortPair extractFields(List<String> fields) {
75         NeutronSFCPortPair ans = new NeutronSFCPortPair();
76         for (String s : fields) {
77             extractField(s, ans);
78             if (s.equals("ingress")) {
79                 ans.setIngressPortUUID(this.getIngressPortUUID());
80             }
81             if (s.equals("egress")) {
82                 ans.setEgressPortUUID(this.getEgressPortUUID());
83             }
84             if (s.equals("service_function_parameters")) {
85                 ans.setServiceFunctionParameters(new HashMap<String, String>(this.getServiceFunctionParameters()));
86             }
87         }
88         return ans;
89     }
90
91     @Override
92     public String toString() {
93         return "NeutronSFCPortPair[" + "tenantID='" + tenantID + '\'' + ", name='" + name + '\'' + ", ingressPortUUID='"
94                 + ingressPortUUID + '\'' + ", egressPortUUID='" + egressPortUUID + '\'' + ", serviceFunctionParameters="
95                 + serviceFunctionParameters + ']';
96     }
97 }