Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
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 d0d41fdf
authored
Oct 12, 2013
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Random changes
1 parent
05a25dbb
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
70 additions
and
84 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CardPrintBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/LicenseBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
code/MoyaWeb/WebContent/resources/templates/template1/template.xhtml
code/MoyaWeb/src/fi/codecrew/moya/rest/PrinterRestView.java
code/MoyaWeb/src/fi/codecrew/moya/servlet/PlaceMap.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/GenericCDIView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/MenuView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/PrimeMenuView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentParticipateView.java
code/MoyaWeb/src/fi/codecrew/moya/web/helper/LayoutView.java
code/MoyaWeb/src/fi/codecrew/moya/web/helpers/ProductShopItem.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BarcodeBean.java
View file @
d0d41fd
...
@@ -92,7 +92,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -92,7 +92,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
String
hexcode
=
Long
.
toHexString
(
Long
.
parseLong
(
barcode
));
String
hexcode
=
Long
.
toHexString
(
Long
.
parseLong
(
barcode
));
String
checksum
=
Integer
.
toHexString
(
hexcode
.
hashCode
());
String
checksum
=
Integer
.
toHexString
(
hexcode
.
hashCode
());
checksum
=
checksum
.
substring
(
checksum
.
length
()
-
3
);
checksum
=
checksum
.
substring
(
checksum
.
length
()
-
3
);
hexcode
+=
checksum
;
hexcode
+=
checksum
;
logger
.
debug
(
"Geneating hexcode for place {} : {}"
,
place
.
getId
(),
hexcode
);
logger
.
debug
(
"Geneating hexcode for place {} : {}"
,
place
.
getId
(),
hexcode
);
...
@@ -103,7 +103,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -103,7 +103,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
public
String
getVrAuthCodeForCard
(
PrintedCard
printedCard
)
{
public
String
getVrAuthCodeForCard
(
PrintedCard
printedCard
)
{
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
sb
.
append
(
PRINTED_CARD_PREFIX
);
sb
.
append
(
PRINTED_CARD_PREFIX
);
if
(
printedCard
==
null
)
if
(
printedCard
==
null
)
return
""
;
return
""
;
String
idStr
=
printedCard
.
getId
().
toString
();
String
idStr
=
printedCard
.
getId
().
toString
();
...
@@ -115,7 +115,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -115,7 +115,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
String
hexcode
=
Integer
.
toHexString
(
Integer
.
parseInt
(
code
));
String
hexcode
=
Integer
.
toHexString
(
Integer
.
parseInt
(
code
));
String
checksum
=
Integer
.
toHexString
(
hexcode
.
hashCode
());
String
checksum
=
Integer
.
toHexString
(
hexcode
.
hashCode
());
checksum
=
checksum
.
substring
(
checksum
.
length
()
-
3
);
checksum
=
checksum
.
substring
(
checksum
.
length
()
-
3
);
hexcode
+=
checksum
;
hexcode
+=
checksum
;
//hexcode = Integer.toString(hexcode.hashCode());
//hexcode = Integer.toString(hexcode.hashCode());
...
@@ -125,18 +125,18 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -125,18 +125,18 @@ public class BarcodeBean implements BarcodeBeanLocal {
}
}
public
String
checkVrAuthCode
(
String
code
)
{
public
String
checkVrAuthCode
(
String
code
)
{
String
checksumNew
=
code
.
substring
(
code
.
length
()
-
3
);
String
checksumNew
=
code
.
substring
(
code
.
length
()
-
3
);
code
=
code
.
substring
(
0
,
(
code
.
length
()
-
3
));
code
=
code
.
substring
(
0
,
(
code
.
length
()
-
3
));
String
checksumOld
=
Integer
.
toHexString
(
code
.
hashCode
());
String
checksumOld
=
Integer
.
toHexString
(
code
.
hashCode
());
checksumOld
=
checksumOld
.
substring
(
checksumOld
.
length
()
-
3
);
checksumOld
=
checksumOld
.
substring
(
checksumOld
.
length
()
-
3
);
if
(
checksumNew
==
checksumOld
)
{
if
(
checksumNew
.
equals
(
checksumOld
)
)
{
int
decimal
=
Integer
.
decode
(
code
);
int
decimal
=
Integer
.
decode
(
code
);
code
=
Integer
.
toString
(
decimal
);
code
=
Integer
.
toString
(
decimal
);
String
prefix
=
code
.
substring
(
0
,
2
);
String
prefix
=
code
.
substring
(
0
,
2
);
int
id
=
Integer
.
parseInt
(
code
.
substring
(
3
,
code
.
length
()
-
1
));
int
id
=
Integer
.
parseInt
(
code
.
substring
(
3
,
code
.
length
()
-
1
));
if
(
prefix
==
PRINTED_CARD_PREFIX
&&
id
!=
0
)
{
if
(
prefix
.
equals
(
PRINTED_CARD_PREFIX
)
&&
id
!=
0
)
{
PrintedCard
printedCard
=
printedCardFacade
.
find
(
id
);
PrintedCard
printedCard
=
printedCardFacade
.
find
(
id
);
if
(
printedCard
!=
null
)
if
(
printedCard
!=
null
)
return
printedCard
.
getUser
().
getNick
();
return
printedCard
.
getUser
().
getNick
();
else
else
return
"Invalid"
;
return
"Invalid"
;
...
@@ -150,11 +150,11 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -150,11 +150,11 @@ public class BarcodeBean implements BarcodeBeanLocal {
@Override
@Override
public
Place
getPlaceFromHexcode
(
String
hexcode
)
{
public
Place
getPlaceFromHexcode
(
String
hexcode
)
{
String
barcode
=
""
+
Integer
.
parseInt
(
hexcode
,
16
);
String
barcode
=
""
+
Integer
.
parseInt
(
hexcode
,
16
);
try
{
try
{
if
(
barcode
.
startsWith
(
PLACE_PREFIX
))
{
if
(
barcode
.
startsWith
(
PLACE_PREFIX
))
{
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()
-
1
));
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()
-
1
));
Place
place
=
placeFacade
.
find
(
id
);
Place
place
=
placeFacade
.
find
(
id
);
return
place
;
return
place
;
...
@@ -166,16 +166,16 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -166,16 +166,16 @@ public class BarcodeBean implements BarcodeBeanLocal {
}
}
public
PrintedCard
getPrintedCard
(
String
barcode
)
{
public
PrintedCard
getPrintedCard
(
String
barcode
)
{
if
(
barcode
==
null
||
barcode
.
isEmpty
())
if
(
barcode
==
null
||
barcode
.
isEmpty
())
return
null
;
return
null
;
// it's our special front barcode
// it's our special front barcode
try
{
try
{
if
(
barcode
.
startsWith
(
PRINTED_CARD_PREFIX
))
{
if
(
barcode
.
startsWith
(
PRINTED_CARD_PREFIX
))
{
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()
-
1
));
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()
-
1
));
PrintedCard
card
=
printedCardFacade
.
find
(
id
);
PrintedCard
card
=
printedCardFacade
.
find
(
id
);
if
(
card
!=
null
)
if
(
card
!=
null
)
return
card
;
return
card
;
}
}
}
catch
(
NumberFormatException
x
)
{
}
catch
(
NumberFormatException
x
)
{
...
@@ -185,24 +185,22 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -185,24 +185,22 @@ public class BarcodeBean implements BarcodeBeanLocal {
}
}
public
EventUser
getUser
(
String
barcode
)
{
public
EventUser
getUser
(
String
barcode
)
{
if
(
barcode
==
null
||
barcode
.
isEmpty
())
if
(
barcode
==
null
||
barcode
.
isEmpty
())
return
null
;
return
null
;
// trim zeros off from barcode
// trim zeros off from barcode
String
stripped
=
barcode
;
String
stripped
=
barcode
;
while
(
stripped
.
length
()
>
0
&&
stripped
.
charAt
(
0
)
==
'0'
)
{
while
(
stripped
.
length
()
>
0
&&
stripped
.
charAt
(
0
)
==
'0'
)
{
stripped
=
stripped
.
substring
(
1
);
stripped
=
stripped
.
substring
(
1
);
}
}
if
(
stripped
.
length
()
>
0
)
if
(
stripped
.
length
()
>
0
)
barcode
=
stripped
;
barcode
=
stripped
;
try
{
try
{
// it's our special front barcode
// it's our special front barcode
if
(
barcode
.
startsWith
(
EVENTUSER_PREFIX
))
{
if
(
barcode
.
startsWith
(
EVENTUSER_PREFIX
))
{
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()
-
1
));
int
id
=
Integer
.
parseInt
(
barcode
.
substring
(
3
,
barcode
.
length
()
-
1
));
logger
.
debug
(
"finding user with barcode {} and id {}"
,
barcode
,
id
);
logger
.
debug
(
"finding user with barcode {} and id {}"
,
barcode
,
id
);
EventUser
user
=
userBean
.
findByEventUserId
(
id
);
EventUser
user
=
userBean
.
findByEventUserId
(
id
);
...
@@ -214,5 +212,4 @@ public class BarcodeBean implements BarcodeBeanLocal {
...
@@ -214,5 +212,4 @@ public class BarcodeBean implements BarcodeBeanLocal {
return
null
;
return
null
;
}
}
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CardPrintBean.java
View file @
d0d41fd
...
@@ -291,18 +291,17 @@ public class CardPrintBean implements CardPrintBeanLocal {
...
@@ -291,18 +291,17 @@ public class CardPrintBean implements CardPrintBeanLocal {
g
.
setFont
(
new
Font
(
"Century gothic"
,
Font
.
PLAIN
,
30
));
g
.
setFont
(
new
Font
(
"Century gothic"
,
Font
.
PLAIN
,
30
));
g
.
setColor
(
Color
.
white
);
g
.
setColor
(
Color
.
white
);
if
(
printedCard
!=
null
)
g
.
drawString
(
barcodeBean
.
getVrAuthCodeForCard
(
printedCard
),
445
,
905
);
BufferedImage
barCodeBufferedImage
=
ImageIO
.
read
(
barcodeBean
.
getCardBarcode
(
printedCard
))
;
BufferedImage
barCodeBufferedImage
=
null
;
//int barcodeX = (base.getWidth()/2) - (image.getWidth()/2);
if
(
printedCard
!=
null
)
{
int
barcodeX
=
(
base
.
getWidth
()
-
400
)
/
2
;
int
barcodeX
=
(
base
.
getWidth
()
-
400
)
/
2
;
int
barcodeY
=
base
.
getHeight
()
-
50
;
int
barcodeY
=
base
.
getHeight
()
-
50
;
if
(
printedCard
!=
null
)
g
.
drawString
(
barcodeBean
.
getVrAuthCodeForCard
(
printedCard
),
445
,
905
);
barCodeBufferedImage
=
ImageIO
.
read
(
barcodeBean
.
getCardBarcode
(
printedCard
));
g
.
drawImage
(
barCodeBufferedImage
,
barcodeX
,
barcodeY
,
400
,
barCodeBufferedImage
.
getHeight
(),
null
);
g
.
drawImage
(
barCodeBufferedImage
,
barcodeX
,
barcodeY
,
400
,
barCodeBufferedImage
.
getHeight
(),
null
);
g
.
setColor
(
Color
.
white
);
g
.
setColor
(
Color
.
white
);
}
g
.
fillRect
(
0
,
base
.
getHeight
()
-
20
,
base
.
getWidth
(),
base
.
getHeight
());
g
.
fillRect
(
0
,
base
.
getHeight
()
-
20
,
base
.
getWidth
(),
base
.
getHeight
());
g
.
dispose
();
g
.
dispose
();
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/LicenseBean.java
View file @
d0d41fd
...
@@ -40,7 +40,6 @@ public class LicenseBean implements LicenseBeanLocal {
...
@@ -40,7 +40,6 @@ public class LicenseBean implements LicenseBeanLocal {
@EJB
@EJB
LicenseTargetFacade
licenseTargetFacade
;
LicenseTargetFacade
licenseTargetFacade
;
@EJB
@EJB
EventBeanLocal
eventBean
;
EventBeanLocal
eventBean
;
...
@@ -79,7 +78,7 @@ public class LicenseBean implements LicenseBeanLocal {
...
@@ -79,7 +78,7 @@ public class LicenseBean implements LicenseBeanLocal {
codeString
+=
tmpLine
;
codeString
+=
tmpLine
;
}
}
if
(
codeString
.
trim
().
equals
(
"0"
)
||
codeString
.
trim
().
equals
(
""
))
{
if
(
codeString
.
trim
().
equals
(
"0"
)
||
codeString
.
trim
().
equals
(
""
))
{
throw
new
GenerationException
(
"Code generate failed"
);
throw
new
GenerationException
(
"Code generate failed"
);
}
}
...
@@ -99,7 +98,6 @@ public class LicenseBean implements LicenseBeanLocal {
...
@@ -99,7 +98,6 @@ public class LicenseBean implements LicenseBeanLocal {
public
LicenseCode
accessCode
(
LicenseCode
code
)
throws
GenerationException
{
public
LicenseCode
accessCode
(
LicenseCode
code
)
throws
GenerationException
{
code
=
generateCode
(
code
);
code
=
generateCode
(
code
);
if
(!
code
.
isAccessed
())
{
if
(!
code
.
isAccessed
())
{
...
@@ -120,7 +118,7 @@ public class LicenseBean implements LicenseBeanLocal {
...
@@ -120,7 +118,7 @@ public class LicenseBean implements LicenseBeanLocal {
target
.
setEvent
(
eventBean
.
getCurrentEvent
());
target
.
setEvent
(
eventBean
.
getCurrentEvent
());
eventBean
.
getCurrentEvent
().
getGames
().
add
(
target
);
eventBean
.
getCurrentEvent
().
getGames
().
add
(
target
);
licenseTargetFacade
.
create
(
target
);
licenseTargetFacade
.
create
(
target
);
target
=
licenseTargetFacade
.
merge
(
target
);
//
target = licenseTargetFacade.merge(target);
}
}
else
{
else
{
target
=
licenseTargetFacade
.
merge
(
target
);
target
=
licenseTargetFacade
.
merge
(
target
);
...
@@ -139,14 +137,14 @@ public class LicenseBean implements LicenseBeanLocal {
...
@@ -139,14 +137,14 @@ public class LicenseBean implements LicenseBeanLocal {
ArrayList
<
LicenseTarget
>
returnLicenses
=
new
ArrayList
<
LicenseTarget
>();
ArrayList
<
LicenseTarget
>
returnLicenses
=
new
ArrayList
<
LicenseTarget
>();
if
(
user
.
getGroupMemberships
()
!=
null
)
{
if
(
user
.
getGroupMemberships
()
!=
null
)
{
for
(
GroupMembership
memberShip
:
user
.
getGroupMemberships
())
{
for
(
GroupMembership
memberShip
:
user
.
getGroupMemberships
())
{
if
(
memberShip
.
getPlaceReservation
()
==
null
)
if
(
memberShip
.
getPlaceReservation
()
==
null
)
continue
;
continue
;
for
(
LicenseTarget
license
:
memberShip
.
getPlaceReservation
().
getProduct
().
getLicenseTargets
())
{
for
(
LicenseTarget
license
:
memberShip
.
getPlaceReservation
().
getProduct
().
getLicenseTargets
())
{
if
(
license
.
isActive
())
{
if
(
license
.
isActive
())
{
returnLicenses
.
add
(
license
);
returnLicenses
.
add
(
license
);
}
}
}
}
...
@@ -161,8 +159,7 @@ public class LicenseBean implements LicenseBeanLocal {
...
@@ -161,8 +159,7 @@ public class LicenseBean implements LicenseBeanLocal {
List
<
LicenseTarget
>
returnLicenses
=
findUserGames
(
user
);
List
<
LicenseTarget
>
returnLicenses
=
findUserGames
(
user
);
for
(
LicenseCode
code
:
user
.
getUser
().
getLicenseCodes
())
{
for
(
LicenseCode
code
:
user
.
getUser
().
getLicenseCodes
())
{
returnLicenses
.
remove
(
code
.
getLicenseTarget
());
returnLicenses
.
remove
(
code
.
getLicenseTarget
());
}
}
...
@@ -183,21 +180,3 @@ public class LicenseBean implements LicenseBeanLocal {
...
@@ -183,21 +180,3 @@ public class LicenseBean implements LicenseBeanLocal {
}
}
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/UserBean.java
View file @
d0d41fd
...
@@ -189,7 +189,6 @@ public class UserBean implements UserBeanLocal {
...
@@ -189,7 +189,6 @@ public class UserBean implements UserBeanLocal {
if
(
member
!=
null
&&
member
.
getPlaceReservation
()
!=
null
)
if
(
member
!=
null
&&
member
.
getPlaceReservation
()
!=
null
)
{
{
addRecursive
(
checkedRoles
,
member
.
getPlaceReservation
().
getProvidesRole
());
addRecursive
(
checkedRoles
,
member
.
getPlaceReservation
().
getProvidesRole
());
}
if
(
member
.
getPlaceReservation
().
getProduct
()
!=
null
)
if
(
member
.
getPlaceReservation
().
getProduct
()
!=
null
)
{
{
addRecursive
(
checkedRoles
,
member
.
getPlaceReservation
().
getProduct
().
getProvides
());
addRecursive
(
checkedRoles
,
member
.
getPlaceReservation
().
getProduct
().
getProvides
());
...
@@ -197,6 +196,7 @@ public class UserBean implements UserBeanLocal {
...
@@ -197,6 +196,7 @@ public class UserBean implements UserBeanLocal {
}
}
}
}
}
}
}
// currentEventuser = u;
// currentEventuser = u;
// currentEventuserRoles = new ArrayList<Role>(checkedRoles);
// currentEventuserRoles = new ArrayList<Role>(checkedRoles);
// logger.debug("Returning parsed eventUser roles for user {}: {} ", u,
// logger.debug("Returning parsed eventUser roles for user {}: {} ", u,
...
...
code/MoyaWeb/WebContent/resources/templates/template1/template.xhtml
View file @
d0d41fd
...
@@ -58,7 +58,9 @@
...
@@ -58,7 +58,9 @@
</div>
</div>
<div
id=
"header_center"
class=
"flex1"
></div>
<div
id=
"header_center"
class=
"flex1"
></div>
<div
id=
"header_right"
>
<div
id=
"header_right"
>
<img
src=
"#{request.contextPath}/resources/templates/template1/img/moya_logo.png"
/>
<a
href=
"http://www.codecrew.fi"
><img
src=
"#{request.contextPath}/resources/templates/template1/img/moya_logo.png"
/>
</a>
</div>
</div>
</header>
</header>
...
...
code/MoyaWeb/src/fi/codecrew/moya/rest/PrinterRestView.java
View file @
d0d41fd
...
@@ -86,8 +86,10 @@ public class PrinterRestView {
...
@@ -86,8 +86,10 @@ public class PrinterRestView {
card
=
cardbean
.
findCard
(
cardId
);
card
=
cardbean
.
findCard
(
cardId
);
ret
=
Response
.
ok
(
printbean
.
constructPNG
(
card
),
"image/png"
);
ret
=
Response
.
ok
(
printbean
.
constructPNG
(
card
),
"image/png"
);
}
catch
(
Throwable
t
)
{
}
catch
(
Throwable
t
)
{
if
(
card
!=
null
)
{
card
.
setCardState
(
CardState
.
DATA_MISSING
);
card
.
setCardState
(
CardState
.
DATA_MISSING
);
cardbean
.
saveCard
(
card
);
cardbean
.
saveCard
(
card
);
}
logger
.
warn
(
"Error creating card for user cardId "
+
cardId
,
t
);
logger
.
warn
(
"Error creating card for user cardId "
+
cardId
,
t
);
ret
=
Response
.
status
(
Response
.
Status
.
NOT_ACCEPTABLE
);
ret
=
Response
.
status
(
Response
.
Status
.
NOT_ACCEPTABLE
);
...
...
code/MoyaWeb/src/fi/codecrew/moya/servlet/PlaceMap.java
View file @
d0d41fd
...
@@ -250,7 +250,7 @@ public class PlaceMap extends HttpServlet {
...
@@ -250,7 +250,7 @@ public class PlaceMap extends HttpServlet {
}
}
if
(
p
.
isReservedFor
(
user
))
{
if
(
p
.
isReservedFor
(
user
))
{
logger
.
info
(
"Setting place selected {}"
,
p
);
logger
.
debug
(
"Setting place selected {}"
,
p
);
color
=
SELECTED_COLOR
;
color
=
SELECTED_COLOR
;
}
else
if
(
user
.
equals
(
p
.
getCurrentUser
())
}
else
if
(
user
.
equals
(
p
.
getCurrentUser
())
||
(
p
.
getGroup
()
!=
null
&&
user
.
equals
(
p
.
getGroup
()
||
(
p
.
getGroup
()
!=
null
&&
user
.
equals
(
p
.
getGroup
()
...
@@ -258,11 +258,11 @@ public class PlaceMap extends HttpServlet {
...
@@ -258,11 +258,11 @@ public class PlaceMap extends HttpServlet {
||
(
p
.
getPlaceReserver
()
!=
null
&&
user
.
equals
(
p
||
(
p
.
getPlaceReserver
()
!=
null
&&
user
.
equals
(
p
.
getPlaceReserver
().
getUser
())))
{
.
getPlaceReserver
().
getUser
())))
{
color
=
OWNED_COLOR
;
color
=
OWNED_COLOR
;
logger
.
info
(
"Setting place owned {}"
,
p
);
logger
.
debug
(
"Setting place owned {}"
,
p
);
}
else
if
(
p
.
isTaken
())
{
}
else
if
(
p
.
isTaken
())
{
color
=
RESERVED_COLOR
;
color
=
RESERVED_COLOR
;
logger
.
info
(
"Setting place Reserved {}"
,
p
);
logger
.
debug
(
"Setting place Reserved {}"
,
p
);
}
else
if
(
p
.
getProduct
().
getColor
()
!=
null
&&
!
p
.
getProduct
().
getColor
().
isEmpty
())
{
}
else
if
(
p
.
getProduct
().
getColor
()
!=
null
&&
!
p
.
getProduct
().
getColor
().
isEmpty
())
{
...
@@ -278,7 +278,7 @@ public class PlaceMap extends HttpServlet {
...
@@ -278,7 +278,7 @@ public class PlaceMap extends HttpServlet {
.
getHeight
()));
.
getHeight
()));
if
(
color
!=
null
)
{
if
(
color
!=
null
)
{
logger
.
info
(
"Setting fill color: {} for p"
,
color
,
p
);
logger
.
debug
(
"Setting fill color: {} for p"
,
color
,
p
);
g
.
setColor
(
color
);
g
.
setColor
(
color
);
g
.
fill
(
new
Rectangle
(
p
.
getMapX
()
+
BORDER_WIDTH
,
p
.
getMapY
()
g
.
fill
(
new
Rectangle
(
p
.
getMapX
()
+
BORDER_WIDTH
,
p
.
getMapY
()
+
BORDER_WIDTH
,
p
.
getWidth
()
-
BORDER_WIDTH
,
p
.
getHeight
()
+
BORDER_WIDTH
,
p
.
getWidth
()
-
BORDER_WIDTH
,
p
.
getHeight
()
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/GenericCDIView.java
View file @
d0d41fd
...
@@ -42,7 +42,8 @@ public abstract class GenericCDIView implements Serializable {
...
@@ -42,7 +42,8 @@ public abstract class GenericCDIView implements Serializable {
}
}
public
void
endConversation
()
{
public
void
endConversation
()
{
if
(!
conversation
.
isTransient
())
conversation
.
end
();
if
(!
conversation
.
isTransient
())
conversation
.
end
();
}
}
public
boolean
hasPermission
(
IAppPermission
perm
)
{
public
boolean
hasPermission
(
IAppPermission
perm
)
{
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/MenuView.java
View file @
d0d41fd
...
@@ -17,19 +17,22 @@ import org.slf4j.Logger;
...
@@ -17,19 +17,22 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.MenuBeanLocal
;
import
fi.codecrew.moya.beans.MenuBeanLocal
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.beans.SitePageBeanLocal
;
import
fi.codecrew.moya.beans.SitePageBeanLocal
;
import
fi.codecrew.moya.handler.NavigationHandler
;
import
fi.codecrew.moya.model.MenuNavigation
;
import
fi.codecrew.moya.model.MenuNavigation
;
import
fi.codecrew.moya.model.PageContent
;
import
fi.codecrew.moya.model.PageContent
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.helper.LayoutView
;
import
fi.codecrew.moya.web.helper.LayoutView
;
@Named
@Named
@RequestScoped
@RequestScoped
public
class
MenuView
extends
GenericCDIView
{
public
class
MenuView
{
private
static
final
long
serialVersionUID
=
-
5720164797157054213L
;
private
static
final
long
serialVersionUID
=
-
5720164797157054213L
;
private
String
pagename
;
private
String
pagename
;
@Inject
protected
NavigationHandler
navihandler
;
@Inject
@Inject
private
transient
LayoutView
layoutview
;
private
transient
LayoutView
layoutview
;
...
@@ -40,7 +43,7 @@ public class MenuView extends GenericCDIView {
...
@@ -40,7 +43,7 @@ public class MenuView extends GenericCDIView {
@EJB
@EJB
private
transient
MenuBeanLocal
menubean
;
private
transient
MenuBeanLocal
menubean
;
private
LinkedList
<
List
<
JsfMenuitem
>>
menus
;
private
transient
LinkedList
<
List
<
JsfMenuitem
>>
menus
;
private
HashSet
<
MenuNavigation
>
navis
;
private
HashSet
<
MenuNavigation
>
navis
;
...
@@ -94,7 +97,10 @@ public class MenuView extends GenericCDIView {
...
@@ -94,7 +97,10 @@ public class MenuView extends GenericCDIView {
return
getViewChangeTopmenu
().
size
()
>
1
;
return
getViewChangeTopmenu
().
size
()
>
1
;
}
}
private
List
<
JsfMenuitem
>
viewchangeTopmenu
;
private
transient
List
<
JsfMenuitem
>
viewchangeTopmenu
;
@EJB
private
PermissionBeanLocal
permbean
;
public
List
<
JsfMenuitem
>
getViewChangeTopmenu
()
public
List
<
JsfMenuitem
>
getViewChangeTopmenu
()
{
{
...
@@ -151,7 +157,7 @@ public class MenuView extends GenericCDIView {
...
@@ -151,7 +157,7 @@ public class MenuView extends GenericCDIView {
// Iterate through children
// Iterate through children
for
(
MenuNavigation
child
:
children
)
{
for
(
MenuNavigation
child
:
children
)
{
// if is visible, permission is null or has permission, continue
// if is visible, permission is null or has permission, continue
if
(!
child
.
isVisible
()
||
(
child
.
getPermission
()
!=
null
&&
!
super
.
hasPermission
(
child
.
getPermission
())))
{
if
(!
child
.
isVisible
()
||
(
child
.
getPermission
()
!=
null
&&
!
permbean
.
hasPermission
(
child
.
getPermission
())))
{
continue
;
continue
;
}
}
...
@@ -194,7 +200,7 @@ public class MenuView extends GenericCDIView {
...
@@ -194,7 +200,7 @@ public class MenuView extends GenericCDIView {
// try to get the outcome from the first child we have permission to.
// try to get the outcome from the first child we have permission to.
for
(
MenuNavigation
child
:
navi
.
getChildren
())
for
(
MenuNavigation
child
:
navi
.
getChildren
())
{
{
if
(!
child
.
isVisible
()
||
(
child
.
getPermission
()
!=
null
&&
!
super
.
hasPermission
(
child
.
getPermission
())))
{
if
(!
child
.
isVisible
()
||
(
child
.
getPermission
()
!=
null
&&
!
permbean
.
hasPermission
(
child
.
getPermission
())))
{
continue
;
continue
;
}
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/PrimeMenuView.java
View file @
d0d41fd
...
@@ -17,7 +17,6 @@ import org.slf4j.Logger;
...
@@ -17,7 +17,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.MenuBeanLocal
;
import
fi.codecrew.moya.beans.MenuBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.MenuNavigation
;
import
fi.codecrew.moya.model.MenuNavigation
;
import
fi.codecrew.moya.utilities.I18n
;
import
fi.codecrew.moya.utilities.I18n
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
...
@@ -54,7 +53,7 @@ public class PrimeMenuView extends GenericCDIView {
...
@@ -54,7 +53,7 @@ public class PrimeMenuView extends GenericCDIView {
private
MenuModel
nameMenu
;
private
MenuModel
nameMenu
;
private
EventUser
user
;
//
private EventUser user;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PrimeMenuView
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PrimeMenuView
.
class
);
...
@@ -81,7 +80,6 @@ public class PrimeMenuView extends GenericCDIView {
...
@@ -81,7 +80,6 @@ public class PrimeMenuView extends GenericCDIView {
if
(
m
.
getItem
()
!=
null
&&
m
.
getChildren
().
isEmpty
())
{
if
(
m
.
getItem
()
!=
null
&&
m
.
getChildren
().
isEmpty
())
{
DefaultMenuItem
menuitem
=
mkMenuitem
(
m
);
DefaultMenuItem
menuitem
=
mkMenuitem
(
m
);
if
(
menuitem
!=
null
)
{
if
(
menuitem
!=
null
)
{
menuModel
.
addElement
(
menuitem
);
menuModel
.
addElement
(
menuitem
);
}
}
}
else
{
}
else
{
...
@@ -92,7 +90,10 @@ public class PrimeMenuView extends GenericCDIView {
...
@@ -92,7 +90,10 @@ public class PrimeMenuView extends GenericCDIView {
}
}
}
}
}
}
// logger.info("Initialized menumodel for user {} with {} entries" )
}
else
{
logger
.
info
(
"Not initializing menumodel with {} entries for user {}"
,
menuModel
.
getElements
().
size
());
}
}
return
menuModel
;
return
menuModel
;
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
View file @
d0d41fd
...
@@ -407,7 +407,7 @@ public class ProductShopView extends GenericCDIView {
...
@@ -407,7 +407,7 @@ public class ProductShopView extends GenericCDIView {
PrintedCard
card
=
readerView
.
getPrintedCard
();
PrintedCard
card
=
readerView
.
getPrintedCard
();
if
(
readerView
.
getBarcode
()
==
null
||
readerView
.
getBarcode
().
trim
()
==
""
)
{
if
(
readerView
.
getBarcode
()
==
null
||
readerView
.
getBarcode
().
trim
()
.
isEmpty
()
)
{
return
null
;
return
null
;
}
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentParticipateView.java
View file @
d0d41fd
...
@@ -51,7 +51,7 @@ public class TournamentParticipateView extends GenericCDIView {
...
@@ -51,7 +51,7 @@ public class TournamentParticipateView extends GenericCDIView {
public
void
removePlayerFromTeam
(
Integer
euid
)
{
public
void
removePlayerFromTeam
(
Integer
euid
)
{
TournamentTeamMember
ttcand
=
null
;
TournamentTeamMember
ttcand
=
null
;
for
(
TournamentTeamMember
ttm
:
tournamentParticipant
.
getTeamMembers
())
{
for
(
TournamentTeamMember
ttm
:
tournamentParticipant
.
getTeamMembers
())
{
if
(
ttm
.
getEventUser
().
getId
()
==
euid
)
{
if
(
ttm
.
getEventUser
().
getId
()
.
equals
(
euid
)
)
{
ttcand
=
ttm
;
ttcand
=
ttm
;
}
}
}
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/helper/LayoutView.java
View file @
d0d41fd
...
@@ -37,9 +37,9 @@ public class LayoutView {
...
@@ -37,9 +37,9 @@ public class LayoutView {
private
ResourceBundle
rb
;
private
ResourceBundle
rb
;
private
String
pagename
;
private
String
pagename
;
@EJB
@EJB
private
EventBeanLocal
eventbean
;
private
transient
EventBeanLocal
eventbean
;
@EJB
@EJB
private
PermissionBeanLocal
permbean
;
private
transient
PermissionBeanLocal
permbean
;
private
StreamedContent
headerimage
;
private
StreamedContent
headerimage
;
private
String
headertext
;
private
String
headertext
;
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/helpers/ProductShopItem.java
View file @
d0d41fd
...
@@ -138,20 +138,19 @@ public class ProductShopItem {
...
@@ -138,20 +138,19 @@ public class ProductShopItem {
return
limit
;
return
limit
;
}
}
public
boolean
updateLimit
(
BigDecimal
limit
)
{
public
boolean
updateLimit
(
BigDecimal
limit
Value
)
{
if
(
limit
!=
null
&&
limit
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
if
(
limitValue
!=
null
&&
limitValue
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
logger
.
info
(
"product limit {}, count {}"
,
limit
,
count
);
setCount
(
getCount
().
add
(
limit
));
if
(
count
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
{
logger
.
info
(
"product limit {}, count {}"
,
limitValue
,
count
);
setCount
(
getCount
().
add
(
limitValue
));
if
(
count
.
compareTo
(
BigDecimal
.
ZERO
)
<
0
)
{
setCount
(
BigDecimal
.
ZERO
);
setCount
(
BigDecimal
.
ZERO
);
}
}
limit
=
BigDecimal
.
ZERO
;
limit
=
BigDecimal
.
ZERO
;
return
true
;
return
true
;
}
}
setLimit
(
limit
)
;
limit
=
limitValue
;
return
false
;
return
false
;
}
}
}
}
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