1 /*
   2  * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
   3  *
   4  * Redistribution and use in source and binary forms, with or without
   5  * modification, are permitted provided that the following conditions
   6  * are met:
   7  *
   8  *   - Redistributions of source code must retain the above copyright
   9  *     notice, this list of conditions and the following disclaimer.
  10  *
  11  *   - Redistributions in binary form must reproduce the above copyright
  12  *     notice, this list of conditions and the following disclaimer in the
  13  *     documentation and/or other materials provided with the distribution.
  14  *
  15  *   - Neither the name of Oracle nor the names of its
  16  *     contributors may be used to endorse or promote products derived
  17  *     from this software without specific prior written permission.
  18  *
  19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  20  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  21  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  27  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30  */
  31 
  32 /*
  33  * This source code is provided to illustrate the usage of a given feature
  34  * or technique and has been deliberately simplified. Additional steps
  35  * required for a production-quality application, such as security checks,
  36  * input validation and proper error handling, might not be present in
  37  * this sample code.
  38  */
  39 package stream.data;
  40 
  41 import java.util.ArrayList;
  42 import javax.xml.bind.annotation.XmlElement;
  43 import javax.xml.bind.annotation.XmlElementWrapper;
  44 import javax.xml.bind.annotation.XmlRootElement;
  45 import javax.xml.bind.annotation.XmlType;
  46 
  47 /**
  48  * Customer meta data class, one customer could have zero to multiple orders
  49  *
  50  * @author tyan
  51  */
  52 public @XmlRootElement(name = "customer")
  53 @XmlType(propOrder = {"customerID", "companyName", "address", "city", "region",
  54     "postalcode", "country", "phone", "fax", "orders"})
  55 class Customer {
  56 
  57     private String customerID;
  58     private String companyName;
  59     private String address;
  60     private String city;
  61     private String region;
  62     private String postalcode;
  63     private String country;
  64     private String phone;
  65     private String fax;
  66 
  67     @XmlElementWrapper(name = "orders")
  68     @XmlElement(name = "order")
  69     private ArrayList<Order> orders;
  70 
  71     /**
  72      * @return the customerID
  73      */
  74     @XmlElement(name = "id")
  75     public String getCustomerID() {
  76         return customerID;
  77     }
  78 
  79     /**
  80      * @param customerID the customerID to set
  81      */
  82     public void setCustomerID(String customerID) {
  83         this.customerID = customerID;
  84     }
  85 
  86     /**
  87      * @return the companyName
  88      */
  89     @XmlElement(name = "name")
  90     public String getCompanyName() {
  91         return companyName;
  92     }
  93 
  94     /**
  95      * @param companyName the companyName to set
  96      */
  97     public void setCompanyName(String companyName) {
  98         this.companyName = companyName;
  99     }
 100 
 101     /**
 102      * @return the address
 103      */
 104     public String getAddress() {
 105         return address;
 106     }
 107 
 108     /**
 109      * @param address the address to set
 110      */
 111     public void setAddress(String address) {
 112         this.address = address;
 113     }
 114 
 115     /**
 116      * @return the city
 117      */
 118     public String getCity() {
 119         return city;
 120     }
 121 
 122     /**
 123      * @param city the city to set
 124      */
 125     public void setCity(String city) {
 126         this.city = city;
 127     }
 128 
 129     /**
 130      * @return the region
 131      */
 132     public String getRegion() {
 133         return region;
 134     }
 135 
 136     /**
 137      * @param region the region to set
 138      */
 139     public void setRegion(String region) {
 140         this.region = region;
 141     }
 142 
 143     /**
 144      * @return the postalcode
 145      */
 146     public String getPostalcode() {
 147         return postalcode;
 148     }
 149 
 150     /**
 151      * @param postalcode the postalcode to set
 152      */
 153     public void setPostalcode(String postalcode) {
 154         this.postalcode = postalcode;
 155     }
 156 
 157     /**
 158      * @return the country
 159      */
 160     public String getCountry() {
 161         return country;
 162     }
 163 
 164     /**
 165      * @param country the country to set
 166      */
 167     public void setCountry(String country) {
 168         this.country = country;
 169     }
 170 
 171     /**
 172      * @return the phone
 173      */
 174     public String getPhone() {
 175         return phone;
 176     }
 177 
 178     /**
 179      * @param phone the phone to set
 180      */
 181     public void setPhone(String phone) {
 182         this.phone = phone;
 183     }
 184 
 185     /**
 186      * @return the fax
 187      */
 188     public String getFax() {
 189         return fax;
 190     }
 191 
 192     /**
 193      * @param fax the fax to set
 194      */
 195     public void setFax(String fax) {
 196         this.fax = fax;
 197     }
 198 
 199     /**
 200      * @return the orders
 201      */
 202     public final ArrayList<Order> getOrders() {
 203         return orders;
 204     }
 205 }