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 00cde394
authored
Oct 26, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Foodwave cleanausta
1 parent
7fc5ab1d
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
87 additions
and
120 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PermissionBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/RoleBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/RoleBeanLocal.java
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/ShopPermission.java
code/LanBortalWeb/WebContent/foodmanager/listOrders.xhtml
code/LanBortalWeb/WebContent/foodwave/list.xhtml
code/LanBortalWeb/WebContent/foodwave/listTemplates.xhtml
code/LanBortalWeb/WebContent/resources/cditools/foodwave/listTemplates.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveFoodView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/FoodWaveBean.java
View file @
00cde39
...
@@ -12,7 +12,6 @@ import sun.reflect.generics.reflectiveObjects.NotImplementedException;
...
@@ -12,7 +12,6 @@ import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.facade.FoodWaveFacade
;
import
fi.insomnia.bortal.facade.FoodWaveFacade
;
import
fi.insomnia.bortal.facade.FoodWaveTemplateFacade
;
import
fi.insomnia.bortal.facade.FoodWaveTemplateFacade
;
import
fi.insomnia.bortal.facade.GenericFacade
;
import
fi.insomnia.bortal.facade.ProductFacade
;
import
fi.insomnia.bortal.facade.ProductFacade
;
import
fi.insomnia.bortal.model.FoodWave
;
import
fi.insomnia.bortal.model.FoodWave
;
import
fi.insomnia.bortal.model.FoodWaveTemplate
;
import
fi.insomnia.bortal.model.FoodWaveTemplate
;
...
@@ -22,7 +21,7 @@ import fi.insomnia.bortal.model.Product;
...
@@ -22,7 +21,7 @@ import fi.insomnia.bortal.model.Product;
* Session Bean implementation class FoodWaveBean
* Session Bean implementation class FoodWaveBean
*/
*/
@Stateless
@Stateless
@DeclareRoles
(
ShopPermission
.
S_MANAGE_PRODUCTS
)
@DeclareRoles
(
{
ShopPermission
.
S_MANAGE_PRODUCTS
,
ShopPermission
.
S_SHOP_FOODWAVE
,
ShopPermission
.
S_MANAGE_FOODWAVES
}
)
public
class
FoodWaveBean
implements
FoodWaveBeanLocal
{
public
class
FoodWaveBean
implements
FoodWaveBeanLocal
{
@EJB
@EJB
...
@@ -63,11 +62,12 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
...
@@ -63,11 +62,12 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
}
}
@Override
@Override
@RolesAllowed
(
"SHOP/READ"
)
@RolesAllowed
(
ShopPermission
.
S_SHOP_FOODWAVE
)
public
List
<
FoodWave
>
getOpenFoodWaves
()
{
public
List
<
FoodWave
>
getOpenFoodWaves
()
{
return
foodWaveFacade
.
getOpenFoodWaves
();
return
foodWaveFacade
.
getOpenFoodWaves
();
}
}
@RolesAllowed
({
ShopPermission
.
S_SHOP_FOODWAVE
,
ShopPermission
.
S_MANAGE_FOODWAVES
})
public
FoodWave
findFoodwave
(
Integer
foodwaveId
)
{
public
FoodWave
findFoodwave
(
Integer
foodwaveId
)
{
return
foodWaveFacade
.
find
(
foodwaveId
);
return
foodWaveFacade
.
find
(
foodwaveId
);
}
}
...
@@ -94,6 +94,7 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
...
@@ -94,6 +94,7 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
}
}
@Override
@Override
@RolesAllowed
(
ShopPermission
.
S_MANAGE_FOODWAVES
)
public
FoodWaveTemplate
addProductToTemplate
(
FoodWaveTemplate
template
,
Product
product
)
{
public
FoodWaveTemplate
addProductToTemplate
(
FoodWaveTemplate
template
,
Product
product
)
{
template
=
fwtFacade
.
reload
(
template
);
template
=
fwtFacade
.
reload
(
template
);
if
(
product
.
getId
()
==
null
)
if
(
product
.
getId
()
==
null
)
...
@@ -113,7 +114,6 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
...
@@ -113,7 +114,6 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
template
.
getProducts
().
add
(
product
);
template
.
getProducts
().
add
(
product
);
product
.
getFoodWaveTemplates
().
add
(
template
);
product
.
getFoodWaveTemplates
().
add
(
template
);
return
template
;
return
template
;
}
}
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PermissionBean.java
View file @
00cde39
...
@@ -58,6 +58,7 @@ import fi.insomnia.bortal.model.User;
...
@@ -58,6 +58,7 @@ import fi.insomnia.bortal.model.User;
ShopPermission
.
S_MANAGE_PRODUCTS
,
ShopPermission
.
S_MANAGE_PRODUCTS
,
ShopPermission
.
S_SHOP_PRODUCTS
,
ShopPermission
.
S_SHOP_PRODUCTS
,
ShopPermission
.
S_SHOP_FOODWAVE
,
ShopPermission
.
S_SHOP_FOODWAVE
,
ShopPermission
.
S_MANAGE_FOODWAVES
,
BillPermission
.
S_CREATE_BILL
,
BillPermission
.
S_CREATE_BILL
,
BillPermission
.
S_READ_ALL
,
BillPermission
.
S_READ_ALL
,
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/RoleBean.java
View file @
00cde39
...
@@ -187,4 +187,10 @@ public class RoleBean implements RoleBeanLocal {
...
@@ -187,4 +187,10 @@ public class RoleBean implements RoleBeanLocal {
}
}
}
}
}
}
@Override
@RolesAllowed
(
UserPermission
.
S_READ_ROLES
)
public
List
<
Role
>
getRoles
(
EventUser
selectedUser
)
{
return
roleFacade
.
findForUser
(
selectedUser
);
}
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/RoleBeanLocal.java
View file @
00cde39
...
@@ -34,4 +34,6 @@ public interface RoleBeanLocal {
...
@@ -34,4 +34,6 @@ public interface RoleBeanLocal {
public
void
saveRoles
(
EventUser
usr
,
List
<
Role
>
usersRoles
);
public
void
saveRoles
(
EventUser
usr
,
List
<
Role
>
usersRoles
);
public
List
<
Role
>
getRoles
(
EventUser
selectedUser
);
}
}
code/LanBortalUtilities/src/fi/insomnia/bortal/enums/apps/ShopPermission.java
View file @
00cde39
...
@@ -10,6 +10,7 @@ public enum ShopPermission implements IAppPermission {
...
@@ -10,6 +10,7 @@ public enum ShopPermission implements IAppPermission {
SHOP_PRODUCTS
,
// ("Shop products to self"),
SHOP_PRODUCTS
,
// ("Shop products to self"),
MANAGE_PRODUCTS
,
// ("Create and modify products"),
MANAGE_PRODUCTS
,
// ("Create and modify products"),
SHOP_FOODWAVE
,
// Shop for food
SHOP_FOODWAVE
,
// Shop for food
MANAGE_FOODWAVES
,
;
;
...
@@ -19,6 +20,7 @@ public enum ShopPermission implements IAppPermission {
...
@@ -19,6 +20,7 @@ public enum ShopPermission implements IAppPermission {
public
static
final
String
S_SHOP_PRODUCTS
=
"SHOP/SHOP_PRODUCTS"
;
public
static
final
String
S_SHOP_PRODUCTS
=
"SHOP/SHOP_PRODUCTS"
;
public
static
final
String
S_MANAGE_PRODUCTS
=
"SHOP/MANAGE_PRODUCTS"
;
public
static
final
String
S_MANAGE_PRODUCTS
=
"SHOP/MANAGE_PRODUCTS"
;
public
static
final
String
S_SHOP_FOODWAVE
=
"SHOP/SHOP_FOODWAVE"
;
public
static
final
String
S_SHOP_FOODWAVE
=
"SHOP/SHOP_FOODWAVE"
;
public
static
final
String
S_MANAGE_FOODWAVES
=
"SHOP/MANAGE_FOODWAVES"
;
private
final
String
fullName
;
private
final
String
fullName
;
private
final
String
key
;
private
final
String
key
;
...
...
code/LanBortalWeb/WebContent/foodmanager/listOrders.xhtml
View file @
00cde39
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.unconfirmedOrders']}"
/>
<h:outputText
value=
"${i18n['foodWave.unconfirmedOrders']}"
/>
</f:facet>
</f:facet>
<h:link
outcome=
"/foodmanager/listOrders"
value=
"#{foodWaveView.billLines.
size()
}"
>
<h:link
outcome=
"/foodmanager/listOrders"
value=
"#{foodWaveView.billLines.
rowCount
}"
>
<f:param
name=
"foodwaveid"
value=
"#{foodwave.id}"
/>
<f:param
name=
"foodwaveid"
value=
"#{foodwave.id}"
/>
</h:link>
</h:link>
</h:column>
<!--
</h:column>
<!--
...
...
code/LanBortalWeb/WebContent/foodwave/list.xhtml
View file @
00cde39
...
@@ -13,12 +13,12 @@
...
@@ -13,12 +13,12 @@
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:
event
type=
"preRenderView"
<f:
viewParam
name=
"templateid"
value=
"#{foodWaveView.templateId}"
/>
listener=
"#{foodWaveView.initTemplateList
}"
/>
<f:event
type=
"preRenderView"
listener=
"#{foodWaveView.initListFoodwaves
}"
/>
</f:metadata>
</f:metadata>
<ui:define
name=
"title"
>
<ui:define
name=
"title"
>
<h1>
#{i18n['user.
shop
.title']}
</h1>
<h1>
#{i18n['user.
foodwavelist
.title']}
</h1>
</ui:define>
</ui:define>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</h:column>
</h:column>
<h:column>
<h:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['foodWave.template
.
name']}"
/>
<h:outputText
value=
"${i18n['foodWave.templatename']}"
/>
</f:facet>
</f:facet>
<h:link
outcome=
"/foodwave/listProducts"
<h:link
outcome=
"/foodwave/listProducts"
value=
"#{foodwave.template.name}"
>
value=
"#{foodwave.template.name}"
>
...
...
code/LanBortalWeb/WebContent/foodwave/listTemplates.xhtml
View file @
00cde39
...
@@ -15,9 +15,7 @@
...
@@ -15,9 +15,7 @@
</ui:define>
</ui:define>
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<foodwave:listTemplates
selectaction=
"#{foodWaveView.selectTemplate}"
items=
"#{foodWaveView.templates}"
<foodwave:listTemplates
outcome=
"/foodwave/list"
items=
"#{foodWaveView.templates}"
/>
commitValue=
"#{i18n['food']}"
/>
</ui:define>
</ui:define>
...
...
code/LanBortalWeb/WebContent/resources/cditools/foodwave/listTemplates.xhtml
View file @
00cde39
<?xml version='1.0' encoding='UTF-8' ?>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:composite=
"http://java.sun.com/jsf/composite"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
>
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:composite=
"http://java.sun.com/jsf/composite"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
>
<composite:interface>
<composite:interface>
<composite:attribute
name=
"items"
required=
"true"
/>
<composite:attribute
name=
"items"
required=
"true"
/>
<composite:attribute
name=
"selectaction"
<composite:attribute
name=
"outcome"
required=
"true"
/>
method-signature=
"java.lang.String action()"
required=
"true"
/>
</composite:interface>
</composite:interface>
<composite:implementation>
<composite:implementation>
...
@@ -21,17 +15,15 @@
...
@@ -21,17 +15,15 @@
<!-- <h:outputScript target="head" library="script" name="shopscript.js" /> -->
<!-- <h:outputScript target="head" library="script" name="shopscript.js" /> -->
<h:outputScript
library=
"primefaces"
name=
"jquery/jquery.js"
/>
<h:outputScript
library=
"primefaces"
name=
"jquery/jquery.js"
/>
<h:form>
<h:dataTable
columnClasses=
"nowrap,numalign,numalign,nowrap,numalign"
<h:dataTable
columnClasses=
"nowrap,numalign,numalign,nowrap,numalign"
styleClass=
"bordertable"
id=
"billcart"
value=
"#{cc.attrs.items}"
var=
"template"
>
styleClass=
"bordertable"
id=
"billcart"
value=
"#{cc.attrs.items}"
var=
"template"
>
<h:column>
<h:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
<h:outputText
id=
"name"
value=
"${i18n['foodWave.name']}"
/>
<h:outputText
id=
"name"
value=
"${i18n['foodWave.name']}"
/>
</f:facet>
</f:facet>
<h:commandLink
action=
"#{cc.attrs.selectaction}"
<h:link
outcome=
"#{cc.attrs.outcome}"
value=
"#{template.name}"
>
value=
"#{template.name}"
/>
<f:param
name=
"templateid"
value=
"#{template.id}"
/>
</h:link>
</h:column>
</h:column>
<h:column>
<h:column>
<f:facet
name=
"header"
>
<f:facet
name=
"header"
>
...
@@ -43,7 +35,6 @@
...
@@ -43,7 +35,6 @@
</h:dataTable>
</h:dataTable>
</h:form>
</composite:implementation>
</composite:implementation>
</html>
</html>
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveFoodView.java
View file @
00cde39
...
@@ -9,6 +9,9 @@ import javax.faces.model.ListDataModel;
...
@@ -9,6 +9,9 @@ import javax.faces.model.ListDataModel;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.beans.AccountEventBeanLocal
;
import
fi.insomnia.bortal.beans.AccountEventBeanLocal
;
import
fi.insomnia.bortal.beans.BillBeanLocal
;
import
fi.insomnia.bortal.beans.BillBeanLocal
;
import
fi.insomnia.bortal.beans.EventBeanLocal
;
import
fi.insomnia.bortal.beans.EventBeanLocal
;
...
@@ -61,31 +64,23 @@ public class FoodWaveFoodView extends GenericCDIView {
...
@@ -61,31 +64,23 @@ public class FoodWaveFoodView extends GenericCDIView {
private
transient
ListDataModel
<
ProductShopItem
>
shoppingcart
;
private
transient
ListDataModel
<
ProductShopItem
>
shoppingcart
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
FoodWaveFoodView
.
class
);
public
void
initFoodWaveFoods
()
{
public
void
initFoodWaveFoods
()
{
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
)
&&
getFoodwaveid
()
>
0
&&
getShoppingcart
()
==
null
)
{
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
)
&&
foodWave
=
foodWaveBean
.
findFoodwave
(
getFoodwaveid
());
getFoodwaveid
()
>
0
&&
getShoppingcart
()
==
null
)
{
logger
.
debug
(
"Foodwave {}"
,
foodWave
);
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productGTList
(
foodWave
.
getTemplate
().
getProducts
()));
setFoodWave
(
foodWaveBean
.
findFoodwave
(
getFoodwaveid
()));
setShoppingcart
(
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productGTList
(
getFoodWave
().
getTemplate
().
getProducts
()
)));
System
.
out
.
println
(
"beginconversation"
);
this
.
beginConversation
();
this
.
beginConversation
();
//products = new ListDataModel<Product>(getFoodWave().getTemplate().getProducts());
}
}
}
}
public
ListDataModel
<
Product
>
getProducts
()
{
public
ListDataModel
<
Product
>
getProducts
()
{
return
products
;
return
products
;
}
}
public
void
setProducts
(
ListDataModel
<
Product
>
products
)
{
public
void
setProducts
(
ListDataModel
<
Product
>
products
)
{
this
.
products
=
products
;
this
.
products
=
products
;
}
}
...
@@ -109,7 +104,7 @@ public class FoodWaveFoodView extends GenericCDIView {
...
@@ -109,7 +104,7 @@ public class FoodWaveFoodView extends GenericCDIView {
public
String
add
(
Integer
count
)
{
public
String
add
(
Integer
count
)
{
ProductShopItem
item
=
getShoppingcart
().
getRowData
();
ProductShopItem
item
=
getShoppingcart
().
getRowData
();
item
.
setCount
(
item
.
getCount
().
add
(
BigDecimal
.
valueOf
(
count
)));
item
.
setCount
(
item
.
getCount
().
add
(
BigDecimal
.
valueOf
(
count
)));
System
.
out
.
println
(
"foobar"
+
item
.
getCount
());
System
.
out
.
println
(
"foobar"
+
item
.
getCount
());
return
null
;
return
null
;
}
}
...
@@ -131,11 +126,9 @@ public class FoodWaveFoodView extends GenericCDIView {
...
@@ -131,11 +126,9 @@ public class FoodWaveFoodView extends GenericCDIView {
return
ret
;
return
ret
;
}
}
/**
/**
* Just create bills, they are nice
* Just create bills, they are nice
<insert picture of bill gates here>
*
<insert picture of bill gates here>
*
* @return
* @return
*/
*/
public
Bill
createBillFromShoppingcart
()
{
public
Bill
createBillFromShoppingcart
()
{
...
@@ -162,7 +155,7 @@ public class FoodWaveFoodView extends GenericCDIView {
...
@@ -162,7 +155,7 @@ public class FoodWaveFoodView extends GenericCDIView {
public
String
buyFromInternet
()
{
public
String
buyFromInternet
()
{
Bill
bill
=
createBillFromShoppingcart
();
Bill
bill
=
createBillFromShoppingcart
();
if
(
bill
!=
null
)
{
if
(
bill
!=
null
)
{
getBillEditView
().
setBillid
(
bill
.
getId
());
getBillEditView
().
setBillid
(
bill
.
getId
());
return
"/bill/showBill?faces-redirect=true&IncludeViewParams=true"
;
return
"/bill/showBill?faces-redirect=true&IncludeViewParams=true"
;
...
@@ -171,8 +164,6 @@ public class FoodWaveFoodView extends GenericCDIView {
...
@@ -171,8 +164,6 @@ public class FoodWaveFoodView extends GenericCDIView {
return
null
;
return
null
;
}
}
public
void
setUser
(
EventUser
user
)
{
public
void
setUser
(
EventUser
user
)
{
this
.
user
=
user
;
this
.
user
=
user
;
}
}
...
@@ -199,20 +190,12 @@ public class FoodWaveFoodView extends GenericCDIView {
...
@@ -199,20 +190,12 @@ public class FoodWaveFoodView extends GenericCDIView {
return
false
;
return
false
;
}
}
public
BillEditView
getBillEditView
()
{
public
BillEditView
getBillEditView
()
{
return
billEditView
;
return
billEditView
;
}
}
public
void
setBillEditView
(
BillEditView
billEditView
)
{
public
void
setBillEditView
(
BillEditView
billEditView
)
{
this
.
billEditView
=
billEditView
;
this
.
billEditView
=
billEditView
;
}
}
}
}
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
View file @
00cde39
...
@@ -5,7 +5,6 @@ import java.util.Calendar;
...
@@ -5,7 +5,6 @@ import java.util.Calendar;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.TreeSet
;
import
java.util.TreeSet
;
import
java.util.Vector
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
...
@@ -36,7 +35,6 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -36,7 +35,6 @@ public class FoodWaveView extends GenericCDIView {
@Inject
@Inject
private
FoodWaveFoodView
foodWaveFoodView
;
private
FoodWaveFoodView
foodWaveFoodView
;
private
ListDataModel
<
FoodWaveTemplate
>
templates
;
private
FoodWaveTemplate
template
;
private
FoodWaveTemplate
template
;
private
Integer
templateId
;
private
Integer
templateId
;
@EJB
@EJB
...
@@ -44,9 +42,6 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -44,9 +42,6 @@ public class FoodWaveView extends GenericCDIView {
@EJB
@EJB
private
ProductBeanLocal
productbeanlocal
;
private
ProductBeanLocal
productbeanlocal
;
private
ListDataModel
<
FoodWave
>
foodWaves
;
private
FoodWave
selectedFoodWave
=
null
;
private
FoodWave
selectedFoodWave
=
null
;
private
Date
startDate
;
private
Date
startDate
;
...
@@ -56,17 +51,20 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -56,17 +51,20 @@ public class FoodWaveView extends GenericCDIView {
private
Integer
foodWaveId
;
private
Integer
foodWaveId
;
private
ListDataModel
<
AccountEvent
>
accountEventLines
;
private
ListDataModel
<
AccountEvent
>
accountEventLines
;
private
List
<
FoodWave
>
foodWaves
;
public
List
<
Product
>
getProducts
()
{
public
List
<
Product
>
getProducts
()
{
return
productbeanlocal
.
getProducts
();
return
productbeanlocal
.
getProducts
();
}
}
public
void
initTemplateList
()
{
public
void
initTemplateList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
))
{
super
.
requirePermissions
(
ShopPermission
.
SHOP_FOODWAVE
);
}
setTemplates
(
new
ListDataModel
<
FoodWaveTemplate
>(
foodWaveBean
.
getTemplates
()));
public
void
initFoodwaveManagerList
()
{
super
.
beginConversation
();
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_FOODWAVES
))
{
foodWaves
=
foodWaveBean
.
getEventFoodWaves
();
}
}
}
}
...
@@ -76,12 +74,26 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -76,12 +74,26 @@ public class FoodWaveView extends GenericCDIView {
c
.
setTime
(
startDate
);
c
.
setTime
(
startDate
);
selectedFoodWave
.
setTime
(
c
);
selectedFoodWave
.
setTime
(
c
);
foodWaveBean
.
createFoodWave
(
selectedFoodWave
);
foodWaveBean
.
createFoodWave
(
selectedFoodWave
);
initFoodwaveManagerList
();
//
initFoodwaveManagerList();
return
"/foodmanager/listFoodwaves"
;
return
"/foodmanager/listFoodwaves"
;
}
}
public
void
initListFoodwaves
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
SHOP_FOODWAVE
)
&&
template
==
null
)
{
if
(
templateId
!=
null
)
{
template
=
foodWaveBean
.
findTemplate
(
templateId
);
foodWaves
=
template
.
getFoodwaves
();
}
else
{
foodWaves
=
foodWaveBean
.
getOpenFoodWaves
();
}
super
.
beginConversation
();
}
}
public
void
initEditTemplate
()
{
public
void
initEditTemplate
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_PRODUCTS
)
&&
template
==
null
)
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_PRODUCTS
)
&&
template
==
null
)
...
@@ -131,19 +143,21 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -131,19 +143,21 @@ public class FoodWaveView extends GenericCDIView {
this
.
currentProduct
=
currentProduct
;
this
.
currentProduct
=
currentProduct
;
}
}
public
void
initUserFoodWaveList
()
{
// 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 void initFoodwaveManagerList() {
}
// this.foodWaves = new
// ListDataModel<FoodWave>(foodWaveBean.getEventFoodWaves());
// }
public
void
initFoodWaveOrderList
()
{
public
void
initFoodWaveOrderList
()
{
if
(
foodWaveId
!
=
null
)
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_FOODWAVES
)
&&
selectedFoodWave
=
=
null
)
{
se
tSelectedFoodWave
(
foodWaveBean
.
findFoodwave
(
foodWaveId
)
);
se
lectedFoodWave
=
foodWaveBean
.
findFoodwave
(
foodWaveId
);
this
.
setBillLines
(
new
ListDataModel
<
BillLine
>(
selectedFoodWave
.
getBillLines
()
));
billLines
=
new
ListDataModel
<
BillLine
>(
selectedFoodWave
.
getBillLines
(
));
this
.
accountEventLines
=
new
ListDataModel
<
AccountEvent
>(
selectedFoodWave
.
getAccountEvents
());
this
.
accountEventLines
=
new
ListDataModel
<
AccountEvent
>(
selectedFoodWave
.
getAccountEvents
());
super
.
beginConversation
();
super
.
beginConversation
();
...
@@ -151,11 +165,6 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -151,11 +165,6 @@ public class FoodWaveView extends GenericCDIView {
}
}
public
String
editTemplate
()
{
setTemplate
(
getTemplates
().
getRowData
());
return
"/foodadmin/editTemplate"
;
}
public
String
saveTemplate
()
public
String
saveTemplate
()
{
{
setTemplate
(
foodWaveBean
.
saveOrCreateTemplate
(
getTemplate
()));
setTemplate
(
foodWaveBean
.
saveOrCreateTemplate
(
getTemplate
()));
...
@@ -171,34 +180,8 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -171,34 +180,8 @@ public class FoodWaveView extends GenericCDIView {
this
.
template
=
template
;
this
.
template
=
template
;
}
}
public
ListDataModel
<
FoodWaveTemplate
>
getTemplates
()
{
public
List
<
FoodWaveTemplate
>
getTemplates
()
{
return
templates
;
return
foodWaveBean
.
getTemplates
();
}
public
void
setTemplates
(
ListDataModel
<
FoodWaveTemplate
>
templates
)
{
this
.
templates
=
templates
;
}
public
ListDataModel
<
FoodWave
>
getFoodWaves
()
{
return
foodWaves
;
}
public
String
selectFoodWave
()
{
if
(
foodWaves
.
isRowAvailable
())
{
// setSelectedFoodWave(foodWaves.getRowData());
}
return
"/foodwave/listProducts"
;
}
public
String
selectTemplate
()
{
if
(
templates
.
isRowAvailable
())
{
foodWaves
=
new
ListDataModel
<
FoodWave
>(
templates
.
getRowData
()
.
getOrderableFoodwaves
());
}
return
"/foodwave/list"
;
}
}
public
FoodWave
getSelectedFoodWave
()
{
public
FoodWave
getSelectedFoodWave
()
{
...
@@ -209,14 +192,6 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -209,14 +192,6 @@ public class FoodWaveView extends GenericCDIView {
this
.
selectedFoodWave
=
selectedFoodWave
;
this
.
selectedFoodWave
=
selectedFoodWave
;
}
}
private
FoodWaveFoodView
getFoodWaveFoodView
()
{
return
foodWaveFoodView
;
}
private
void
setFoodWaveFoodView
(
FoodWaveFoodView
foodWaveFoodView
)
{
this
.
foodWaveFoodView
=
foodWaveFoodView
;
}
public
Integer
getTemplateId
()
{
public
Integer
getTemplateId
()
{
return
templateId
;
return
templateId
;
}
}
...
@@ -253,4 +228,13 @@ public class FoodWaveView extends GenericCDIView {
...
@@ -253,4 +228,13 @@ public class FoodWaveView extends GenericCDIView {
public
void
setBillLines
(
ListDataModel
<
BillLine
>
billLines
)
{
public
void
setBillLines
(
ListDataModel
<
BillLine
>
billLines
)
{
this
.
billLines
=
billLines
;
this
.
billLines
=
billLines
;
}
}
public
void
setFoodWaves
(
List
<
FoodWave
>
foodWaves
)
{
this
.
foodWaves
=
foodWaves
;
}
public
List
<
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