java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Podnik.java
author František Kučera <franta-hg@frantovo.cz>
Thu Jan 13 23:13:09 2011 +0100 (2011-01-13)
changeset 165 cdfc1e9e3a1b
parent 164 e146e2e3b80b
child 173 2b458ac09044
permissions -rw-r--r--
Spokojenost: pokračování.
     1 package cz.frantovo.nekurak.dto;
     2 
     3 import java.io.Serializable;
     4 import java.net.URL;
     5 import java.util.ArrayList;
     6 import java.util.Date;
     7 import java.util.HashSet;
     8 import java.util.List;
     9 import java.util.Set;
    10 
    11 /**
    12  * Podnik – hospoda, bar, kavárna…
    13  * @author fiki
    14  */
    15 public class Podnik implements Serializable {
    16 
    17 	private int id;
    18 	private String nazev;
    19 	private String popis;
    20 	private String url;
    21 	private String ulice;
    22 	private Date datum;
    23 	private Integer cisloPopisne;
    24 	private String mesto;
    25 	private String spravce;
    26 	private List<Fotka> fotky = new ArrayList<Fotka>();
    27 	private Set<Komentar> komentare = new HashSet<Komentar>();
    28 	private Set<Kategorie> kategorie = new HashSet<Kategorie>();
    29 	private Double sirka;
    30 	private Double delka;
    31 	private Kurackost kurackost = new Kurackost();
    32 
    33 	public Podnik() {
    34 	}
    35 
    36 	public Podnik(int id, String nazev) {
    37 		this.id = id;
    38 		this.nazev = nazev;
    39 	}
    40 
    41 	public int getId() {
    42 		return id;
    43 	}
    44 
    45 	public void setId(int id) {
    46 		this.id = id;
    47 	}
    48 
    49 	public String getNazev() {
    50 		return nazev;
    51 	}
    52 
    53 	public void setNazev(String nazev) {
    54 		this.nazev = nazev;
    55 	}
    56 
    57 	public String getPopis() {
    58 		return popis;
    59 	}
    60 
    61 	public void setPopis(String popis) {
    62 		this.popis = popis;
    63 	}
    64 
    65 	public String getUrl() {
    66 		return url;
    67 	}
    68 
    69 	public void setUrl(String url) {
    70 		this.url = url;
    71 	}
    72 
    73 	/**
    74 	 * Získá z URL webové stránky podniku doménové jméno převedené na malá písmena.
    75 	 * Např. z „http://www.example.com/index.html“ získá „www.example.com“.
    76 	 * @return doménové jméno nebo null v případě chyby.
    77 	 */
    78 	public String getUrlDomena() {
    79 		if (url == null) {
    80 			return null;
    81 		} else {
    82 			try {
    83 				URL u = new URL(url);
    84 				String domena = u.getHost().toLowerCase();
    85 				if (domena.length() > 0) {
    86 					return domena;
    87 				} else {
    88 					return null;
    89 				}
    90 			} catch (Exception e) {
    91 				return null;
    92 			}
    93 		}
    94 	}
    95 
    96 	public String getUlice() {
    97 		return ulice;
    98 	}
    99 
   100 	public void setUlice(String ulice) {
   101 		this.ulice = ulice;
   102 	}
   103 
   104 	public Date getDatum() {
   105 		return datum;
   106 	}
   107 
   108 	public void setDatum(Date datum) {
   109 		this.datum = datum;
   110 	}
   111 
   112 	public int getCisloPopisne() {
   113 		return cisloPopisne;
   114 	}
   115 
   116 	public void setCisloPopisne(int cisloPopisne) {
   117 		this.cisloPopisne = cisloPopisne;
   118 	}
   119 
   120 	public String getMesto() {
   121 		return mesto;
   122 	}
   123 
   124 	public void setMesto(String mesto) {
   125 		this.mesto = mesto;
   126 	}
   127 
   128 	public String getSpravce() {
   129 		return spravce;
   130 	}
   131 
   132 	public void setSpravce(String spravce) {
   133 		this.spravce = spravce;
   134 	}
   135 
   136 	public List<Fotka> getFotky() {
   137 		return fotky;
   138 	}
   139 
   140 	public void setFotky(List<Fotka> fotky) {
   141 		this.fotky = fotky;
   142 	}
   143 
   144 	public Double getSirka() {
   145 		return sirka;
   146 	}
   147 
   148 	public void setSirka(Double sirka) {
   149 		this.sirka = sirka;
   150 	}
   151 
   152 	public Double getDelka() {
   153 		return delka;
   154 	}
   155 
   156 	public void setDelka(Double delka) {
   157 		this.delka = delka;
   158 	}
   159 
   160 	public Set<Komentar> getKomentare() {
   161 		return komentare;
   162 	}
   163 
   164 	public void setKomentare(Set<Komentar> komentare) {
   165 		this.komentare = komentare;
   166 	}
   167 
   168 	public Set<Kategorie> getKategorie() {
   169 		return kategorie;
   170 	}
   171 
   172 	public void setKategorie(Set<Kategorie> kategorie) {
   173 		this.kategorie = kategorie;
   174 	}
   175 
   176 	public Kurackost getKurackost() {
   177 		return kurackost;
   178 	}
   179 
   180 	public void setKurackost(Kurackost kurackost) {
   181 		this.kurackost = kurackost;
   182 	}
   183 	/** Půdou a sklepem projedete bez nebezpečí. */
   184 }