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 9ce826bb
authored
Jan 28, 2015
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zero padding added
1 parent
6036986f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
code/moya-web/WebContent/vip/viplist.xhtml
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
View file @
9ce826b
...
@@ -101,7 +101,16 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -101,7 +101,16 @@ public class BarcodeBean implements BarcodeBeanLocal {
@Override
@Override
public
String
getUserLongTextCode
(
EventUser
user
)
{
public
String
getUserLongTextCode
(
EventUser
user
)
{
return
getUserTextCode
(
user
,
38
,
16
);
String
textcode
=
getUserTextCode
(
user
,
38
,
16
);
EventUser
user2
=
getUserFromLongTextCode
(
textcode
);
if
(!
user
.
equals
(
user2
))
throw
new
RuntimeException
(
"Koodigenerointivirhe"
);
// TODO: use seculogger or something
return
textcode
;
}
}
@Override
@Override
...
@@ -112,12 +121,19 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -112,12 +121,19 @@ public class BarcodeBean implements BarcodeBeanLocal {
textcode
=
textcode
.
substring
(
textcode
.
lastIndexOf
(
"="
)+
1
);
textcode
=
textcode
.
substring
(
textcode
.
lastIndexOf
(
"="
)+
1
);
}
}
return
getUserFromTextCode
(
textcode
,
38
,
16
);
return
getUserFromTextCode
(
textcode
,
38
,
16
);
}
}
@Override
@Override
public
String
getUserTextCode
(
EventUser
user
)
{
public
String
getUserTextCode
(
EventUser
user
)
{
return
getUserTextCode
(
user
,
12
,
5
);
String
textcode
=
getUserTextCode
(
user
,
12
,
5
);
EventUser
user2
=
getUserFromTextCode
(
textcode
);
if
(!
user
.
equals
(
user2
))
throw
new
RuntimeException
(
"Koodigenerointivirhe"
);
return
textcode
;
}
}
...
@@ -174,11 +190,15 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -174,11 +190,15 @@ public class BarcodeBean implements BarcodeBeanLocal {
BigInteger
numbercode
=
textcodeToNumber
(
textcode
,
bytecount
);
BigInteger
numbercode
=
textcodeToNumber
(
textcode
,
bytecount
);
String
barcode
=
numbercode
.
toString
();
String
barcode
=
numbercode
.
toString
();
// remove random prefix
int
barcodeLenght
=
12
;
int
barcodeLenght
=
12
;
if
(
lenght
<
barcodeLenght
)
if
(
lenght
<
barcodeLenght
)
barcodeLenght
=
lenght
;
barcodeLenght
=
lenght
;
while
(
barcode
.
length
()
<
lenght
)
{
barcode
=
"0"
+
barcode
;
}
// remove some random -stuff to start of string
// remove some random -stuff to start of string
for
(
int
i
=
lenght
-
barcodeLenght
;
i
>
0
;
--
i
)
{
for
(
int
i
=
lenght
-
barcodeLenght
;
i
>
0
;
--
i
)
{
...
...
code/moya-web/WebContent/vip/viplist.xhtml
View file @
9ce826b
<?xml version='1.0' encoding='UTF-8' ?>
gitla
<?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"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:p=
"http://primefaces.org/ui"
>
<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:ui=
"http://java.sun.com/jsf/facelets"
xmlns:p=
"http://primefaces.org/ui"
>
...
...
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