Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
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 6228cb68
authored
Oct 26, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of codecrew.fi:bortal
2 parents
8ee9667b
6f12b1bb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
5 deletions
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWaveTemplate.java
code/LanBortalWeb/WebContent/actionlog/messagelist.xhtml
code/LanBortalWeb/WebContent/foodmanager/listOrders.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/helpers/FoodwaveProductSummary.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWave.java
View file @
6228cb6
...
...
@@ -4,10 +4,9 @@
*/
package
fi
.
insomnia
.
bortal
.
model
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.ArrayList
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
...
...
@@ -54,7 +53,7 @@ public class FoodWave extends GenericEntity {
@OneToMany
(
mappedBy
=
"foodwave"
)
private
List
<
BillLine
>
billLines
;
@OneToMany
(
mappedBy
=
"foodwave"
)
private
List
<
BillLine
>
unpaidBills
;
...
...
@@ -152,9 +151,26 @@ public class FoodWave extends GenericEntity {
return
true
;
}
public
List
<
Product
>
getOrderedProducts
()
{
List
<
Product
>
retlist
=
new
ArrayList
<
Product
>();
if
(
getAccountEvents
()
!=
null
)
{
for
(
AccountEvent
ae
:
getAccountEvents
())
{
if
(!
retlist
.
contains
(
ae
.
getProduct
()))
{
retlist
.
add
(
ae
.
getProduct
());
}
}
}
return
retlist
;
}
public
List
<
BillLine
>
getBillLines
()
{
return
billLines
;
}
public
Integer
getMaximumFoods
()
{
return
maximumFoods
;
}
...
...
@@ -176,6 +192,7 @@ public class FoodWave extends GenericEntity {
return
retval
;
}
public
void
setMaximumFoods
(
Integer
maximumFoods
)
{
this
.
maximumFoods
=
maximumFoods
;
}
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWaveTemplate.java
View file @
6228cb6
...
...
@@ -83,6 +83,7 @@ public class FoodWaveTemplate extends GenericEntity {
public
List
<
Product
>
getProducts
()
{
return
products
;
}
/**
* @param products
...
...
code/LanBortalWeb/WebContent/actionlog/messagelist.xhtml
View file @
6228cb6
...
...
@@ -46,7 +46,7 @@
<div
id=
"actionlog"
>
<h:form
id=
"refresh"
>
<p:poll
interval=
"1"
update=
"actionlogtable"
/>
<p:dataTable
styleClass=
"bordertable"
id=
"actionlogtable"
value=
"#{actionLogMessageView.messages}"
var=
"message"
paginator=
"true"
rows=
"10"
paginatorTemplate=
"{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}
"
>
<p:dataTable
2styleClass
="
bordertable
"
id=
"actionlogtable"
value=
"#{actionLogMessageView.messages}"
var=
"message"
paginator=
"true"
rows=
"30"
paginatorTemplate=
"{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate=
"10,20,30,50,100
"
>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['actionlog.time']}"
/>
...
...
code/LanBortalWeb/WebContent/foodmanager/listOrders.xhtml
View file @
6228cb6
...
...
@@ -137,6 +137,14 @@
</p:dataTable>
</h:form>
<br
/>
<br
/>
<br
/>
<br
/>
<foodwave:summary
foodwaveProductSummaries=
"#{foodWaveView.productSummaries}"
foodwave=
"#{foodWaveView.selectedFoodWave}"
/>
</ui:define>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/FoodWaveView.java
View file @
6228cb6
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
shop
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.TreeSet
;
...
...
@@ -12,6 +14,8 @@ import javax.faces.model.ListDataModel;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
com.sun.xml.rpc.processor.schema.UnimplementedFeatureException
;
import
fi.insomnia.bortal.beans.AccountEventBeanLocal
;
import
fi.insomnia.bortal.beans.BillBeanLocal
;
import
fi.insomnia.bortal.beans.EventBeanLocal
;
...
...
@@ -27,6 +31,7 @@ import fi.insomnia.bortal.model.FoodWaveTemplate;
import
fi.insomnia.bortal.model.Product
;
import
fi.insomnia.bortal.model.ProductFlag
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
import
fi.insomnia.bortal.web.helpers.FoodwaveProductSummary
;
@Named
@ConversationScoped
...
...
@@ -137,6 +142,23 @@ public class FoodWaveView extends GenericCDIView {
super
.
beginConversation
();
}
}
public
List
<
FoodwaveProductSummary
>
getProductSummaries
()
{
System
.
out
.
println
(
"..asdfasdf"
);
HashMap
<
Product
,
FoodwaveProductSummary
>
pmap
=
new
HashMap
<
Product
,
FoodwaveProductSummary
>();
for
(
AccountEvent
ae
:
getSelectedFoodWave
().
getAccountEvents
())
{
if
(!
pmap
.
containsKey
(
ae
.
getProduct
()))
{
pmap
.
put
(
ae
.
getProduct
(),
new
FoodwaveProductSummary
(
ae
.
getProduct
(),
new
BigDecimal
(
0
),
new
BigDecimal
(
0
)));
}
System
.
out
.
println
(
".."
);
pmap
.
get
(
ae
.
getProduct
()).
add
(
ae
);
}
System
.
out
.
println
(
"::"
+
pmap
.
values
().
size
());
return
new
ArrayList
<
FoodwaveProductSummary
>(
pmap
.
values
());
}
private
void
createNewProductSkeleton
()
{
TreeSet
<
ProductFlag
>
ts
=
new
TreeSet
<
ProductFlag
>();
...
...
@@ -199,7 +221,7 @@ public class FoodWaveView extends GenericCDIView {
public
void
initFoodWaveOrderList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_FOODWAVES
)
&&
selectedFoodWave
==
null
)
{
System
.
out
.
println
(
"Testiä"
);
selectedFoodWave
=
foodWaveBean
.
findFoodwave
(
foodWaveId
);
this
.
setAccountEventLines
(
new
ListDataModel
<
AccountEvent
>(
selectedFoodWave
.
getAccountEvents
()));
...
...
@@ -242,6 +264,7 @@ public class FoodWaveView extends GenericCDIView {
}
public
FoodWave
getSelectedFoodWave
()
{
System
.
out
.
println
(
"APOFKASFASFASFASFASFASFASFASFASFKJIOJIO"
);
return
selectedFoodWave
;
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/helpers/FoodwaveProductSummary.java
0 → 100644
View file @
6228cb6
package
fi
.
insomnia
.
bortal
.
web
.
helpers
;
import
java.math.BigDecimal
;
import
fi.insomnia.bortal.model.AccountEvent
;
import
fi.insomnia.bortal.model.Product
;
public
class
FoodwaveProductSummary
{
private
Product
product
;
private
BigDecimal
count
;
private
BigDecimal
summaryPrice
;
public
FoodwaveProductSummary
(
Product
product
,
BigDecimal
count
,
BigDecimal
summaryPrice
)
{
setProduct
(
product
);
setCount
(
count
);
setSummaryPrice
(
summaryPrice
);
}
public
Product
getProduct
()
{
return
product
;
}
public
void
setProduct
(
Product
product
)
{
this
.
product
=
product
;
}
public
BigDecimal
getCount
()
{
return
count
;
}
public
void
setCount
(
BigDecimal
count
)
{
this
.
count
=
count
;
}
public
BigDecimal
getSummaryPrice
()
{
return
summaryPrice
;
}
public
void
setSummaryPrice
(
BigDecimal
summaryPrice
)
{
this
.
summaryPrice
=
summaryPrice
;
}
public
void
add
(
AccountEvent
ae
)
{
setCount
(
getCount
().
add
(
ae
.
getQuantity
()));
setSummaryPrice
(
getSummaryPrice
().
add
((
ae
.
getTotal
().
negate
())));
}
}
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