CityVO.java
001 /*
002  * Created on 26.03.2004
003  */
004 package de.fub.tip.datenanzeige.ormapper;
005 
006 import java.io.Serializable;
007 
008 import org.apache.log4j.Logger;
009 
010 /**
011  * Sinn: kapselt die Darstellung einer Stadt aus der Datenbank
012  
013  @author hirsch, 26.03.2004
014  @version 2004-03-28
015  
016  * $Id: CityVO.java,v 1.4 2004/06/11 21:52:47 hirsch Exp $
017  */
018 public class CityVO implements ViewObject, Serializable {
019   /** datenbankinterne ID */
020   private Integer id = null;
021   /** Name der Stadt */
022   private String city = null;
023   /** Land, in dem die Stadt liegt */
024   private CountryVO country = null;
025 
026   /**
027    * leerer Konstruktor, die eigentlichen Daten werden anders gefüllt - <br>
028    * nämlich direkt mit den Settern! 
029    <br>
030    */
031   public CityVO() {
032   // end of Konstruktor
033 
034   /**
035    @see de.fub.tip.datenanzeige.ormapper.ViewObject#logObject(org.apache.log4j.Logger)
036    */
037   public void logObject(Logger logger) {
038     logger.debug("CityVO.logObject("this.toString() +")");
039   // end of logObject
040   
041   /**
042    * nullpointersichere Stringrepräsentation einer Stadt
043    @return Stadt als String
044    */
045   public String toString() {
046     String ergebnis = "Name = "
047     if (this.getCity() != nullergebnis+= this.getCity();
048     ergebnis+= " (";
049     if (this.getId() != nullergebnis+= this.getId();
050     ergebnis+= ") , ";
051     if (this.getCountry() != null && 
052         this.getCountry().toString() != null
053       ergebnis+= this.getCountry().toString();
054     
055     return ergebnis;
056   // end of toString
057 
058   /**
059    * gibt den Namen der Stadt zurück
060    @return stadt
061    */
062   public String getCity() {
063     return city;
064   }
065 
066   /**
067    * setzt den Namen der Stadt
068    @param city Stadtname
069    */
070   public void setCity(String city) {
071     this.city = city;
072   }
073 
074   /**
075    * gibt das zur Stadt gehörende Land zurück
076    @return Land
077    */
078   public CountryVO getCountry() {
079     return country;
080   }
081 
082   /**
083    * setzt das Land, in dem sich die Stadt befindet 
084    @param country Land
085    */
086   public void setCountry(CountryVO country) {
087     this.country = country;
088   }
089 
090   /**
091    * gibt die ID aus der Datenbank zurück
092    @return ID aus Datenbank
093    */
094   public Integer getId() {
095     return id;
096   }
097 
098   /**
099    * setzt die ID des Objekts
100    @param id Objektid
101    */
102   public void setId(Integer id) {
103     this.id = id;
104   }
105 // end of class