/* Jug Management is a web application conceived to manage user groups or * communities focused on a certain domain of knowledge, whose members are * constantly sharing information and participating in social and educational * events. Copyright (C) 2011 Ceara Java User Group - CEJUG. * * This application is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation; either version 2.1 of the License, or (at your * option) any later version. * * This application is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * There is a full copy of the GNU Lesser General Public License along with * this library. Look for the file license.txt at the root level. If you do not * find it, write to the Free Software Foundation, Inc., 59 Temple Place, * Suite 330, Boston, MA 02111-1307 USA. * */ package org.cejug.yougi.entity; import java.io.Serializable; import javax.persistence.*; /** * City is the smallest geographic region where a JUG can operate. A JUG can * cover one or more cities. During the registration, a new member can add * his/her own city if it is not listed in the select field. However, cities * added this way should pass through a validation process before being * considered as a city covered by the JUG. * * @author Hildeberto Mendonca - http://www.hildeberto.com */ @Entity @Table(name = "city") public class City implements Serializable, Identified { private static final long serialVersionUID = 1L; @Id private String id; private String name; private Boolean valid; @JoinColumn(name = "country") @ManyToOne(optional = false, fetch = FetchType.LAZY) private Country country; @JoinColumn(name = "province") @ManyToOne(fetch = FetchType.LAZY) private Province province; private String latitude; private String longitude; @Column(name="timezone") private String timeZone; public City() { } public City(String id) { this.id = id; } public City(String id, String name) { this.id = id; this.name = name; } @Override public String getId() { return id; } @Override public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Boolean getValid() { return valid; } public void setValid(Boolean valid) { this.valid = valid; } public Country getCountry() { return country; } public void setCountry(Country country) { this.country = country; } public Province getProvince() { return province; } public void setProvince(Province province) { this.province = province; } public String getLatitude() { return latitude; } public void setLatitude(String latitude) { this.latitude = latitude; } public String getLongitude() { return longitude; } public void setLongitude(String longitude) { this.longitude = longitude; } /** * @return the timezone of the city. */ public String getTimeZone() { return timeZone; } public void setTimeZone(String timeZone) { this.timeZone = timeZone; } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof City)) { return false; } City other = (City) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return name; } }