View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15   
16  package org.kuali.mobility.maps.entity;
17  
18  import java.io.Serializable;
19  
20  import javax.xml.bind.annotation.XmlRootElement;
21  
22  import flexjson.JSONSerializer;
23  
24  /*
25   * Modifying the Location object? Remember to update the copy method.
26   */
27  @XmlRootElement(name = "location")
28  public class Location implements Serializable {
29  
30  	private static final long serialVersionUID = -2588912315204722978L;
31  
32  	private String id;
33  	
34  	private String name;
35  	
36  	private String description;
37  	
38  	private String streetNumber;
39  	private String streetDirection;
40  	private String street;
41  	
42  	private String city;
43  	
44  	private String state;
45  	
46  	private String zip;
47  	
48  	private Double latitude;
49  	
50  	private Double longitude;
51  	
52  	private boolean active;
53  
54  	public Location() {
55  		
56  	}
57  	
58  	public Location(String id, String name, String description, String street, String city, String state) {
59  		this.id = id;
60  		this.name = name;
61  		this.description = description;
62  		this.street = street;
63  		this.city = city;
64  		this.state = state;
65  	}
66  	
67      public String toJson() {
68          return new JSONSerializer().exclude("*.class").serialize(this);
69      }
70  	
71  	public String getName() {
72  		return name;
73  	}
74  
75  	public void setName(String name) {
76  		this.name = name;
77  	}
78  	
79  	public String getCity() {
80  		return city;
81  	}
82  
83  	public void setCity(String city) {
84  		this.city = city;
85  	}
86  
87  	public String getState() {
88  		return state;
89  	}
90  
91  	public void setState(String state) {
92  		this.state = state;
93  	}
94  
95  	public String getStreet() {
96  		return street;
97  	}
98  
99  	public void setStreet(String street) {
100 		this.street = street;
101 	}
102 	
103 	public String getStreetNumber() {
104 		return streetNumber;
105 	}
106 
107 	public void setStreetNumber(String streetNumber) {
108 		this.streetNumber = streetNumber;
109 	}
110 
111 	public String getStreetDirection() {
112 		return streetDirection;
113 	}
114 
115 	public void setStreetDirection(String streetDirection) {
116 		this.streetDirection = streetDirection;
117 	}
118 
119 	public String getZip() {
120 		return zip;
121 	}
122 
123 	public void setZip(String zip) {
124 		this.zip = zip;
125 	}
126 
127 	public Double getLatitude() {
128 		return latitude;
129 	}
130 
131 	public void setLatitude(Double latitude) {
132 		this.latitude = latitude;
133 	}
134 
135 	public Double getLongitude() {
136 		return longitude;
137 	}
138 
139 	public void setLongitude(Double longitude) {
140 		this.longitude = longitude;
141 	}
142 
143 	public boolean isActive() {
144 		return active;
145 	}
146 
147 	public void setActive(boolean active) {
148 		this.active = active;
149 	}
150 
151 	public Location copy() {
152 		Location location = new Location();
153 		location.setActive(this.active);
154 		if (city != null) {
155 			location.setCity(new String(city));	
156 		}
157 		if (id != null) {
158 			location.setId(new String(this.id));	
159 		}
160 		if (latitude != null) {
161 			location.setLatitude(new Double(this.latitude));	
162 		}
163 		if (longitude != null) {
164 			location.setLongitude(new Double(this.longitude));	
165 		}
166 		if (name != null) {
167 			location.setName(new String(this.name));	
168 		}
169 		if (description != null) {
170 			location.setDescription(new String(this.description));	
171 		}
172 		if (state != null) {
173 			location.setState(new String(this.state));	
174 		}
175 		if (street != null) {
176 			location.setStreet(new String(this.street));	
177 		}
178 		if (zip != null) {
179 			location.setZip(new String(this.zip));	
180 		}
181 		return location;
182 	}
183 
184 	public String getId() {
185 		return id;
186 	}
187 
188 	public void setId(String id) {
189 		this.id = id;
190 	}
191 
192 	public String getDescription() {
193 		return description;
194 	}
195 
196 	public void setDescription(String description) {
197 		this.description = description;
198 	}
199 	
200 }