java/nekurak.net-lib/src/cz/frantovo/nekurak/dto/Podnik.java
author František Kučera <franta-hg@frantovo.cz>
Sun Jan 09 16:27:44 2011 +0100 (2011-01-09)
changeset 158 e1ac3efcd140
parent 156 5f14ce03f518
child 164 e146e2e3b80b
permissions -rw-r--r--
vylepšen detail podniku, modularizace, značky, css
     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 
    32 	public Podnik() {
    33 	}
    34 
    35 	public Podnik(int id, String nazev) {
    36 		this.id = id;
    37 		this.nazev = nazev;
    38 	}
    39 
    40 	public int getId() {
    41 		return id;
    42 	}
    43 
    44 	public void setId(int id) {
    45 		this.id = id;
    46 	}
    47 
    48 	public String getNazev() {
    49 		return nazev;
    50 	}
    51 
    52 	public void setNazev(String nazev) {
    53 		this.nazev = nazev;
    54 	}
    55 
    56 	public String getPopis() {
    57 		return popis;
    58 	}
    59 
    60 	public void setPopis(String popis) {
    61 		this.popis = popis;
    62 	}
    63 
    64 	public String getUrl() {
    65 		return url;
    66 	}
    67 
    68 	public void setUrl(String url) {
    69 		this.url = url;
    70 	}
    71 
    72 	/**
    73 	 * Získá z URL webové stránky podniku doménové jméno převedené na malá písmena.
    74 	 * Např. z „http://www.example.com/index.html“ získá „www.example.com“.
    75 	 * @return doménové jméno nebo null v případě chyby.
    76 	 */
    77 	public String getUrlDomena() {
    78 		if (url == null) {
    79 			return null;
    80 		} else {
    81 			try {
    82 				URL u = new URL(url);
    83 				String domena = u.getHost().toLowerCase();
    84 				if (domena.length() > 0) {
    85 					return domena;
    86 				} else {
    87 					return null;
    88 				}
    89 			} catch (Exception e) {
    90 				return null;
    91 			}
    92 		}
    93 	}
    94 
    95 	public String getUlice() {
    96 		return ulice;
    97 	}
    98 
    99 	public void setUlice(String ulice) {
   100 		this.ulice = ulice;
   101 	}
   102 
   103 	public Date getDatum() {
   104 		return datum;
   105 	}
   106 
   107 	public void setDatum(Date datum) {
   108 		this.datum = datum;
   109 	}
   110 
   111 	public int getCisloPopisne() {
   112 		return cisloPopisne;
   113 	}
   114 
   115 	public void setCisloPopisne(int cisloPopisne) {
   116 		this.cisloPopisne = cisloPopisne;
   117 	}
   118 
   119 	public String getMesto() {
   120 		return mesto;
   121 	}
   122 
   123 	public void setMesto(String mesto) {
   124 		this.mesto = mesto;
   125 	}
   126 
   127 	public String getSpravce() {
   128 		return spravce;
   129 	}
   130 
   131 	public void setSpravce(String spravce) {
   132 		this.spravce = spravce;
   133 	}
   134 
   135 	public List<Fotka> getFotky() {
   136 		return fotky;
   137 	}
   138 
   139 	public void setFotky(List<Fotka> fotky) {
   140 		this.fotky = fotky;
   141 	}
   142 
   143 	public Double getSirka() {
   144 		return sirka;
   145 	}
   146 
   147 	public void setSirka(Double sirka) {
   148 		this.sirka = sirka;
   149 	}
   150 
   151 	public Double getDelka() {
   152 		return delka;
   153 	}
   154 
   155 	public void setDelka(Double delka) {
   156 		this.delka = delka;
   157 	}
   158 
   159 	public Set<Komentar> getKomentare() {
   160 		return komentare;
   161 	}
   162 
   163 	public void setKomentare(Set<Komentar> komentare) {
   164 		this.komentare = komentare;
   165 	}
   166 
   167 	public Set<Kategorie> getKategorie() {
   168 		return kategorie;
   169 	}
   170 
   171 	public void setKategorie(Set<Kategorie> kategorie) {
   172 		this.kategorie = kategorie;
   173 	}
   174 	/** Půdou a sklepem projedete bez nebezpečí. */
   175 }