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 92f1f4e6
authored
May 11, 2013
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed it
1 parent
6db7f37d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
18 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ReaderBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEventPropertyKey.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/reader/ReaderView.java
code/MoyaWeb/src/fi/codecrew/moya/web/flow/IncomingView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
View file @
92f1f4e
...
...
@@ -79,7 +79,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
// it's our special front barcode
try
{
if
(
barcode
.
startsWith
(
PRINTED_CARD_PREFIX
))
{
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
));
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()-
1
));
PrintedCard
card
=
printedCardFacade
.
find
(
id
);
if
(
card
!=
null
)
...
...
@@ -95,10 +95,12 @@ public class BarcodeBean implements BarcodeBeanLocal {
if
(
barcode
==
null
||
barcode
.
isEmpty
())
return
null
;
// it's our special front barcode
try
{
// it's our special front barcode
if
(
barcode
.
startsWith
(
EVENTUSER_PREFIX
))
{
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
));
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()-
1
));
logger
.
debug
(
"finding user with barcode {} and id {}"
,
barcode
,
id
);
EventUser
user
=
userBean
.
findByEventUserId
(
id
);
return
user
;
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ReaderBean.java
View file @
92f1f4e
...
...
@@ -21,6 +21,7 @@ import fi.codecrew.moya.model.EventUser;
import
fi.codecrew.moya.model.PrintedCard
;
import
fi.codecrew.moya.model.Reader
;
import
fi.codecrew.moya.model.ReaderEvent
;
import
fi.codecrew.moya.model.ReaderType
;
import
fi.codecrew.moya.model.User
;
/**
...
...
@@ -51,20 +52,27 @@ public class ReaderBean implements ReaderBeanLocal {
@Override
public
ReaderEvent
checkTag
(
String
readerIdent
,
String
tag
,
String
hash
)
{
Reader
reader
=
readerfacade
.
findOrCreateByIdent
(
readerIdent
);
tag
=
tag
.
replace
(
"\"\b"
,
""
);
if
(
Pattern
.
matches
(
"^.*000000$"
,
tag
))
{
tag
=
tag
.
replace
(
"000000"
,
""
);
}
StringBuilder
sb
=
new
StringBuilder
(
tag
);
while
(
sb
.
length
()
<
16
)
{
sb
.
insert
(
0
,
"0"
);
if
(
reader
.
getType
()
==
ReaderType
.
RFID
)
{
if
(
Pattern
.
matches
(
"^.*000000$"
,
tag
))
{
tag
=
tag
.
replace
(
"000000"
,
""
);
}
StringBuilder
sb
=
new
StringBuilder
(
tag
);
while
(
sb
.
length
()
<
16
)
{
sb
.
insert
(
0
,
"0"
);
}
tag
=
sb
.
toString
();
}
tag
=
sb
.
toString
();
PrintedCard
card
=
cardfacade
.
findByRfid
(
tag
);
Reader
reader
=
readerfacade
.
findOrCreateByIdent
(
readerIdent
);
logger
.
info
(
"reader {}, card {}"
,
reader
,
card
);
// RfidEvent revent = reventcontainer.foundTag(reader, tag);
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
View file @
92f1f4e
...
...
@@ -523,7 +523,14 @@ public class UserBean implements UserBeanLocal {
public
EventUser
getUserByBarcode
(
String
barcode
)
{
PrintedCard
tmpCard
=
barcodeBean
.
getPrintedCard
(
barcode
);
return
(
tmpCard
==
null
)
?
null
:
tmpCard
.
getUser
();
EventUser
user
=
null
;
if
(
tmpCard
==
null
)
{
user
=
barcodeBean
.
getUser
(
barcode
);
}
else
{
user
=
tmpCard
.
getUser
();
}
return
user
;
}
@Override
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEventPropertyKey.java
View file @
92f1f4e
...
...
@@ -9,7 +9,7 @@ public enum LanEventPropertyKey {
ADMIN_MAIL
(
Type
.
TEXT
,
"moya@codecrew.fi"
),
EVENT_LAYOUT
(
Type
.
TEXT
,
"template1"
),
SHOP_DEFAULT_CASH
(
Type
.
BOOL
,
null
),
PLACECODE_FROM_USER
(
Type
.
BOOL
,
null
),
PLACECODE_FROM_USER
(
Type
.
BOOL
,
"1"
),
PLACECODE_PRINT_ONLY_OWN
(
Type
.
BOOL
,
null
),
CHECK_BILL_STATS_PERMISSION
(
Type
.
BOOL
,
null
),
GATHER_OTHER_BILL_INFO
(
Type
.
BOOL
,
null
),
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/reader/ReaderView.java
View file @
92f1f4e
...
...
@@ -323,9 +323,7 @@ public class ReaderView extends GenericCDIView {
return
card
.
getUser
();
}
// todo: palauta tarvittaessa käyttäjä paikkaviivakoodista
// todo: siirrä käyttämään userbeanin getUserByBarcode-häsmäkkää
return
null
;
return
userbean
.
getUserByBarcode
(
getBarcode
());
}
public
void
clearBarcode
()
{
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/flow/IncomingView.java
View file @
92f1f4e
...
...
@@ -44,9 +44,12 @@ public class IncomingView extends GenericCDIView {
EventUser
user
=
readerView
.
getUser
();
if
(
user
==
null
)
{
logger
.
debug
(
"got no user from barcode"
);
return
null
;
}
logger
.
debug
(
"got user from barcode"
);
userview
.
setUser
(
user
);
userview
.
prepareCardDownload
();
return
"printCard"
;
...
...
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