author | František Kučera <franta-hg@frantovo.cz> |
Sun, 14 Mar 2010 01:05:35 +0100 | |
changeset 67 | fa7e30dee3b3 |
parent 63 | 619b0d3732eb |
child 69 | 4964cf581166 |
permissions | -rw-r--r-- |
franta-hg@28 | 1 |
package cz.frantovo.nekurak.ejb; |
franta-hg@28 | 2 |
|
franta-hg@39 | 3 |
import cz.frantovo.nekurak.dao.PodnikDAO; |
franta-hg@28 | 4 |
import cz.frantovo.nekurak.dto.Podnik; |
franta-hg@28 | 5 |
import java.util.Collection; |
franta-hg@63 | 6 |
import javax.annotation.Resource; |
franta-hg@40 | 7 |
import javax.annotation.security.RolesAllowed; |
franta-hg@39 | 8 |
import javax.ejb.EJB; |
franta-hg@63 | 9 |
import javax.ejb.SessionContext; |
franta-hg@28 | 10 |
import javax.ejb.Stateless; |
franta-hg@28 | 11 |
|
franta-hg@28 | 12 |
/** |
franta-hg@28 | 13 |
* |
franta-hg@28 | 14 |
* @author fiki |
franta-hg@28 | 15 |
*/ |
franta-hg@28 | 16 |
@Stateless |
franta-hg@39 | 17 |
public class PodnikEJB implements PodnikRemote { |
franta-hg@28 | 18 |
|
franta-hg@39 | 19 |
@EJB |
franta-hg@50 | 20 |
private PodnikDAO podnikDAO; |
franta-hg@63 | 21 |
@Resource |
franta-hg@63 | 22 |
private SessionContext ctx; |
franta-hg@28 | 23 |
|
franta-hg@28 | 24 |
public Collection<Podnik> getPodniky() { |
franta-hg@39 | 25 |
Collection<Podnik> vysledek = podnikDAO.getPodniky(); |
franta-hg@67 | 26 |
|
franta-hg@67 | 27 |
for (Podnik p : vysledek) { |
franta-hg@67 | 28 |
System.out.println("FOTKY:" + p.getFotky()); |
franta-hg@67 | 29 |
} |
franta-hg@67 | 30 |
|
franta-hg@67 | 31 |
|
franta-hg@39 | 32 |
return vysledek; |
franta-hg@28 | 33 |
} |
franta-hg@40 | 34 |
|
franta-hg@40 | 35 |
@RolesAllowed("opravneny") |
franta-hg@40 | 36 |
public void zalozPodnik(Podnik p) { |
franta-hg@63 | 37 |
p.setSpravce(ctx.getCallerPrincipal().getName()); |
franta-hg@56 | 38 |
podnikDAO.zaloz(p); |
franta-hg@40 | 39 |
} |
franta-hg@40 | 40 |
|
franta-hg@40 | 41 |
@RolesAllowed("opravneny") |
franta-hg@40 | 42 |
public void upravPodnik(Podnik p) { |
franta-hg@40 | 43 |
podnikDAO.uloz(p); |
franta-hg@40 | 44 |
} |
franta-hg@28 | 45 |
} |