Merge changes I9865d0cd,Ic71d525f,Ib8faba91,Ia10e5ec9,I35591747,If456a131,I9f8709cc
[controller.git] / opendaylight / northbound / networkconfiguration / neutron / src / main / java / org / opendaylight / controller / networkconfig / neutron / northbound / NeutronSubnetRequest.java
1 /*
2  * Copyright IBM Corporation, 2013.  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.controller.networkconfig.neutron.northbound;
10
11 import java.util.List;
12
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 import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
19
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22
23 public class NeutronSubnetRequest implements INeutronRequest {
24     // See OpenStack Network API v2.0 Reference for description of
25     // annotated attributes
26
27     @XmlElement(name="subnet")
28     NeutronSubnet singletonSubnet;
29
30     @XmlElement(name="subnets")
31     List<NeutronSubnet> bulkRequest;
32
33     @XmlElement(name="subnets_links")
34     List<NeutronPageLink> links;
35
36     NeutronSubnetRequest() {
37     }
38
39     public NeutronSubnetRequest(List<NeutronSubnet> bulkRequest, List<NeutronPageLink> links) {
40         this.bulkRequest = bulkRequest;
41         this.links = links;
42         this.singletonSubnet = null;
43     }
44
45     NeutronSubnetRequest(List<NeutronSubnet> bulk) {
46         bulkRequest = bulk;
47         singletonSubnet = null;
48         links = null;
49     }
50
51     NeutronSubnetRequest(NeutronSubnet subnet) {
52         singletonSubnet = subnet;
53         bulkRequest = null;
54         links = null;
55     }
56
57     public NeutronSubnet getSingleton() {
58         return singletonSubnet;
59     }
60
61     public List<NeutronSubnet> getBulk() {
62         return bulkRequest;
63     }
64
65     public boolean isSingleton() {
66         return (singletonSubnet != null);
67     }
68 }