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 9066cb2c
authored
Oct 25, 2012
by
Tuukka Kivilahti, TKffTK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aaltoja, aaltoja
1 parent
76da913a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
26 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/FoodWaveFacade.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/FoodWaveBeanLocal.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
code/LanBortalWeb/WebContent/WEB-INF/web.xml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
View file @
9066cb2
...
...
@@ -75,5 +75,10 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
public
FoodWaveTemplate
findTemplate
(
Integer
templateId
)
{
return
fwtFacade
.
find
(
templateId
);
}
@Override
public
List
<
FoodWave
>
getEventFoodWaves
()
{
return
foodWaveFacade
.
getEventFoodWaves
();
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/FoodWaveFacade.java
View file @
9066cb2
...
...
@@ -21,24 +21,28 @@ import fi.insomnia.bortal.model.OrgRole_;
public
class
FoodWaveFacade
extends
IntegerPkGenericFacade
<
FoodWave
>
{
@EJB
EventBeanLocal
eventBean
;
public
FoodWaveFacade
()
{
super
(
FoodWave
.
class
);
}
public
List
<
FoodWave
>
getEventFoodWaves
()
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
FoodWave
>
cq
=
cb
.
createQuery
(
FoodWave
.
class
);
Root
<
FoodWave
>
root
=
cq
.
from
(
FoodWave
.
class
);
cq
.
where
(
cb
.
equal
(
root
.
get
(
FoodWave_
.
template
).
get
(
FoodWaveTemplate_
.
event
),
eventBean
.
getCurrentEvent
()));
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
public
List
<
FoodWave
>
getOpenFoodWaves
()
{
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
.
getInstance
()),
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
),
Calendar
.
getInstance
()),
cb
.
isFalse
(
root
.
get
(
FoodWave_
.
closed
)),
cb
.
equal
(
root
.
get
(
FoodWave_
.
template
).
get
(
FoodWaveTemplate_
.
event
),
eventBean
.
getCurrentEvent
()));
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
...
...
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/FoodWaveBeanLocal.java
View file @
9066cb2
...
...
@@ -25,4 +25,6 @@ public interface FoodWaveBeanLocal {
public
FoodWave
findFoodwave
(
Integer
foodwaveId
);
public
FoodWave
merge
(
FoodWave
foodWave
);
public
List
<
FoodWave
>
getEventFoodWaves
();
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
View file @
9066cb2
...
...
@@ -47,6 +47,9 @@ public class FoodWave extends GenericEntity {
@OneToMany
(
mappedBy
=
"foodWave"
)
private
List
<
AccountEvent
>
accountEvents
;
@OneToMany
(
mappedBy
=
"foodwave"
)
private
List
<
BillLine
>
billLines
;
@ManyToOne
@JoinColumn
(
name
=
"template_id"
,
referencedColumnName
=
"id"
,
nullable
=
false
)
private
FoodWaveTemplate
template
;
...
...
@@ -92,7 +95,7 @@ public class FoodWave extends GenericEntity {
public
boolean
isClosed
()
{
return
closed
;
}
public
void
setClosed
(
boolean
waveClosed
)
{
this
.
closed
=
waveClosed
;
}
...
...
@@ -112,7 +115,7 @@ public class FoodWave extends GenericEntity {
public
FoodWaveTemplate
getTemplate
()
{
return
template
;
}
public
boolean
isFull
()
{
return
false
;
}
...
...
@@ -121,30 +124,46 @@ public class FoodWave extends GenericEntity {
* Check if foodwave is orderable
*
* That means that it's not closed, full and it's in future
*
* @return
*/
public
boolean
isOrderable
()
{
if
(
isClosed
())
{
if
(
isClosed
())
{
return
false
;
}
if
(
getTime
().
before
(
Calendar
.
getInstance
()))
{
if
(
getTime
().
before
(
Calendar
.
getInstance
()))
{
return
false
;
}
if
(
isFull
())
{
if
(
isFull
())
{
return
false
;
}
return
true
;
}
}
public
List
<
BillLine
>
getBillLines
()
{
return
billLines
;
}
public
void
setBillLines
(
List
<
BillLine
>
billLines
)
{
this
.
billLines
=
billLines
;
}
public
int
getReservedCount
()
{
int
retval
=
0
;
if
(
getAccountEvents
()
!=
null
)
{
retval
+=
getAccountEvents
().
size
();
}
if
(
getBillLines
()
!=
null
)
{
retval
+=
getBillLines
().
size
();
}
return
retval
;
}
}
code/LanBortalWeb/WebContent/WEB-INF/web.xml
View file @
9066cb2
...
...
@@ -9,8 +9,8 @@
</session-config>
<context-param>
<param-name>
javax.faces.PROJECT_STAGE
</param-name>
<
param-value>
Production
</param-value
>
<
!--<param-value>Development</param-value>--
>
<
!-- <param-value>Production</param-value> --
>
<
param-value>
Development
</param-value
>
</context-param>
<context-param>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
View file @
9066cb2
...
...
@@ -37,8 +37,7 @@ public class FoodWaveView extends GenericCDIView {
public
void
initTemplateList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
))
{
setTemplates
(
new
ListDataModel
<
FoodWaveTemplate
>(
foodWaveBean
.
getTemplates
()));
setTemplates
(
new
ListDataModel
<
FoodWaveTemplate
>(
foodWaveBean
.
getTemplates
()));
super
.
beginConversation
();
}
...
...
@@ -65,8 +64,11 @@ public class FoodWaveView extends GenericCDIView {
}
public
void
initUserFoodWaveList
()
{
this
.
foodWaves
=
new
ListDataModel
<
FoodWave
>(
foodWaveBean
.
getOpenFoodWaves
());
this
.
foodWaves
=
new
ListDataModel
<
FoodWave
>(
foodWaveBean
.
getOpenFoodWaves
());
}
public
void
initFoodwaveManagerList
()
{
this
.
foodWaves
=
new
ListDataModel
<
FoodWave
>(
foodWaveBean
.
getEventFoodWaves
());
}
public
String
editTemplate
()
{
...
...
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