Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5c881099
authored
Oct 27, 2012
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Plain Diff
can I haz confligtz
2 parents
83be3e3b
e49ff3b1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
33 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/FoodWaveFacade.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Bill.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
code/LanBortalWeb/WebContent/foodadmin/editTemplate.xhtml
code/LanBortalWeb/WebContent/foodmanager/listFoodwaves.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
View file @
5c88109
...
...
@@ -80,7 +80,8 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
@Override
public
FoodWave
merge
(
FoodWave
foodWave
)
{
return
foodWaveFacade
.
merge
(
foodWave
);
foodWave
=
foodWaveFacade
.
merge
(
foodWave
);
return
foodWave
;
}
@Override
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/FoodWaveFacade.java
View file @
5c88109
package
fi
.
insomnia
.
bortal
.
facade
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
javax.ejb.EJB
;
...
...
@@ -41,7 +42,7 @@ public class FoodWaveFacade extends IntegerPkGenericFacade<FoodWave> {
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
FoodWave
>
cq
=
cb
.
createQuery
(
FoodWave
.
class
);
Root
<
FoodWave
>
root
=
cq
.
from
(
FoodWave
.
class
);
cq
.
where
(
cb
.
greaterThan
(
root
.
get
(
FoodWave_
.
time
),
Calendar
.
getInstanc
e
()),
cb
.
isFalse
(
root
.
get
(
FoodWave_
.
closed
)),
cb
.
equal
(
root
.
get
(
FoodWave_
.
template
).
get
(
FoodWaveTemplate_
.
event
),
eventBean
.
getCurrentEvent
()));
cq
.
where
(
cb
.
greaterThan
(
root
.
get
(
FoodWave_
.
time
),
new
Dat
e
()),
cb
.
isFalse
(
root
.
get
(
FoodWave_
.
closed
)),
cb
.
equal
(
root
.
get
(
FoodWave_
.
template
).
get
(
FoodWaveTemplate_
.
event
),
eventBean
.
getCurrentEvent
()));
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Bill.java
View file @
5c88109
...
...
@@ -417,7 +417,7 @@ public class Bill extends GenericEntity {
boolean
ret
=
false
;
for
(
BillLine
bl
:
billLines
)
{
if
(
bl
.
getFoodwave
()
!=
null
&&
(
bl
.
getFoodwave
().
getClosed
()
||
bl
.
getFoodwave
().
getTime
().
before
(
Calendar
.
getInstanc
e
())))
if
(
bl
.
getFoodwave
()
!=
null
&&
(
bl
.
getFoodwave
().
getClosed
()
||
bl
.
getFoodwave
().
getTime
().
before
(
new
Dat
e
())))
{
ret
=
true
;
break
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
View file @
5c88109
...
...
@@ -6,6 +6,7 @@ package fi.insomnia.bortal.model;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
javax.persistence.Column
;
...
...
@@ -40,7 +41,7 @@ public class FoodWave extends GenericEntity {
@Column
(
name
=
"wave_time"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
time
;
private
Date
time
;
@Column
(
name
=
"max_foods"
)
private
Integer
maximumFoods
;
...
...
@@ -84,11 +85,11 @@ public class FoodWave extends GenericEntity {
this
.
description
=
waveDescription
;
}
public
Calendar
getTime
()
{
public
Date
getTime
()
{
return
time
;
}
public
void
setTime
(
Calendar
waveTime
)
{
public
void
setTime
(
Date
waveTime
)
{
this
.
time
=
waveTime
;
}
...
...
@@ -141,7 +142,7 @@ public class FoodWave extends GenericEntity {
return
false
;
}
if
(
getTime
().
before
(
Calendar
.
getInstanc
e
()))
{
if
(
getTime
().
before
(
new
Dat
e
()))
{
return
false
;
}
...
...
code/LanBortalWeb/WebContent/foodadmin/editTemplate.xhtml
View file @
5c88109
...
...
@@ -80,6 +80,7 @@
value=
"#{foodWaveView.template.products}"
var=
"product"
editable=
"true"
>
<p:ajax
event=
"rowEdit"
listener=
"#{foodWaveView.onEdit}"
/>
<p:column
headerText=
"#{i18n['foodwavetemplate.productname']}"
>
...
...
code/LanBortalWeb/WebContent/foodmanager/listFoodwaves.xhtml
View file @
5c88109
<!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:f=
"http://java.sun.com/jsf/core"
xmlns:foodwave=
"http://java.sun.com/jsf/composite/cditools/foodwave"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:p=
"http://primefaces.org/ui"
>
<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:f=
"http://java.sun.com/jsf/core"
xmlns:foodwave=
"http://java.sun.com/jsf/composite/cditools/foodwave"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{foodWaveView.initFoodwaveManagerList}"
/>
<f:event
type=
"preRenderView"
listener=
"#{foodWaveView.initFoodwaveManagerList}"
/>
</f:metadata>
<ui:define
name=
"title"
>
<h1>
#{i18n['foodWave.list']}
</h1>
</ui:define>
<ui:define
name=
"content"
>
<p:dataTable
styleClass=
"bordertable"
value=
"#{foodWaveView.foodWaves}"
var=
"foodwave"
>
<p:column>
<h:form>
<p:dataTable
styleClass=
"bordertable"
value=
"#{foodWaveView.foodWaves}"
sortBy=
"#{foodwave.time}"
sortOrder=
"ascending"
var=
"foodwave"
editable=
"true"
>
<p:ajax
event=
"rowEdit"
listener=
"#{foodWaveView.onEditFoodWave}"
/>
<p:column
sortBy=
"#{foodwave.time}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.time']}"
/>
</f:facet>
<h:outputText
value=
"#{foodwave.time.time}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
<p:cellEditor>
<f:facet
name=
"output"
>
<h:outputText
value=
"#{foodwave.time}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
</f:facet>
<f:facet
name=
"input"
>
<p:calendar
id=
"startTime"
value=
"#{foodwave.time}"
pattern=
"#{sessionHandler.datetimeFormat}"
/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column>
<f:facet
name=
"header"
>
...
...
@@ -32,32 +50,45 @@
<f:facet
name=
"header"
>
<h:outputLabel
id=
"name"
value=
"${i18n['foodWave.name']}"
/>
</f:facet>
<h:outputText
value=
"#{foodwave.name}"
/>
<p:cellEditor>
<f:facet
name=
"output"
>
<h:outputText
value=
"#{foodwave.name}"
/>
</f:facet>
<f:facet
name=
"input"
>
<p:inputText
value=
"#{foodwave.name}"
style=
"width:100%"
required=
"true"
requiredMessage=
"Name required"
/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column
styleClass=
"text-center"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.paid']}"
/>
</f:facet>
<h:outputText
value=
"#{foodwave.
orderedCount
}"
/>
<h:outputText
value=
"#{foodwave.
accountEvents.size()
}"
/>
</p:column>
<p:column
styleClass=
"text-center"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.unconfirmedOrders']}"
/>
</f:facet>
<h:outputText
value=
"#{foodwave.unpaidCount}"
/>
<h:outputText
value=
"#{foodwave.unpaid
BillLine
Count}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.totalReserved']}"
/>
</f:facet>
<h:outputText
value=
"#{foodwave.reservedCount}"
/>
/
<h:outputText
value=
"#{foodwave.maximumFoods}"
/>
<h:outputText
value=
"#{foodwave.reservedCount}"
/>
/
<h:outputText
value=
"#{foodwave.maximumFoods}"
/>
</p:column>
<p:column>
<h:link
outcome=
"/foodmanager/listOrders"
value=
"#{i18n['foodWave.show']}"
>
<h:link
outcome=
"/foodmanager/listOrders"
value=
"#{i18n['foodWave.show']}"
>
<f:param
name=
"foodwaveid"
value=
"#{foodwave.id}"
/>
</h:link>
</p:column>
<p:column>
<p:rowEditor
/>
</p:column>
<!--
<p:column>
<h:outputText value="#{foodwave.closed.toString()}" />
...
...
@@ -69,11 +100,10 @@
action="#{foodwave.toggleClosed}" />
</p:column> -->
</p:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
</html>
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
View file @
5c88109
...
...
@@ -67,7 +67,7 @@ public class FoodWaveView extends GenericCDIView {
private
Integer
foodWaveId
;
private
ListDataModel
<
AccountEvent
>
accountEventLines
;
private
List
<
FoodWave
>
foodWaves
;
private
List
DataModel
<
FoodWave
>
foodWaves
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
FoodWaveView
.
class
);
public
List
<
Product
>
getProducts
()
{
...
...
@@ -79,6 +79,11 @@ public class FoodWaveView extends GenericCDIView {
public
void
onEdit
()
{
this
.
foodWaveBean
.
saveTemplate
(
template
);
}
public
void
onEditFoodWave
()
{
FoodWave
fw
=
foodWaves
.
getRowData
();
this
.
foodWaveBean
.
merge
(
fw
);
}
public
void
initTemplateList
()
{
super
.
requirePermissions
(
ShopPermission
.
SHOP_FOODWAVE
);
...
...
@@ -87,7 +92,11 @@ public class FoodWaveView extends GenericCDIView {
public
void
initFoodwaveManagerList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_FOODWAVES
))
{
foodWaves
=
foodWaveBean
.
getEventFoodWaves
();
if
(
foodWaves
==
null
)
{
super
.
beginConversation
();
foodWaves
=
new
ListDataModel
<
FoodWave
>(
foodWaveBean
.
getEventFoodWaves
());
}
}
}
...
...
@@ -95,7 +104,7 @@ public class FoodWaveView extends GenericCDIView {
public
String
createFoodwave
()
{
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
selectedFoodWave
.
setTime
(
c
);
selectedFoodWave
.
setTime
(
c
.
getTime
()
);
foodWaveBean
.
createFoodWave
(
selectedFoodWave
);
initFoodwaveManagerList
();
...
...
@@ -110,9 +119,9 @@ public class FoodWaveView extends GenericCDIView {
if
(
templateId
!=
null
)
{
template
=
foodWaveBean
.
findTemplate
(
templateId
);
foodWaves
=
template
.
getFoodwaves
(
);
foodWaves
=
new
ListDataModel
<
FoodWave
>(
template
.
getFoodwaves
()
);
}
else
{
foodWaves
=
foodWaveBean
.
getOpenFoodWaves
(
);
foodWaves
=
new
ListDataModel
<
FoodWave
>(
foodWaveBean
.
getOpenFoodWaves
()
);
}
super
.
beginConversation
();
}
...
...
@@ -335,11 +344,11 @@ public class FoodWaveView extends GenericCDIView {
this
.
billLines
=
billLines
;
}
public
void
setFoodWaves
(
List
<
FoodWave
>
foodWaves
)
{
public
void
setFoodWaves
(
List
DataModel
<
FoodWave
>
foodWaves
)
{
this
.
foodWaves
=
foodWaves
;
}
public
List
<
FoodWave
>
getFoodWaves
()
{
public
List
DataModel
<
FoodWave
>
getFoodWaves
()
{
return
foodWaves
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment