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 8e6e91fd
authored
May 12, 2012
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RFID-shop-juttuja
1 parent
d9a31b19
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
142 additions
and
51 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ReaderBean.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ReaderBeanLocal.java
code/LanBortalWeb/WebContent/index.xhtml
code/LanBortalWeb/WebContent/resources/cditools/shop/readerevents.xhtml
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/tyyli.css
code/LanBortalWeb/WebContent/shop/assocToUser.xhtml
code/LanBortalWeb/WebContent/shop/createBill.xhtml
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/content/PageOutputView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ReaderView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/ReaderBean.java
View file @
8e6e91f
...
...
@@ -30,6 +30,8 @@ public class ReaderBean implements ReaderBeanLocal {
private
CardTemplateBeanLocal
cardtemplatebean
;
@EJB
private
ReaderEventFacade
readerEventFacade
;
@EJB
private
EventBeanLocal
eventbean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ReaderBean
.
class
);
...
...
@@ -168,4 +170,13 @@ public class ReaderBean implements ReaderBeanLocal {
return
readerEventFacade
.
findLastEvents
(
reader
,
20
);
}
@Override
public
ReaderEvent
getEvent
(
Integer
eventid
)
{
ReaderEvent
ret
=
readerEventFacade
.
find
(
eventid
);
if
(!
ret
.
getReader
().
getEvent
().
equals
(
eventbean
.
getCurrentEvent
()))
{
ret
=
null
;
}
return
ret
;
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/ReaderBeanLocal.java
View file @
8e6e91f
...
...
@@ -23,4 +23,6 @@ public interface ReaderBeanLocal {
List
<
ReaderEvent
>
getReaderEvents
(
Integer
readerId
);
ReaderEvent
getEvent
(
Integer
eventid
);
}
code/LanBortalWeb/WebContent/index.xhtml
View file @
8e6e91f
...
...
@@ -5,13 +5,17 @@
</h:head>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{pageOutputView.initView('index')}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<h:outputLabel
rendered=
"#{sessionHandler.isInDevelopmentMode()}"
>
Development-tilassa.
Vaihda web.xml-tiedostosta ohjelman tila (javax.faces.PROJECT_STAGE) Productioniksi ennen kuin julkaiset ohjelman tuotantoon.
</h:outputLabel>
<ui:repeat
var=
"cont1"
value=
"#{pageOutputView.contents}"
>
<h:outputText
value=
"#{cont1.content}"
escape=
"false"
/>
</ui:repeat>
</ui:define>
</ui:composition>
</h:body>
...
...
code/LanBortalWeb/WebContent/resources/cditools/shop/readerevents.xhtml
View file @
8e6e91f
...
...
@@ -40,8 +40,13 @@
<h:outputText
value=
"#{event.gamePoint}"
/>
</h:column>
<h:column>
<h:commandButton
rendered=
"#{empty event.printedCard}"
action=
"#{readerView.selectEvent()}"
value=
"#{i18n['readerevent.associateToUser']}"
/>
<h:commandButton
rendered=
"#{!empty event.printedCard}"
action=
"#{readerView.selectEvent()}"
value=
"#{i18n['readerevent.shopToUser']}"
/>
<h:link
rendered=
"#{!empty event.printedCard}"
outcome=
"/shop/shopToUser"
value=
"#{i18n['readerevent.shopToUser']}"
>
<f:param
name=
"userid"
value=
"#{event.printedCard.user.id}"
/>
</h:link>
<h:link
rendered=
"#{empty event.printedCard}"
outcome=
"/shop/assocToUser"
value=
"#{i18n['readerevent.associateToUser']}"
>
<f:param
name=
"eventid"
value=
"#{event.id}"
/>
</h:link>
</h:column>
</h:dataTable>
...
...
code/LanBortalWeb/WebContent/resources/style/insomnia2/css/tyyli.css
View file @
8e6e91f
...
...
@@ -22,7 +22,6 @@ body,html {
#logo
h1
{
margin
:
5px
;
color
:
white
:
}
#logo
a
{
...
...
@@ -196,4 +195,8 @@ a:hover {
margin
:
0
7px
;
color
:
#fff
;
float
:
left
;
}
td
ul
{
margin
:
0
;
}
\ No newline at end of file
code/LanBortalWeb/WebContent/shop/assocToUser.xhtml
View file @
8e6e91f
...
...
@@ -6,19 +6,19 @@
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"
userid"
value=
"#{userView.user
id}"
/>
<f:event
type=
"preRenderView"
listener=
"#{
productShopView.init
View}"
/>
<f:viewParam
name=
"
eventid"
value=
"#{readerView.event
id}"
/>
<f:event
type=
"preRenderView"
listener=
"#{
readerView.initUserassoc
View}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<h:outputText
rendered=
"#{
!empty readerView.rfidevent
.event}"
value=
"#{i18n['rfidevent.empty']}"
/>
<h:panelGrid
columns=
"2"
rendered=
"#{
empty readerView.rfidevent
.event}"
>
<h:outputText
rendered=
"#{
empty readerView
.event}"
value=
"#{i18n['rfidevent.empty']}"
/>
<h:panelGrid
columns=
"2"
rendered=
"#{
!empty readerView
.event}"
>
<h:outputLabel
value=
"#{i18n['rfidevent.reader']}:"
/>
<h:outputText
value=
"#{readerView.
rfidevent.reader
}"
/>
<h:outputText
value=
"#{readerView.
event.reader.description
}"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.tag']}:"
/>
<h:outputText
value=
"#{readerView.
rfidevent.tag
}"
/>
<h:outputText
value=
"#{readerView.
event.value
}"
/>
<h:outputLabel
value=
"#{i18n['rfidevent.insertplacecode']}"
/>
...
...
code/LanBortalWeb/WebContent/shop/createBill.xhtml
View file @
8e6e91f
...
...
@@ -11,7 +11,7 @@
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.initView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.init
Bill
View}"
/>
</f:metadata>
<ui:define
name=
"title"
>
<h1>
#{i18n['page.product.createBill.header']}
</h1>
...
...
code/LanBortalWeb/WebContent/shop/shopToUser.xhtml
View file @
8e6e91f
<!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:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
<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:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.initView}"
/>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{userView.initView}"
/>
<f:event
type=
"preRenderView"
listener=
"#{productShopView.initShopView}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<h:panelGrid
columns=
"2"
>
<h:outputLabel
value=
"#{i18n['shop.user']}"
/>
<h:outputText
value=
"#{productShopView.user.wholeName} #{productShopView.user.nick}"
/>
...
...
@@ -28,9 +28,7 @@
<h:outputText
value=
"#{i18n['product.shopInstant']}"
/>
<h:selectBooleanCheckbox
value=
"#{productShopView.payInstant}"
/>
<products:shop
commitaction=
"#{productShopView.commitShoppingCart()}"
items=
"#{productShopView.shoppingcart}"
commitValue=
"#{i18n['productshop.commit']}"
/>
<products:shop
commitaction=
"#{productShopView.commitShoppingCart()}"
items=
"#{productShopView.shoppingcart}"
commitValue=
"#{i18n['productshop.commit']}"
/>
</h:form>
</ui:define>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/content/PageOutputView.java
View file @
8e6e91f
...
...
@@ -30,6 +30,12 @@ public class PageOutputView extends GenericCDIView {
initView
();
}
public
void
initView
(
String
name
)
{
this
.
name
=
name
;
initView
();
}
public
void
initView
()
{
if
(
name
==
null
||
name
.
isEmpty
())
{
setContents
(
pagebean
.
findContentsForUser
(
id
));
...
...
@@ -47,14 +53,6 @@ public class PageOutputView extends GenericCDIView {
return
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ProductShopView.java
View file @
8e6e91f
...
...
@@ -50,20 +50,24 @@ public class ProductShopView extends GenericCDIView {
@Inject
private
BillListView
billListView
;
public
void
initView
()
{
boolean
ok
=
true
;
if
(!
permbean
.
isCurrentUser
(
user
))
{
ok
=
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
);
public
void
initBillView
()
{
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
))
{
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
listUserShoppableProducts
()));
logger
.
debug
(
"Initialized billing shoppingcart to {}"
,
shoppingcart
);
this
.
beginConversation
();
}
if
(
ok
&&
shoppingcart
==
null
)
{
if
(
permbean
.
hasPermission
(
ShopPermission
.
LIST_ALL_PRODUCTS
))
{
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
getProducts
()));
}
else
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
))
{
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
listUserShoppableProducts
()));
}
logger
.
info
(
"Initialized shoppingcart to {}"
,
shoppingcart
);
}
public
void
initShopView
()
{
if
(
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
))
{
shoppingcart
=
new
ListDataModel
<
ProductShopItem
>(
ProductShopItem
.
productList
(
productBean
.
listUserShoppableProducts
()));
logger
.
debug
(
"Initialized shoppingcart to {}"
,
shoppingcart
);
this
.
beginConversation
();
}
}
public
String
add
(
Integer
count
)
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/ReaderView.java
View file @
8e6e91f
...
...
@@ -4,13 +4,16 @@ import java.util.List;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
fi.insomnia.bortal.beans.ReaderBeanLocal
;
import
fi.insomnia.bortal.beans.UserBeanLocal
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.
model.Reader
;
import
fi.insomnia.bortal.
enums.apps.UserPermission
;
import
fi.insomnia.bortal.model.ReaderEvent
;
import
fi.insomnia.bortal.model.User
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
...
...
@@ -19,29 +22,51 @@ public class ReaderView extends GenericCDIView {
private
static
final
long
serialVersionUID
=
802344850073689859L
;
private
Integer
eventid
;
private
String
placecode
;
private
String
usersearch
;
private
ListDataModel
<
User
>
userlist
;
@Inject
private
ReaderNameContainer
namecontainer
;
@EJB
private
ReaderBeanLocal
readerbean
;
private
List
<
Reader
>
readers
;
private
ReaderEvent
event
;
public
void
initReaderList
()
{
super
.
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
);
@EJB
private
UserBeanLocal
userbean
;
public
void
initUserassocView
()
{
if
(
super
.
requirePermissions
(
UserPermission
.
CREATE_NEW
))
{
event
=
readerbean
.
getEvent
(
eventid
);
super
.
beginConversation
();
}
}
public
List
<
ReaderEvent
>
getReaderEvents
()
public
String
searchforuser
()
{
return
readerbean
.
getReaderEvents
(
namecontainer
.
getReaderId
());
if
(
usersearch
==
null
||
usersearch
.
length
()
<
2
)
{
super
.
addFaceMessage
(
"user.tooShortSearch"
);
}
else
{
userlist
=
new
ListDataModel
<
User
>(
userbean
.
getUsers
(
0
,
0
,
null
,
usersearch
).
getResults
());
}
return
null
;
}
public
List
<
Reader
>
getReaders
()
{
if
(
readers
==
null
)
{
readers
=
readerbean
.
getReaders
();
public
void
initReaderList
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
SHOP_TO_OTHERS
))
{
}
return
readers
;
}
public
List
<
ReaderEvent
>
getReaderEvents
()
{
return
readerbean
.
getReaderEvents
(
namecontainer
.
getReaderId
());
}
public
ReaderNameContainer
getNamecontainer
()
{
...
...
@@ -52,4 +77,44 @@ public class ReaderView extends GenericCDIView {
this
.
namecontainer
=
namecontainer
;
}
public
Integer
getEventid
()
{
return
eventid
;
}
public
void
setEventid
(
Integer
eventid
)
{
this
.
eventid
=
eventid
;
}
public
ReaderEvent
getEvent
()
{
return
event
;
}
public
void
setEvent
(
ReaderEvent
event
)
{
this
.
event
=
event
;
}
public
String
getPlacecode
()
{
return
placecode
;
}
public
void
setPlacecode
(
String
placecode
)
{
this
.
placecode
=
placecode
;
}
public
String
getUsersearch
()
{
return
usersearch
;
}
public
void
setUsersearch
(
String
usersearch
)
{
this
.
usersearch
=
usersearch
;
}
public
ListDataModel
<
User
>
getUserlist
()
{
return
userlist
;
}
public
void
setUserlist
(
ListDataModel
<
User
>
userlist
)
{
this
.
userlist
=
userlist
;
}
}
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