java/nekurak.net-web/src/java/cz/frantovo/nekurak/web/FunkceEL.java
author František Kučera <franta-hg@frantovo.cz>
Sun, 14 Mar 2010 01:37:40 +0100
changeset 68 df5aedafb826
parent 66 048531e09c09
child 134 4bd1e353c527
permissions -rw-r--r--
Fotky se zobrazují ty, které jsou v databázi
(jen záznamy – soubory s fotkami jsou na disku).
franta-hg@66
     1
package cz.frantovo.nekurak.web;
franta-hg@66
     2
franta-hg@68
     3
import cz.frantovo.nekurak.dto.Podnik;
franta-hg@66
     4
import cz.frantovo.nekurak.servlet.Fotky;
franta-hg@66
     5
franta-hg@66
     6
/**
franta-hg@66
     7
 * Knihovna funkcí použitelná v EL
franta-hg@66
     8
 * @author fiki
franta-hg@66
     9
 */
franta-hg@66
    10
public class FunkceEL {
franta-hg@66
    11
franta-hg@66
    12
    /** Musí odpovídat cestě, kam je namapovaný servlet. */
franta-hg@66
    13
    private static final String SERVLET = "fotky";
franta-hg@66
    14
franta-hg@66
    15
    public static String fotka(int id, boolean nahled) {
franta-hg@66
    16
	String prostredek = nahled ? Fotky.PODADRESAR_NAHLED : Fotky.PODADRESAR_ORIGINAL;
franta-hg@66
    17
	return SERVLET + "/" + prostredek + "/" + id + "." + Fotky.PRIPONA;
franta-hg@66
    18
    }
franta-hg@68
    19
franta-hg@68
    20
    public static boolean maFotky(Podnik p) {
franta-hg@68
    21
	return !p.getFotky().isEmpty();
franta-hg@68
    22
    }
franta-hg@66
    23
}