00b82ea30383fc17413fef56246e1360005728b7
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronSecurityGroup.java
1 /*
2  * Copyright (C) 2014 Red Hat, Inc.  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
9 package org.opendaylight.neutron.spi;
10
11 import java.io.Serializable;
12 import java.util.List;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17
18 /**
19  * OpenStack Neutron v2.0 Security Group bindings.
20  * See OpenStack Network API v2.0 Reference for description of
21  * annotated attributes. The current fields are as follows:
22  * <p>
23  * id                   uuid-str unique ID for the security group.
24  * name                 String name of the security group.
25  * tenant_id            uuid-str Owner of security rule..
26  */
27
28 @XmlRootElement
29 @XmlAccessorType(XmlAccessType.NONE)
30 public final class NeutronSecurityGroup extends NeutronObject<NeutronSecurityGroup>
31         implements Serializable, INeutronObject<NeutronSecurityGroup> {
32     private static final long serialVersionUID = 1L;
33
34     @XmlElement(name = "name")
35     String securityGroupName;
36
37     public NeutronSecurityGroup() {
38     }
39
40     public String getSecurityGroupName() {
41         return securityGroupName;
42     }
43
44     public void setSecurityGroupName(String securityGroupName) {
45         this.securityGroupName = securityGroupName;
46     }
47
48     public NeutronSecurityGroup extractFields(List<String> fields) {
49         NeutronSecurityGroup ans = new NeutronSecurityGroup();
50         for (String s : fields) {
51             extractField(s, ans);
52             if (s.equals("name")) {
53                 ans.setSecurityGroupName(this.getSecurityGroupName());
54             }
55         }
56         return ans;
57     }
58
59     @Override
60     public String toString() {
61         return "NeutronSecurityGroup{" + "securityGroupUUID='" + uuid + '\'' + ", securityGroupName='"
62                 + securityGroupName + '\'' + ", securityGroupTenantID='" + tenantID + '\'' + "]";
63     }
64
65     @Override
66     public void initDefaults() {
67         //TODO verify no defaults values are nessecary required.
68     }
69 }