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 ce99b29c
authored
Jun 06, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
when returning from shop to incomingview, store user, so you can give card heti
1 parent
4c61cf39
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletions
code/MoyaWeb/src/fi/codecrew/moya/web/flow/FlowUserContainer.java
code/MoyaWeb/src/fi/codecrew/moya/web/flow/IncomingView.java
code/MoyaWeb/src/fi/codecrew/moya/web/flow/flowShopView.java
code/MoyaWeb/src/fi/codecrew/moya/web/flow/FlowUserContainer.java
0 → 100644
View file @
ce99b29
package
fi
.
codecrew
.
moya
.
web
.
flow
;
import
javax.enterprise.context.SessionScoped
;
import
javax.inject.Named
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
/**
* Place to store userid between pageloads
* @author tuukka
*
*/
@Named
@SessionScoped
public
class
FlowUserContainer
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
802344850073689859L
;
private
Integer
userId
;
/**
* Get current userid, remember to clear this, so there is no weird bugs
* @return
*/
public
Integer
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Integer
userId
)
{
this
.
userId
=
userId
;
}
}
code/MoyaWeb/src/fi/codecrew/moya/web/flow/IncomingView.java
View file @
ce99b29
...
@@ -56,6 +56,10 @@ public class IncomingView extends GenericCDIView {
...
@@ -56,6 +56,10 @@ public class IncomingView extends GenericCDIView {
@Inject
@Inject
private
ReaderNameContainer
namecontainer
;
private
ReaderNameContainer
namecontainer
;
@Inject
private
FlowUserContainer
flowUserContainer
;
@EJB
@EJB
private
BarcodeBeanLocal
barcodeBean
;
private
BarcodeBeanLocal
barcodeBean
;
...
@@ -127,6 +131,14 @@ public class IncomingView extends GenericCDIView {
...
@@ -127,6 +131,14 @@ public class IncomingView extends GenericCDIView {
if
(!
initialized
)
{
if
(!
initialized
)
{
logger
.
debug
(
"INITIALIZING!!!!"
);
logger
.
debug
(
"INITIALIZING!!!!"
);
if
(
flowUserContainer
.
getUserId
()
!=
null
&&
flowUserContainer
.
getUserId
()
>
0
)
{
userview
.
setUserid
(
flowUserContainer
.
getUserId
());
}
flowUserContainer
.
setUserId
(
null
);
// initializePoller();
// initializePoller();
initialized
=
true
;
initialized
=
true
;
super
.
beginConversation
();
super
.
beginConversation
();
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/flow/flowShopView.java
View file @
ce99b29
...
@@ -45,6 +45,9 @@ public class flowShopView extends GenericCDIView {
...
@@ -45,6 +45,9 @@ public class flowShopView extends GenericCDIView {
@Inject
@Inject
private
ReaderView
readerView
;
private
ReaderView
readerView
;
@Inject
private
FlowUserContainer
flowUserContainer
;
public
void
initView
()
{
public
void
initView
()
{
if
(
userId
==
null
||
userId
==
0
)
{
if
(
userId
==
null
||
userId
==
0
)
{
...
@@ -68,8 +71,10 @@ public class flowShopView extends GenericCDIView {
...
@@ -68,8 +71,10 @@ public class flowShopView extends GenericCDIView {
public
void
changeUser
(
SelectEvent
event
)
{
public
void
changeUser
(
SelectEvent
event
)
{
if
(
infoView
.
getMultiSearchUser
()
!=
null
)
{
if
(
infoView
.
getMultiSearchUser
()
!=
null
)
{
flowUserContainer
.
setUserId
(
infoView
.
getMultiSearchUser
().
getUser
().
getId
());
super
.
navihandler
.
redirectNavigation
(
"shop.jsf?userid="
+
infoView
.
getMultiSearchUser
().
getUser
().
getId
());
super
.
navihandler
.
redirectNavigation
(
"shop.jsf?userid="
+
infoView
.
getMultiSearchUser
().
getUser
().
getId
());
infoView
.
setMultiSearchUser
(
null
);
}
}
}
}
...
@@ -89,6 +94,7 @@ public class flowShopView extends GenericCDIView {
...
@@ -89,6 +94,7 @@ public class flowShopView extends GenericCDIView {
if
(!
user
.
equals
(
userView
.
getUser
()))
{
if
(!
user
.
equals
(
userView
.
getUser
()))
{
logger
.
info
(
"found user {}, redirecting"
,
user
.
getNick
());
logger
.
info
(
"found user {}, redirecting"
,
user
.
getNick
());
userView
.
setUser
(
user
);
userView
.
setUser
(
user
);
flowUserContainer
.
setUserId
(
user
.
getUser
().
getId
());
super
.
navihandler
.
redirectNavigation
(
"shop.jsf?userid="
+
user
.
getUser
().
getId
());
super
.
navihandler
.
redirectNavigation
(
"shop.jsf?userid="
+
user
.
getUser
().
getId
());
}
}
...
...
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