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 fc433b1d
authored
Oct 27, 2012
by
Antti Tönkyrä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
editable foodwaves
1 parent
c31db398
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
25 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 @
fc433b1
...
@@ -80,7 +80,8 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
...
@@ -80,7 +80,8 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
@Override
@Override
public
FoodWave
merge
(
FoodWave
foodWave
)
{
public
FoodWave
merge
(
FoodWave
foodWave
)
{
return
foodWaveFacade
.
merge
(
foodWave
);
foodWave
=
foodWaveFacade
.
merge
(
foodWave
);
return
foodWave
;
}
}
@Override
@Override
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/FoodWaveFacade.java
View file @
fc433b1
package
fi
.
insomnia
.
bortal
.
facade
;
package
fi
.
insomnia
.
bortal
.
facade
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
...
@@ -41,7 +42,7 @@ public class FoodWaveFacade extends IntegerPkGenericFacade<FoodWave> {
...
@@ -41,7 +42,7 @@ public class FoodWaveFacade extends IntegerPkGenericFacade<FoodWave> {
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
FoodWave
>
cq
=
cb
.
createQuery
(
FoodWave
.
class
);
CriteriaQuery
<
FoodWave
>
cq
=
cb
.
createQuery
(
FoodWave
.
class
);
Root
<
FoodWave
>
root
=
cq
.
from
(
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
();
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
}
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Bill.java
View file @
fc433b1
...
@@ -419,7 +419,7 @@ public class Bill extends GenericEntity {
...
@@ -419,7 +419,7 @@ public class Bill extends GenericEntity {
boolean
ret
=
false
;
boolean
ret
=
false
;
for
(
BillLine
bl
:
billLines
)
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
;
ret
=
true
;
break
;
break
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
View file @
fc433b1
...
@@ -6,6 +6,7 @@ package fi.insomnia.bortal.model;
...
@@ -6,6 +6,7 @@ package fi.insomnia.bortal.model;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
...
@@ -42,7 +43,7 @@ public class FoodWave extends GenericEntity {
...
@@ -42,7 +43,7 @@ public class FoodWave extends GenericEntity {
@Column
(
name
=
"wave_time"
)
@Column
(
name
=
"wave_time"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
time
;
private
Date
time
;
@Column
(
name
=
"max_foods"
)
@Column
(
name
=
"max_foods"
)
private
Integer
maximumFoods
;
private
Integer
maximumFoods
;
...
@@ -86,11 +87,11 @@ public class FoodWave extends GenericEntity {
...
@@ -86,11 +87,11 @@ public class FoodWave extends GenericEntity {
this
.
description
=
waveDescription
;
this
.
description
=
waveDescription
;
}
}
public
Calendar
getTime
()
{
public
Date
getTime
()
{
return
time
;
return
time
;
}
}
public
void
setTime
(
Calendar
waveTime
)
{
public
void
setTime
(
Date
waveTime
)
{
this
.
time
=
waveTime
;
this
.
time
=
waveTime
;
}
}
...
@@ -143,7 +144,7 @@ public class FoodWave extends GenericEntity {
...
@@ -143,7 +144,7 @@ public class FoodWave extends GenericEntity {
return
false
;
return
false
;
}
}
if
(
getTime
().
before
(
Calendar
.
getInstanc
e
()))
{
if
(
getTime
().
before
(
new
Dat
e
()))
{
return
false
;
return
false
;
}
}
...
...
code/LanBortalWeb/WebContent/foodadmin/editTemplate.xhtml
View file @
fc433b1
...
@@ -80,6 +80,7 @@
...
@@ -80,6 +80,7 @@
value=
"#{foodWaveView.template.products}"
var=
"product"
value=
"#{foodWaveView.template.products}"
var=
"product"
editable=
"true"
>
editable=
"true"
>
<p:ajax
event=
"rowEdit"
listener=
"#{foodWaveView.onEdit}"
/>
<p:ajax
event=
"rowEdit"
listener=
"#{foodWaveView.onEdit}"
/>
<p:column
headerText=
"#{i18n['foodwavetemplate.productname']}"
>
<p:column
headerText=
"#{i18n['foodwavetemplate.productname']}"
>
...
...
code/LanBortalWeb/WebContent/foodmanager/listFoodwaves.xhtml
View file @
fc433b1
...
@@ -21,16 +21,24 @@
...
@@ -21,16 +21,24 @@
<h1>
#{i18n['foodWave.list']}
</h1>
<h1>
#{i18n['foodWave.list']}
</h1>
</ui:define>
</ui:define>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:form>
<p:dataTable
styleClass=
"bordertable"
<p:dataTable
styleClass=
"bordertable"
value=
"#{foodWaveView.foodWaves}"
var=
"foodwave"
editable=
"true"
>
value=
"#{foodWaveView.foodWaves}"
var=
"foodwave"
>
<p:ajax
event=
"rowEdit"
listener=
"#{foodWaveView.onEditFoodWave}"
/>
<p:column>
<p:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.time']}"
/>
<h:outputText
value=
"${i18n['foodWave.time']}"
/>
</f:facet>
</f:facet>
<h:outputText
value=
"#{foodwave.time.time}"
>
<p:cellEditor>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
<f:facet
name=
"output"
>
</h:outputText>
<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>
<p:column>
<p:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
...
@@ -42,8 +50,15 @@
...
@@ -42,8 +50,15 @@
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:outputLabel
id=
"name"
value=
"${i18n['foodWave.name']}"
/>
<h:outputLabel
id=
"name"
value=
"${i18n['foodWave.name']}"
/>
</f:facet>
</f:facet>
<p:cellEditor>
<h:outputText
value=
"#{foodwave.name}"
/>
<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>
<p:column
styleClass=
"text-center"
>
<p:column
styleClass=
"text-center"
>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
...
@@ -69,7 +84,12 @@
...
@@ -69,7 +84,12 @@
value=
"#{i18n['foodWave.show']}"
>
value=
"#{i18n['foodWave.show']}"
>
<f:param
name=
"foodwaveid"
value=
"#{foodwave.id}"
/>
<f:param
name=
"foodwaveid"
value=
"#{foodwave.id}"
/>
</h:link>
</h:link>
</p:column>
<!--
</p:column>
<p:column>
<p:rowEditor
/>
</p:column>
<!--
<p:column>
<p:column>
<h:outputText value="#{foodwave.closed.toString()}" />
<h:outputText value="#{foodwave.closed.toString()}" />
<p:commandButton rendered="#{foodwave.closed}"
<p:commandButton rendered="#{foodwave.closed}"
...
@@ -80,8 +100,7 @@
...
@@ -80,8 +100,7 @@
action="#{foodwave.toggleClosed}" />
action="#{foodwave.toggleClosed}" />
</p:column> -->
</p:column> -->
</p:dataTable>
</p:dataTable>
</h:form>
</ui:define>
</ui:define>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
View file @
fc433b1
...
@@ -67,7 +67,7 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -67,7 +67,7 @@ public class FoodWaveView extends GenericCDIView {
private
Integer
foodWaveId
;
private
Integer
foodWaveId
;
private
ListDataModel
<
AccountEvent
>
accountEventLines
;
private
ListDataModel
<
AccountEvent
>
accountEventLines
;
private
List
<
FoodWave
>
foodWaves
;
private
List
DataModel
<
FoodWave
>
foodWaves
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
FoodWaveView
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
FoodWaveView
.
class
);
public
List
<
Product
>
getProducts
()
{
public
List
<
Product
>
getProducts
()
{
...
@@ -79,6 +79,11 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -79,6 +79,11 @@ public class FoodWaveView extends GenericCDIView {
public
void
onEdit
()
{
public
void
onEdit
()
{
this
.
foodWaveBean
.
saveTemplate
(
template
);
this
.
foodWaveBean
.
saveTemplate
(
template
);
}
}
public
void
onEditFoodWave
()
{
FoodWave
fw
=
foodWaves
.
getRowData
();
this
.
foodWaveBean
.
merge
(
fw
);
}
public
void
initTemplateList
()
{
public
void
initTemplateList
()
{
super
.
requirePermissions
(
ShopPermission
.
SHOP_FOODWAVE
);
super
.
requirePermissions
(
ShopPermission
.
SHOP_FOODWAVE
);
...
@@ -87,7 +92,11 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -87,7 +92,11 @@ public class FoodWaveView extends GenericCDIView {
public
void
initFoodwaveManagerList
()
{
public
void
initFoodwaveManagerList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_FOODWAVES
))
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 {
...
@@ -95,7 +104,7 @@ public class FoodWaveView extends GenericCDIView {
public
String
createFoodwave
()
{
public
String
createFoodwave
()
{
Calendar
c
=
Calendar
.
getInstance
();
Calendar
c
=
Calendar
.
getInstance
();
c
.
setTime
(
startDate
);
c
.
setTime
(
startDate
);
selectedFoodWave
.
setTime
(
c
);
selectedFoodWave
.
setTime
(
c
.
getTime
()
);
foodWaveBean
.
createFoodWave
(
selectedFoodWave
);
foodWaveBean
.
createFoodWave
(
selectedFoodWave
);
initFoodwaveManagerList
();
initFoodwaveManagerList
();
...
@@ -110,9 +119,9 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -110,9 +119,9 @@ public class FoodWaveView extends GenericCDIView {
if
(
templateId
!=
null
)
if
(
templateId
!=
null
)
{
{
template
=
foodWaveBean
.
findTemplate
(
templateId
);
template
=
foodWaveBean
.
findTemplate
(
templateId
);
foodWaves
=
template
.
getFoodwaves
(
);
foodWaves
=
new
ListDataModel
<
FoodWave
>(
template
.
getFoodwaves
()
);
}
else
{
}
else
{
foodWaves
=
foodWaveBean
.
getOpenFoodWaves
(
);
foodWaves
=
new
ListDataModel
<
FoodWave
>(
foodWaveBean
.
getOpenFoodWaves
()
);
}
}
super
.
beginConversation
();
super
.
beginConversation
();
}
}
...
@@ -335,11 +344,11 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -335,11 +344,11 @@ public class FoodWaveView extends GenericCDIView {
this
.
billLines
=
billLines
;
this
.
billLines
=
billLines
;
}
}
public
void
setFoodWaves
(
List
<
FoodWave
>
foodWaves
)
{
public
void
setFoodWaves
(
List
DataModel
<
FoodWave
>
foodWaves
)
{
this
.
foodWaves
=
foodWaves
;
this
.
foodWaves
=
foodWaves
;
}
}
public
List
<
FoodWave
>
getFoodWaves
()
{
public
List
DataModel
<
FoodWave
>
getFoodWaves
()
{
return
foodWaves
;
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