RequestHistory.java
| package cz.bpsolutions.ims.actions.historyservice; | | import java.util.Date; | | import javax.ejb.Remove; | import javax.ejb.Stateful; | import javax.persistence.EntityManager; | import javax.persistence.PersistenceContext; | import javax.persistence.PersistenceContextType; | | import org.jboss.seam.ScopeType; | import org.jboss.seam.annotations.Destroy; | import org.jboss.seam.annotations.In; | import org.jboss.seam.annotations.Name; | | import cz.bpsolutions.ims.model.Account; | import cz.bpsolutions.ims.model.History; | import cz.bpsolutions.ims.model.Request; | import cz.bpsolutions.ims.service.other.Message; | | @Stateful | @Name("historyService") | public class HistoryService implements HistoryServiceLocal { | @PersistenceContext(type=PersistenceContextType.EXTENDED) | private EntityManager em; | | @In(scope = ScopeType.SESSION, value = "loggedUser") | Account loggedUser; | | public void addToHistory(Request request, String actionKey, String message) { | History h = new History(); | | h.setActionKey(actionKey); | h.setDescription(message); | h.setCreated(new Date()); | | h.setRequest(request); | h.setUser(loggedUser); | | request.getHistory().add(h); | | em.persist(h); | em.persist(request); | } | | public String getActionKey(String key) { | return Message.getMessageResourceString2(key); | } | | public String getDescription (String key, Object... parameters) { | return Message.getMessageResourceString2(key, parameters); | } | | @Destroy @Remove | public void destroy() { | // TODO Auto-generated method stub | | } | } | View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085216#4085216 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085216 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user