Commit 1b3330f4 by Antti Tonkyra

ActionMessage stuff

1 parent a5075373
...@@ -49,7 +49,6 @@ public class ActionLogBean implements ActionLogBeanLocal { ...@@ -49,7 +49,6 @@ public class ActionLogBean implements ActionLogBeanLocal {
alm.setMessage(message); alm.setMessage(message);
alm.setUser(permissionBean.getCurrentUser()); alm.setUser(permissionBean.getCurrentUser());
//System.out.println("would creates, crew="+crew.getName()+" u="+alm.getUser().getNick());
actionLogFacade.saveToActionLog(alm); actionLogFacade.saveToActionLog(alm);
} }
......
...@@ -6,6 +6,7 @@ import javax.ejb.LocalBean; ...@@ -6,6 +6,7 @@ import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
...@@ -13,6 +14,8 @@ 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.AccountEvent_; import fi.insomnia.bortal.model.AccountEvent_;
import fi.insomnia.bortal.model.ActionLogMessage; 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.EventPk;
import fi.insomnia.bortal.model.LanEvent; import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.LogEntry; import fi.insomnia.bortal.model.LogEntry;
...@@ -38,11 +41,19 @@ public class ActionLogFacade extends GenericFacade<Integer,ActionLogMessage> { ...@@ -38,11 +41,19 @@ public class ActionLogFacade extends GenericFacade<Integer,ActionLogMessage> {
} }
public List<ActionLogMessage> getAllSortedByTimestamp() { public List<ActionLogMessage> getAllSortedByTimestamp() {
// TODO Auto-generated method stub CriteriaBuilder cb = getEm().getCriteriaBuilder();
return null; 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) { public void saveToActionLog(ActionLogMessage alm) {
em.persist(alm); em.persist(alm);
em.flush();
} }
} }
...@@ -4,7 +4,10 @@ ...@@ -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="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="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="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="pf131682121330015" target="pf131682121330016" source="pf131682121330014" outcome="logoutDone" redirect="true"/>
<links id="pf13168224196921" target="pf13168224196920" source="pf13168224196920" outcome="placesReserved" 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="pf13196506256640" target="pf13196506256641" source="pf131682121330014" outcome="redirToUserimage" redirect="true"/>
<links id="pf13290472154544" target="pf13290472154545" source="pf13290472154543" outcome="success" redirect="true"/>
</pageflow:Pageflow> </pageflow:Pageflow>
...@@ -91,6 +91,15 @@ ...@@ -91,6 +91,15 @@
<redirect/> <redirect/>
</navigation-case> </navigation-case>
</navigation-rule> </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> </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,39 +5,80 @@ ...@@ -5,39 +5,80 @@
xmlns:h="http://java.sun.com/jsf/html" xmlns:users="http://java.sun.com/jsf/composite/cditools/user" 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" xmlns:tools="http://java.sun.com/jsf/composite/cditools" xmlns:f="http://java.sun.com/jsf/core"
> >
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata> <f:metadata>
<!-- f:event type="preRenderView" listener="#{newsListView.initView}" /--> <!-- f:event type="preRenderView" listener="#{newsListView.initView}" /-->
</f:metadata> </f:metadata>
<ui:define name="content"> <ui:define name="content">
<h:outputStylesheet library="style" name="insomnia2/css/actionlog.css"></h:outputStylesheet>
<h1>#{i18n['actionlog.messagelist.header']}</h1> <h1>#{i18n['actionlog.messagelist.header']}</h1>
<h:dataTable styleClass="bordertable" id="message" value="#{actionLogMessageView.messages}" var="message"> <p>#{i18n['actionlog.messagelist.description']}</p>
<h:column> <h:form id="actionlog_create">
<f:facet name="header"> <h2>#{i18n['actionlog.create.header']}</h2>
<h:outputText value="#{i18n['actionlog.time']}" /> <h:messages />
</f:facet> <div class="row">
<h:outputText value="#{message.time}" /> <h3 class="actionlog_create_role">#{i18n['actionlog.create.role']}</h3>
</h:column> <h3 class="actionlog_create_message">#{i18n['actionlog.create.message']}</h3>
<h:column> <h3 class="actionlog_create_istask">#{i18n['actionlog.create.taskradio']}</h3>
<f:facet name="header"> </div>
<h:outputText value="#{i18n['actionlog.user']}" />
</f:facet> <div class="row">
<h:outputText value="#{message.user.nick}" /> <div class="actionlog_create_role">
</h:column> <h:selectOneMenu value="#{actionLogCreateView.role}" converter="#{roleConverter}">
<h:column> <f:selectItems var="role" itemLabel="#{role.name}" value="#{actionLogCreateView.roles}" />
<f:facet name="header"> </h:selectOneMenu>
<h:outputText value="#{i18n['actionlog.crew']}" /> </div>
</f:facet>
<h:outputText value="#{message.crew}" /> <div class="actionlog_create_message">
</h:column> <h:inputText value="#{actionLogCreateView.message}" />
<h:column> </div>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.message']}" /> <div class="actionlog_create_istask">
</f:facet> <h:selectBooleanCheckbox value="#{actionLogCreateView.task}"/>
<h:outputText value="#{message.message}" /> </div>
</h:column>
</h:dataTable> <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}">
<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">
<h:outputText value="#{i18n['actionlog.user']}" />
</f:facet>
<h:outputText value="#{message.user.nick}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['actionlog.crew']}" />
</f:facet>
<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:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
......
...@@ -24,4 +24,4 @@ a:hover {color: #7dac0c;} ...@@ -24,4 +24,4 @@ a:hover {color: #7dac0c;}
#container.top {width: 100%; background:url(../img/container-top.png) no-repeat; height: 15px;} #container.top {width: 100%; background:url(../img/container-top.png) no-repeat; height: 15px;}
#container.bottom {width: 100%; background:url(../img/container-bottom.png) no-repeat; height: 16px;} #container.bottom {width: 100%; background:url(../img/container-bottom.png) no-repeat; height: 16px;}
.clearfix:after {content: ".";display: block;clear: both;visibility: hidden;line-height: 0;height: 0;} .clearfix:after {content: ".";display: block;clear: both;visibility: hidden;line-height: 0;height: 0;}
\ No newline at end of file
...@@ -377,14 +377,15 @@ news.save=Tallenna ...@@ -377,14 +377,15 @@ news.save=Tallenna
usertitle.managingUser=Hallitaan kyttj 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.header=Luo uusi ActionMessage
actionlog.create.role=Rooli actionlog.create.role=Kohderooli
actionlog.create.message=Viesti actionlog.create.message=Viesti
actionlog.create.taskradio=Tm on taski actionlog.create.taskradio=Tehtv
actionlog.create.submitbutton=Lhet actionlog.create.submitbutton=Lhet
actionlog.time=Aika actionlog.time=Aika
......
...@@ -56,7 +56,8 @@ public class ActionLogCreateView extends GenericCDIView { ...@@ -56,7 +56,8 @@ public class ActionLogCreateView extends GenericCDIView {
this.task = task; this.task = task;
} }
public void send() { public String send() {
actionLogBean.createActionLogEvent(message, role, task); 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!