franta-hg@28: package cz.frantovo.nekurak.ejb; franta-hg@28: franta-hg@39: import cz.frantovo.nekurak.dao.PodnikDAO; franta-hg@28: import cz.frantovo.nekurak.dto.Podnik; franta-hg@28: import java.util.Collection; franta-hg@63: import javax.annotation.Resource; franta-hg@40: import javax.annotation.security.RolesAllowed; franta-hg@39: import javax.ejb.EJB; franta-hg@63: import javax.ejb.SessionContext; franta-hg@28: import javax.ejb.Stateless; franta-hg@28: franta-hg@28: /** franta-hg@28: * franta-hg@28: * @author fiki franta-hg@28: */ franta-hg@28: @Stateless franta-hg@39: public class PodnikEJB implements PodnikRemote { franta-hg@28: franta-hg@39: @EJB franta-hg@50: private PodnikDAO podnikDAO; franta-hg@63: @Resource franta-hg@63: private SessionContext ctx; franta-hg@28: franta-hg@28: public Collection getPodniky() { franta-hg@39: Collection vysledek = podnikDAO.getPodniky(); franta-hg@39: return vysledek; franta-hg@28: } franta-hg@40: franta-hg@40: @RolesAllowed("opravneny") franta-hg@40: public void zalozPodnik(Podnik p) { franta-hg@63: p.setSpravce(ctx.getCallerPrincipal().getName()); franta-hg@56: podnikDAO.zaloz(p); franta-hg@40: } franta-hg@40: franta-hg@40: @RolesAllowed("opravneny") franta-hg@40: public void upravPodnik(Podnik p) { franta-hg@40: podnikDAO.uloz(p); franta-hg@40: } franta-hg@28: }