001 /*
002 * Created on 03.03.2004
003 */
004 package de.fub.tip.datenanzeige.ormapper;
005 import java.io.Serializable;
006
007 import org.apache.log4j.Logger;
008
009 /**
010 * Sinn: kapselt die Inhalte der Tabellen SIGHT, CITY und COUNTRY, <br>
011 * so dass als Ergebnis alle Sights, die es gibt zurückgegeben werden können.
012 * <br>
013 * Zusätzlich enthält das Objekt auch die Info, ob der aktuelle User<br>
014 * die Sehenswürdigkeit bereits besucht hat.
015 *
016 * @author hirsch, 03.03.2004
017 * @version 2004-03-17
018 *
019 * $Id: SightVO.java,v 1.19 2004/06/11 21:52:48 hirsch Exp $
020 *
021 * <br><ul>
022 * <li>2004-03-04:<br>
023 * hasVisited Feld hinzugefügt</li>
024 * <li>2004-03-19:<br>
025 * Schnittstelle <code>ViewObject</code><br>
026 * Location-Typ hinzugefügt</li>
027 * <li>2004-03-21:<br>
028 * ID aus DB hinzugefügt</li>
029 * <li>2004-03-23:<br>
030 * <code>picture</code> entfernt und
031 * komplett durch <code>PictureVO</code> ersetzt</li>
032 * <li>2004-03-29:<br>
033 * <code>country, city</code> entfernt und
034 * komplett durch <code>City/CountryVO</code> ersetzt</li>
035 * <li>2004-04-02:<br>
036 * <code>id</code> wird zu INTEGER</li>
037 * </ul>
038 */
039 public class SightVO implements ViewObject, Serializable {
040 /** Datenbankschlüssel (ID) */
041 private Integer id = null;
042 /** URL des Bildes der Sehenswürdigkeit */
043 private PictureVO picture = null;
044 /** Ort der Sehenswürdigkeit */
045 private String location = null;
046 /** Ortsangabentyp - z.B. POINT, POLYGON usw. */
047 private String locationType = null;
048
049 /** Bezeichnung der Sehenswürdigkeit */
050 private String name = null;
051 /** Stadt, in der sich die Sehenswürdigkeit befindet */
052 private CityVO city = null;
053 /** Land, in dem sich die Sehenswürdigkeit befindet */
054 private CountryVO country = null;
055 /** Bemerkung, ob der aktuelle Benutzer die Sehenswürdigkeit schon
056 * gesehen hat
057 */
058 private Boolean hasVisited = null;
059
060 /**
061 * Standardkonstruktor, der nichts macht.<br>
062 * Die Werteinstellung geschieht nur über die SETTER-Methoden.
063 * <br>
064 * Standardmässig wurde die Sehenswürdigkeit noch nicht gesehen!
065 */
066 public SightVO() {
067 this.hasVisited = new Boolean(false);
068 } // end of Konstruktor
069
070 /**
071 * internes Logging der Komponente
072 * @param log Logger, in den geschrieben werden soll
073 */
074 public void logObject(Logger log) {
075 log.debug("SightVO.logObject( "+this.toString()+")");
076 }
077
078 /**
079 * Stadt, in der sich die Sehenswürdigkeit befindet
080 * @return Stadt
081 */
082 public CityVO getCity() {
083 return city;
084 }
085
086 /**
087 * setzt die Stadt der Sehenswürdigkeit
088 * @param city neue Stadt
089 */
090 public void setCity(CityVO city) {
091 this.city = city;
092 }
093
094 /**
095 * gibt das Land zurück, in dem sich die Sehenswürdigkeit befindet
096 * @return Land
097 */
098 public CountryVO getCountry() {
099 return country;
100 }
101
102 /**
103 * setzt das Land für diese Sehenswürdigkeit
104 * @param country neues Land
105 */
106 public void setCountry(CountryVO country) {
107 this.country = country;
108 }
109
110 /**
111 * gibt den Standort der Sehenswürdigkeit zurück
112 * @return standort
113 */
114 public String getLocation() {
115 return location;
116 }
117
118 /**
119 * setzt den Standort für die aktuelle Sehenswürdigkeit
120 * @param location Ort der Sehenswürdigkeit
121 */
122 public void setLocation(String location) {
123 this.location = location;
124 }
125
126 /**
127 * gibt die textuelle Beschreibung der Sehenswürdigkeit
128 * @return name
129 */
130 public String getName() {
131 return name;
132 }
133
134 /**
135 * setzt den Namen der Sehenswürdigkeit
136 * @param name neuer Name
137 */
138 public void setName(String name) {
139 this.name = name;
140 }
141
142 /**
143 * gibt den Hyperlink auf ein Bild der Sehenswürdigkeit
144 * @return bildURL
145 */
146 public PictureVO getPicture() {
147 return picture;
148 }
149
150 /**
151 * Hyperlink auf das zugehörige Bild setzen
152 * @param picture neue URL des Bildes
153 */
154 public void setPicture(PictureVO picture) {
155 this.picture = picture;
156 }
157
158 /**
159 * ob der Benutzer diese Sehenswürdigkeit schon gesehen hat
160 * @return ja oder nein
161 */
162 public Boolean getHasVisited() {
163 return hasVisited;
164 }
165
166 /**
167 * wurde die Sehenswürdigkeit schon besucht
168 * @param hasVisited neu
169 */
170 public void setHasVisited(Boolean hasVisited) {
171 this.hasVisited = hasVisited;
172 }
173
174 /**
175 * Typ der Ortsangabe
176 * @return ortsangabentyp
177 */
178 public String getLocationType() {
179 return locationType;
180 }
181
182 /**
183 * setzt den Typ der Ortsangabe beispielsweise POINT o.ä.
184 *
185 * @param locationType
186 */
187 public void setLocationType(String locationType) {
188 this.locationType = locationType;
189 }
190
191 /**
192 * gibt die ID des Objekts in der Datenbank zurück
193 * @return id des Objekts
194 */
195 public Integer getId() {
196 return id;
197 }
198
199 /**
200 * setzt die DatenbankID dieses Objekts
201 * @param id datenbankinterne ID
202 */
203 public void setId(Integer id) {
204 this.id = id;
205 }
206
207 /**
208 * geeignete und NullPointer-sichere String-Repräsentation
209 * eines <code>SightVO</code>
210 * @return string
211 */
212 public String toString() {
213 String ergebnis = "<Stadt=";
214
215 if ( city != null && city.getCity() != null )
216 ergebnis += city.getCity();
217 ergebnis += "/ Land=";
218 if ( country != null && country.getCountry() != null )
219 ergebnis+= country.getCountry();
220 ergebnis += "/ Name=";
221 if ( name != null ) ergebnis += name;
222 ergebnis += " / Ort(";
223 if ( locationType != null) ergebnis+=locationType;
224 ergebnis += ")=";
225 if ( location != null ) ergebnis += location;
226 ergebnis += ">";
227
228 return ergebnis;
229 } // end of toString
230 } // end of class
|