Commit 1b3330f4 by Antti Tonkyra

ActionMessage stuff

1 parent a5075373
......@@ -49,7 +49,6 @@ public class ActionLogBean implements ActionLogBeanLocal {
alm.setMessage(message);
alm.setUser(permissionBean.getCurrentUser());
//System.out.println("would creates, crew="+crew.getName()+" u="+alm.getUser().getNick());
actionLogFacade.saveToActionLog(alm);
}
......
......@@ -6,6 +6,7 @@ import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
......@@ -13,6 +14,8 @@ import javax.persistence.criteria.Root;
import fi.insomnia.bortal.model.AccountEvent;
import fi.insomnia.bortal.model.AccountEvent_;
import fi.insomnia.bortal.model.ActionLogMessage;
import fi.insomnia.bortal.model.Bill;
import fi.insomnia.bortal.model.Bill_;
import fi.insomnia.bortal.model.EventPk;
import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.LogEntry;
......@@ -38,11 +41,19 @@ public class ActionLogFacade extends GenericFacade<Integer,ActionLogMessage> {
}
public List<ActionLogMessage> getAllSortedByTimestamp() {
// TODO Auto-generated method stub
return null;
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<ActionLogMessage> cq = cb.createQuery(ActionLogMessage.class);
Root<ActionLogMessage> root = cq.from(ActionLogMessage.class);
cq.orderBy(cb.desc(root.get("time")));
TypedQuery<ActionLogMessage> tq = em.createQuery(cq);
tq.setMaxResults(10);
tq.setFirstResult(0);
return tq.getResultList();
}
public void saveToActionLog(ActionLogMessage alm) {
em.persist(alm);
em.flush();
}
}
......@@ -4,7 +4,10 @@
<nodes xsi:type="pageflow:PFPage" name="auth/logoutResponse" x="288" y="60" id="pf131682121330016" referenceLink="//@navigationRule.0/@navigationCase.0/@toViewId|" inlinks="pf131682121330015" path="/auth/logoutResponse"/>
<nodes xsi:type="pageflow:PFPage" name="place/placemap" x="276" y="228" id="pf13168224196920" referenceLink="//@navigationRule.1/@navigationCase.0/@toViewId|" outlinks="pf13168224196921" inlinks="pf13168224196921" path="/place/placemap"/>
<nodes xsi:type="pageflow:PFPage" name="user/sendPicture" id="pf13196506256641" referenceLink="//@navigationRule.0/@navigationCase.1/@toViewId|" inlinks="pf13196506256640" path="/user/sendPicture"/>
<nodes xsi:type="pageflow:PFPage" name="actionlog/messagelist" id="pf13290472154543" referenceLink="//@navigationRule.2/@fromViewId|" outlinks="pf13290472154544" path="/actionlog/messagelist.xhtml"/>
<nodes xsi:type="pageflow:PFPage" name="actionlog/messagelist.xhtml" id="pf13290472154545" referenceLink="//@navigationRule.2/@navigationCase.0/@toViewId|" inlinks="pf13290472154544" path="/actionlog/messagelist.xhtml"/>
<links id="pf131682121330015" target="pf131682121330016" source="pf131682121330014" outcome="logoutDone" redirect="true"/>
<links id="pf13168224196921" target="pf13168224196920" source="pf13168224196920" outcome="placesReserved" redirect="true"/>
<links id="pf13196506256640" target="pf13196506256641" source="pf131682121330014" outcome="redirToUserimage" redirect="true"/>
<links id="pf13290472154544" target="pf13290472154545" source="pf13290472154543" outcome="success" redirect="true"/>
</pageflow:Pageflow>
......@@ -91,6 +91,15 @@
<redirect/>
</navigation-case>
</navigation-rule>
<navigation-rule>
<display-name>actionlog/messagelist</display-name>
<from-view-id>/actionlog/messagelist.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/actionlog/messagelist.xhtml</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
</faces-config>
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define name="content">
<h:form>
<h:messages />
<h1>#{i18n['actionlog.create.header']}</h1>
<h:outputText value="#{i18n['actionlog.create.role']}" />
<h:selectOneMenu value="#{actionLogCreateView.role}" converter="#{roleConverter}" >
<f:selectItems var="role" itemLabel="#{role.name}" value="#{actionLogCreateView.roles}" />
</h:selectOneMenu>
<h:outputText value="#{i18n['actionlog.create.message']}" />
<h:inputText value="#{actionLogCreateView.message}" />
<h:outputText value="#{i18n['actionlog.create.taskradio']}" />
<h:selectBooleanCheckbox value="#{actionLogCreateView.task}"/>
<br />
<h:commandButton action="#{actionLogCreateView.send}" value="#{i18n['actionlog.create.submitbutton']}" />
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
......@@ -5,19 +5,55 @@
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata>
<ui:define name="content">
<h:outputStylesheet library="style" name="insomnia2/css/actionlog.css"></h:outputStylesheet>
<h1>#{i18n['actionlog.messagelist.header']}</h1>
<h:dataTable styleClass="bordertable" id="message" value="#{actionLogMessageView.messages}" var="message">
<p>#{i18n['actionlog.messagelist.description']}</p>
<h:form id="actionlog_create">
<h2>#{i18n['actionlog.create.header']}</h2>
<h:messages />
<div class="row">
<h3 class="actionlog_create_role">#{i18n['actionlog.create.role']}</h3>
<h3 class="actionlog_create_message">#{i18n['actionlog.create.message']}</h3>
<h3 class="actionlog_create_istask">#{i18n['actionlog.create.taskradio']}</h3>
</div>
<div class="row">
<div class="actionlog_create_role">
<h:selectOneMenu value="#{actionLogCreateView.role}" converter="#{roleConverter}">
<f:selectItems var="role" itemLabel="#{role.name}" value="#{actionLogCreateView.roles}" />
</h:selectOneMenu>
</div>
<div class="actionlog_create_message">
<h:inputText value="#{actionLogCreateView.message}" />
</div>
<div class="actionlog_create_istask">
<h:selectBooleanCheckbox value="#{actionLogCreateView.task}"/>
</div>
<h:commandButton class="sendbutton" action="#{actionLogCreateView.send}" value="#{i18n['actionlog.create.submitbutton']}" />
</div>
</h:form>
<div class="clearfix"></div>
<h2>#{i18n['actionlog.tasklist.header']}</h2>
<div id="actionlog">
<h:dataTable styleClass="bordertable" rowClasses="roweven,rowodd" id="actionlogtable" value="#{actionLogMessageView.messages}" var="message">
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.time']}" />
</f:facet>
<h:outputText value="#{message.time}" />
<h:outputText value="#{message.time}">
<f:convertDateTime type="both" pattern="dd.MM.yyyy HH:mm" />
<!-- <f:convertDateTime type="both" dateStyle="HH:mm" /> -->
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
......@@ -29,15 +65,20 @@
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.crew']}" />
</f:facet>
<h:outputText value="#{message.crew}" />
<h:outputText value="#{message.crew.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.message']}" />
</f:facet>
<h:outputText value="#{message.message}" />
</h:column>
<h:column>
x
</h:column>
</h:dataTable>
</div>
</ui:define>
</ui:composition>
</h:body>
......
......@@ -377,14 +377,15 @@ news.save=Tallenna
usertitle.managingUser=Hallitaan kyttj
actionlog.messagelist.header=Viestilista
actionlog.messagelist.header=ActionLog
actionlog.messagelist.description=Voit seurata sek luoda uusia ActionMessageja tss nkymss.
actionlog.tasklist.header=Taskilista
actionlog.tasklist.header=Viestilista
actionlog.create.header=Luo eventti
actionlog.create.role=Rooli
actionlog.create.header=Luo uusi ActionMessage
actionlog.create.role=Kohderooli
actionlog.create.message=Viesti
actionlog.create.taskradio=Tm on taski
actionlog.create.taskradio=Tehtv
actionlog.create.submitbutton=Lhet
actionlog.time=Aika
......
......@@ -56,7 +56,8 @@ public class ActionLogCreateView extends GenericCDIView {
this.task = task;
}
public void send() {
public String send() {
actionLogBean.createActionLogEvent(message, role, task);
return "success";
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!