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 6ff1da55
authored
May 10, 2013
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Game -> license and refactor
1 parent
875fb1f2
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
285 additions
and
402 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/GameBean.java → code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/LicenseBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PermissionBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ProductBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/GameCodeFacade.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/GameFacade.java → code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/LicenseCodeFacade.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/LicenseTargetFacade.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/GameBeanLocal.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/LicenseBeanLocal.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/ProductBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEvent.java
code/MoyaDatabase/src/fi/codecrew/moya/model/GameCode.java → code/MoyaDatabase/src/fi/codecrew/moya/model/LicenseCode.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Game.java → code/MoyaDatabase/src/fi/codecrew/moya/model/LicenseTarget.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Place.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Product.java
code/MoyaDatabase/src/fi/codecrew/moya/model/User.java
code/MoyaUtilities/src/fi/codecrew/moya/enums/BortalApplication.java
code/MoyaUtilities/src/fi/codecrew/moya/enums/apps/GamePermission.java → code/MoyaUtilities/src/fi/codecrew/moya/enums/apps/LicensePermission.java
code/MoyaWeb/WebContent/gamecode/manageCodes.xhtml
code/MoyaWeb/WebContent/gamecode/viewCodes.xhtml
code/MoyaWeb/WebContent/resources/cditools/role/edit.xhtml
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/game/GameCodeView.java → code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/license/LicenseView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/
Gam
eBean.java
→
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/
Licens
eBean.java
View file @
6ff1da5
...
...
@@ -12,12 +12,12 @@ import java.util.List;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
import
fi.codecrew.moya.facade.
Gam
eCodeFacade
;
import
fi.codecrew.moya.facade.
Game
Facade
;
import
fi.codecrew.moya.facade.
Licens
eCodeFacade
;
import
fi.codecrew.moya.facade.
LicenseTarget
Facade
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.
Game
;
import
fi.codecrew.moya.model.
Gam
eCode
;
import
fi.codecrew.moya.model.
LicenseTarget
;
import
fi.codecrew.moya.model.
Licens
eCode
;
import
fi.codecrew.moya.model.GroupMembership
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.Place
;
...
...
@@ -26,13 +26,13 @@ import fi.codecrew.moya.model.Place;
* Session Bean implementation class GameBean
*/
@Stateless
public
class
GameBean
implements
Gam
eBeanLocal
{
public
class
LicenseBean
implements
Licens
eBeanLocal
{
@EJB
Gam
eCodeFacade
gameCodeFacade
;
Licens
eCodeFacade
gameCodeFacade
;
@EJB
Game
Facade
gameFacade
;
LicenseTarget
Facade
gameFacade
;
@EJB
...
...
@@ -41,34 +41,11 @@ public class GameBean implements GameBeanLocal {
@EJB
PlaceBeanLocal
placeBean
;
public
GameCode
getCode
(
Place
place
)
{
List
<
GameCode
>
codes
=
place
.
getGameCodes
();
if
(
codes
.
size
()
>
0
)
{
return
codes
.
get
(
0
);
}
return
null
;
}
public
List
<
GameCode
>
findUserCodes
(
EventUser
user
)
{
ArrayList
<
GameCode
>
returnCodes
=
new
ArrayList
<
GameCode
>();
// first get free gamecodes from user places
if
(
user
.
getCurrentPlaces
()
!=
null
)
{
for
(
GroupMembership
memberShip
:
user
.
getGroupMemberships
())
{
if
(
memberShip
.
getPlaceReservation
()
==
null
)
continue
;
for
(
GameCode
placeGameCode
:
memberShip
.
getPlaceReservation
().
getGameCodes
())
{
if
(
placeGameCode
.
getUser
()
==
null
)
{
returnCodes
.
add
(
placeGameCode
);
}
}
}
}
public
List
<
LicenseCode
>
findUserCodes
(
EventUser
user
)
{
ArrayList
<
LicenseCode
>
returnCodes
=
new
ArrayList
<
LicenseCode
>();
for
(
Gam
eCode
userGameCode
:
user
.
getUser
().
getGameCodes
())
{
for
(
Licens
eCode
userGameCode
:
user
.
getUser
().
getGameCodes
())
{
returnCodes
.
add
(
userGameCode
);
}
...
...
@@ -80,7 +57,7 @@ public class GameBean implements GameBeanLocal {
*
* @param code
*/
private
boolean
generateCode
(
Gam
eCode
code
)
{
private
boolean
generateCode
(
Licens
eCode
code
)
{
if
(
code
.
getCode
()
==
null
||
code
.
getCode
().
trim
().
equals
(
""
))
{
if
(
code
.
getGame
().
getCodeUrl
()
==
null
||
code
.
getGame
().
getCodeUrl
().
trim
().
equals
(
""
))
...
...
@@ -122,7 +99,7 @@ public class GameBean implements GameBeanLocal {
return
false
;
}
public
boolean
accessCode
(
Gam
eCode
code
,
EventUser
user
)
{
public
boolean
accessCode
(
Licens
eCode
code
,
EventUser
user
)
{
if
(
code
.
getUser
()
!=
null
)
return
false
;
...
...
@@ -141,11 +118,11 @@ public class GameBean implements GameBeanLocal {
return
true
;
}
public
List
<
Game
>
findAll
(
LanEvent
event
)
{
public
List
<
LicenseTarget
>
findAll
(
LanEvent
event
)
{
return
event
.
getGames
();
}
public
void
saveOrCreate
Game
(
Game
game
)
{
public
void
saveOrCreate
License
(
LicenseTarget
game
)
{
if
(
game
.
getId
()
==
null
)
{
game
.
setEvent
(
eventBean
.
getCurrentEvent
());
eventBean
.
getCurrentEvent
().
getGames
().
add
(
game
);
...
...
@@ -160,27 +137,41 @@ public class GameBean implements GameBeanLocal {
/**
* Default constructor.
*/
public
Gam
eBean
()
{
public
Licens
eBean
()
{
// TODO Auto-generated constructor stub
}
@Override
public
void
generateCodesForAllPlaces
(
Game
game
)
{
if
(
game
==
null
)
return
;
public
List
<
LicenseTarget
>
findUserGames
(
EventUser
user
)
{
LanEvent
currentEvent
=
eventBean
.
getCurrentEvent
();
ArrayList
<
LicenseTarget
>
returnLicenses
=
new
ArrayList
<
LicenseTarget
>();
for
(
EventMap
map
:
currentEvent
.
getEventMaps
())
{
for
(
Place
place
:
map
.
getPlaces
())
{
GameCode
code
=
new
GameCode
(
place
,
game
);
gameCodeFacade
.
create
(
code
);
code
=
gameCodeFacade
.
merge
(
code
);
place
.
getGameCodes
().
add
(
code
);
if
(
user
.
getCurrentPlaces
()
!=
null
)
{
for
(
GroupMembership
memberShip
:
user
.
getGroupMemberships
())
{
if
(
memberShip
.
getPlaceReservation
()
==
null
)
continue
;
for
(
LicenseTarget
license
:
memberShip
.
getPlaceReservation
().
getProduct
().
getLicenseTargets
())
{
if
(
license
.
isActive
())
returnLicenses
.
add
(
license
);
}
}
}
return
returnLicenses
;
}
@Override
public
List
<
LicenseTarget
>
findUnopenedUserGames
(
EventUser
user
)
{
List
<
LicenseTarget
>
returnLicenses
=
findUserGames
(
user
);
for
(
LicenseCode
code
:
findUserCodes
(
user
))
{
returnLicenses
.
remove
(
code
);
}
return
returnLicenses
;
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
View file @
6ff1da5
...
...
@@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory;
import
fi.codecrew.moya.enums.apps.BillPermission
;
import
fi.codecrew.moya.enums.apps.CompoPermission
;
import
fi.codecrew.moya.enums.apps.ContentPermission
;
import
fi.codecrew.moya.enums.apps.
Gam
ePermission
;
import
fi.codecrew.moya.enums.apps.
Licens
ePermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.PollPermission
;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
...
...
@@ -295,8 +295,8 @@ public class MenuBean implements MenuBeanLocal {
foodwaveTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/foodwave/ThanksForOrderingFromCounter"
),
ShopPermission
.
SHOP_FOODWAVE
).
setVisible
(
false
);
MenuNavigation
gameTopmenu
=
usernavi
.
addPage
(
null
,
null
);
gameTopmenu
.
setKey
(
"topnavi.
gam
e"
);
gameTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/
gamecode/viewCodes"
),
Gam
ePermission
.
VIEW_OWN_CODES
);
gameTopmenu
.
setKey
(
"topnavi.
licens
e"
);
gameTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/
license/viewCodes"
),
Licens
ePermission
.
VIEW_OWN_CODES
);
MenuNavigation
pollTopmenu
=
usernavi
.
addPage
(
null
,
null
);
...
...
@@ -387,8 +387,8 @@ public class MenuBean implements MenuBeanLocal {
foodnavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/foodadmin/editTemplate"
),
ShopPermission
.
MANAGE_FOODWAVES
).
setVisible
(
false
);
MenuNavigation
gamenavi
=
adminnavi
.
addPage
(
null
,
null
);
gamenavi
.
setKey
(
"topnavi.
gam
e"
);
gamenavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/
gamecode/manageCodes"
),
Gam
ePermission
.
MANAGE
);
gamenavi
.
setKey
(
"topnavi.
licens
e"
);
gamenavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/
license/manageCodes"
),
Licens
ePermission
.
MANAGE
);
}
@Override
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PermissionBean.java
View file @
6ff1da5
...
...
@@ -17,7 +17,7 @@ import fi.codecrew.moya.enums.apps.BillPermission;
import
fi.codecrew.moya.enums.apps.CompoPermission
;
import
fi.codecrew.moya.enums.apps.ContentPermission
;
import
fi.codecrew.moya.enums.apps.EventPermission
;
import
fi.codecrew.moya.enums.apps.
Gam
ePermission
;
import
fi.codecrew.moya.enums.apps.
Licens
ePermission
;
import
fi.codecrew.moya.enums.apps.IAppPermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.PollPermission
;
...
...
@@ -93,8 +93,8 @@ import fi.codecrew.moya.model.User;
EventPermission
.
S_MANAGE_PRIVATE_PROPERTIES
,
EventPermission
.
S_MANAGE_PROPERTIES
,
Gam
ePermission
.
S_MANAGE
,
Gam
ePermission
.
S_VIEW_OWN_CODES
Licens
ePermission
.
S_MANAGE
,
Licens
ePermission
.
S_VIEW_OWN_CODES
})
@LocalBean
public
class
PermissionBean
implements
PermissionBeanLocal
{
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ProductBean.java
View file @
6ff1da5
...
...
@@ -2,6 +2,7 @@ package fi.codecrew.moya.beans;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.HashMap
;
import
java.util.HashSet
;
...
...
@@ -19,6 +20,8 @@ import javax.ejb.Stateless;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.bortal.views.BillSummary
;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
import
fi.codecrew.moya.facade.AccountEventFacade
;
import
fi.codecrew.moya.facade.BillLineFacade
;
import
fi.codecrew.moya.facade.DiscountFacade
;
...
...
@@ -26,13 +29,6 @@ import fi.codecrew.moya.facade.EventUserFacade;
import
fi.codecrew.moya.facade.InventoryEventFacade
;
import
fi.codecrew.moya.facade.ProductFacade
;
import
fi.codecrew.moya.facade.UserFacade
;
import
fi.codecrew.moya.beans.BillBeanLocal
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.beans.ProductBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.bortal.views.BillSummary
;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
import
fi.codecrew.moya.model.AccountEvent
;
import
fi.codecrew.moya.model.Discount
;
import
fi.codecrew.moya.model.EventUser
;
...
...
@@ -365,4 +361,18 @@ public class ProductBean implements ProductBeanLocal {
public
List
<
Product
>
findProductsForEvent
()
{
return
productFacade
.
findAll
();
}
@Override
public
List
<
Product
>
findPlaceProducts
()
{
ArrayList
<
Product
>
returnProducts
=
new
ArrayList
<
Product
>();
for
(
Product
product
:
findProductsForEvent
())
{
if
(
product
.
getPlaces
()
!=
null
&&
product
.
getPlaces
().
size
()
>
0
)
{
returnProducts
.
add
(
product
);
}
}
return
returnProducts
;
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/GameCodeFacade.java
deleted
100644 → 0
View file @
875fb1f
package
fi
.
codecrew
.
moya
.
facade
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
fi.codecrew.moya.model.GameCode
;
import
fi.codecrew.moya.model.GameCode_
;
import
fi.codecrew.moya.model.News
;
import
fi.codecrew.moya.model.Place
;
@Stateless
@LocalBean
public
class
GameCodeFacade
extends
IntegerPkGenericFacade
<
GameCode
>
{
public
GameCodeFacade
()
{
super
(
GameCode
.
class
);
}
public
GameCode
findByPlace
(
Place
place
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
GameCode
>
cq
=
cb
.
createQuery
(
GameCode
.
class
);
Root
<
GameCode
>
root
=
cq
.
from
(
GameCode
.
class
);
cq
.
where
(
cb
.
equal
(
root
.
get
(
GameCode_
.
place
),
place
));
return
getSingleNullableResult
(
getEm
().
createQuery
(
cq
));
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/
Gam
eFacade.java
→
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/
LicenseCod
eFacade.java
View file @
6ff1da5
...
...
@@ -3,15 +3,13 @@ package fi.codecrew.moya.facade;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.codecrew.moya.model.
Gam
e
;
import
fi.codecrew.moya.model.
LicenseCod
e
;
@Stateless
@LocalBean
public
class
GameFacade
extends
IntegerPkGenericFacade
<
Gam
e
>
{
public
class
LicenseCodeFacade
extends
IntegerPkGenericFacade
<
LicenseCod
e
>
{
public
GameFacade
()
{
super
(
Game
.
class
);
public
LicenseCodeFacade
()
{
super
(
LicenseCode
.
class
);
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/LicenseTargetFacade.java
0 → 100644
View file @
6ff1da5
package
fi
.
codecrew
.
moya
.
facade
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.codecrew.moya.model.LicenseTarget
;
@Stateless
@LocalBean
public
class
LicenseTargetFacade
extends
IntegerPkGenericFacade
<
LicenseTarget
>
{
public
LicenseTargetFacade
()
{
super
(
LicenseTarget
.
class
);
}
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/GameBeanLocal.java
deleted
100644 → 0
View file @
875fb1f
package
fi
.
codecrew
.
moya
.
beans
;
import
java.util.List
;
import
javax.ejb.Local
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.Game
;
import
fi.codecrew.moya.model.GameCode
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.Place
;
@Local
public
interface
GameBeanLocal
{
public
GameCode
getCode
(
Place
place
);
public
boolean
accessCode
(
GameCode
code
,
EventUser
user
);
public
List
<
Game
>
findAll
(
LanEvent
event
);
public
void
saveOrCreateGame
(
Game
game
);
public
List
<
GameCode
>
findUserCodes
(
EventUser
user
);
public
void
generateCodesForAllPlaces
(
Game
game
);
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/LicenseBeanLocal.java
0 → 100644
View file @
6ff1da5
package
fi
.
codecrew
.
moya
.
beans
;
import
java.util.List
;
import
javax.ejb.Local
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.LicenseTarget
;
import
fi.codecrew.moya.model.LicenseCode
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.Place
;
@Local
public
interface
LicenseBeanLocal
{
public
boolean
accessCode
(
LicenseCode
code
,
EventUser
user
);
public
List
<
LicenseTarget
>
findAll
(
LanEvent
event
);
public
void
saveOrCreateLicense
(
LicenseTarget
game
);
public
List
<
LicenseCode
>
findUserCodes
(
EventUser
user
);
public
List
<
LicenseTarget
>
findUserGames
(
EventUser
user
);
public
List
<
LicenseTarget
>
findUnopenedUserGames
(
EventUser
user
);
}
\ No newline at end of file
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/ProductBeanLocal.java
View file @
6ff1da5
...
...
@@ -55,5 +55,7 @@ public interface ProductBeanLocal {
void
saveInventoryEvent
(
InventoryEvent
ie
);
List
<
Product
>
findProductsForEvent
();
List
<
Product
>
findPlaceProducts
();
}
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEvent.java
View file @
6ff1da5
...
...
@@ -75,7 +75,7 @@ public class LanEvent extends GenericEntity {
private
List
<
Compo
>
compos
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"event"
)
private
List
<
Game
>
games
;
private
List
<
LicenseTarget
>
games
;
@OneToMany
(
mappedBy
=
"event"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
CardTemplate
>
cardTemplates
;
...
...
@@ -284,13 +284,13 @@ public class LanEvent extends GenericEntity {
this
.
properties
=
properties
;
}
public
List
<
Game
>
getGames
()
{
public
List
<
LicenseTarget
>
getGames
()
{
if
(
games
==
null
)
games
=
new
ArrayList
<
Game
>();
games
=
new
ArrayList
<
LicenseTarget
>();
return
games
;
}
public
void
setGames
(
List
<
Game
>
games
)
{
public
void
setGames
(
List
<
LicenseTarget
>
games
)
{
this
.
games
=
games
;
}
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/
Gam
eCode.java
→
code/MoyaDatabase/src/fi/codecrew/moya/model/
Licens
eCode.java
View file @
6ff1da5
...
...
@@ -21,28 +21,22 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*
*/
@Entity
@Table
(
name
=
"
gam
ecodes"
)
@Table
(
name
=
"
licens
ecodes"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
Gam
eCode
extends
GenericEntity
{
public
class
Licens
eCode
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@Column
(
name
=
"accessed"
,
nullable
=
true
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
accessed
=
null
;
@Column
(
name
=
"code"
)
private
String
code
;
@JoinColumn
(
name
=
"game_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
private
Game
game
;
private
LicenseTarget
game
;
@JoinColumn
(
name
=
"user_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
...
...
@@ -54,12 +48,12 @@ public class GameCode extends GenericEntity {
public
Gam
eCode
()
{
public
Licens
eCode
()
{
super
();
}
public
GameCode
(
Place
place
,
Game
game
)
{
public
LicenseCode
(
Place
place
,
LicenseTarget
game
)
{
this
();
this
.
place
=
place
;
this
.
game
=
game
;
...
...
@@ -94,13 +88,13 @@ public class GameCode extends GenericEntity {
public
Game
getGame
()
{
public
LicenseTarget
getGame
()
{
return
game
;
}
public
void
setGame
(
Game
game
)
{
public
void
setGame
(
LicenseTarget
game
)
{
this
.
game
=
game
;
}
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/
Game
.java
→
code/MoyaDatabase/src/fi/codecrew/moya/model/
LicenseTarget
.java
View file @
6ff1da5
...
...
@@ -4,6 +4,7 @@
*/
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.Column
;
...
...
@@ -14,6 +15,8 @@ import javax.persistence.ManyToOne;
import
javax.persistence.OneToMany
;
import
javax.persistence.OrderBy
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
...
...
@@ -22,14 +25,17 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*
*/
@Entity
@Table
(
name
=
"
game
s"
)
@Table
(
name
=
"
licenseTarget
s"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
Game
extends
GenericEntity
{
public
class
LicenseTarget
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@Column
(
name
=
"active"
)
private
boolean
active
=
false
;
@Column
(
name
=
"name"
)
private
String
name
;
...
...
@@ -41,7 +47,6 @@ public class Game extends GenericEntity {
@Column
(
name
=
"code_url"
)
private
String
codeUrl
;
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
...
...
@@ -49,15 +54,13 @@ public class Game extends GenericEntity {
@OneToMany
(
mappedBy
=
"game"
,
fetch
=
FetchType
.
LAZY
)
@OrderBy
()
private
List
<
GameCode
>
gameCodes
;
private
List
<
LicenseCode
>
licenseCodes
;
@JoinColumn
(
name
=
"product_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
private
Product
product
;
public
Game
()
{
public
LicenseTarget
()
{
super
();
}
...
...
@@ -132,16 +135,55 @@ public class Game extends GenericEntity {
public
List
<
Gam
eCode
>
getGameCodes
()
{
return
gam
eCodes
;
public
List
<
Licens
eCode
>
getGameCodes
()
{
return
licens
eCodes
;
}
public
void
setGameCodes
(
List
<
Gam
eCode
>
gameCodes
)
{
this
.
gam
eCodes
=
gameCodes
;
public
void
setGameCodes
(
List
<
Licens
eCode
>
gameCodes
)
{
this
.
licens
eCodes
=
gameCodes
;
}
public
Product
getProduct
()
{
return
product
;
}
public
void
setProduct
(
Product
product
)
{
this
.
product
=
product
;
}
public
boolean
isActive
()
{
return
active
;
}
public
boolean
getActive
()
{
return
active
;
}
public
void
setActive
(
boolean
active
)
{
this
.
active
=
active
;
}
public
List
<
LicenseCode
>
getLicenseCodes
()
{
return
licenseCodes
;
}
public
void
setLicenseCodes
(
List
<
LicenseCode
>
licenseCodes
)
{
this
.
licenseCodes
=
licenseCodes
;
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/Place.java
View file @
6ff1da5
...
...
@@ -91,11 +91,6 @@ public class Place extends GenericEntity {
@JoinColumn
(
name
=
"current_eventuser_id"
,
referencedColumnName
=
EventUser
.
ID_COLUMN
)
@ManyToOne
private
EventUser
currentUser
;
@OneToMany
(
mappedBy
=
"place"
,
fetch
=
FetchType
.
LAZY
)
@OrderBy
()
private
List
<
GameCode
>
gameCodes
;
public
Place
()
{
super
();
...
...
@@ -288,17 +283,4 @@ public class Place extends GenericEntity {
this
.
disabled
=
disabled
;
}
public
List
<
GameCode
>
getGameCodes
()
{
if
(
gameCodes
==
null
)
{
gameCodes
=
new
ArrayList
<
GameCode
>();
}
return
gameCodes
;
}
public
void
setGameCodes
(
List
<
GameCode
>
gameCodes
)
{
this
.
gameCodes
=
gameCodes
;
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/Product.java
View file @
6ff1da5
...
...
@@ -70,6 +70,11 @@ public class Product extends GenericEntity {
@Column
(
name
=
"barcode"
)
private
String
barcode
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"product"
)
private
List
<
LicenseTarget
>
licenseTargets
;
@Enumerated
(
EnumType
.
STRING
)
@PrivateOwned
@ElementCollection
()
...
...
@@ -332,4 +337,12 @@ public class Product extends GenericEntity {
this
.
inventoryEvents
=
inventoryEvents
;
}
public
List
<
LicenseTarget
>
getLicenseTargets
()
{
return
licenseTargets
;
}
public
void
setLicenseTargets
(
List
<
LicenseTarget
>
licenseTargets
)
{
this
.
licenseTargets
=
licenseTargets
;
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/User.java
View file @
6ff1da5
...
...
@@ -113,7 +113,7 @@ public class User extends GenericEntity implements IUser {
@OneToMany
(
mappedBy
=
"user"
,
fetch
=
FetchType
.
LAZY
)
@OrderBy
()
private
List
<
Gam
eCode
>
gameCodes
;
private
List
<
Licens
eCode
>
gameCodes
;
@Transient
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
User
.
class
);
...
...
@@ -361,14 +361,14 @@ public class User extends GenericEntity implements IUser {
}
public
List
<
Gam
eCode
>
getGameCodes
()
{
public
List
<
Licens
eCode
>
getGameCodes
()
{
if
(
gameCodes
==
null
)
gameCodes
=
new
ArrayList
<
Gam
eCode
>();
gameCodes
=
new
ArrayList
<
Licens
eCode
>();
return
gameCodes
;
}
public
void
setGameCodes
(
List
<
Gam
eCode
>
gameCodes
)
{
public
void
setGameCodes
(
List
<
Licens
eCode
>
gameCodes
)
{
this
.
gameCodes
=
gameCodes
;
}
...
...
code/MoyaUtilities/src/fi/codecrew/moya/enums/BortalApplication.java
View file @
6ff1da5
...
...
@@ -4,7 +4,7 @@ import fi.codecrew.moya.enums.apps.BillPermission;
import
fi.codecrew.moya.enums.apps.CompoPermission
;
import
fi.codecrew.moya.enums.apps.ContentPermission
;
import
fi.codecrew.moya.enums.apps.EventPermission
;
import
fi.codecrew.moya.enums.apps.
Gam
ePermission
;
import
fi.codecrew.moya.enums.apps.
Licens
ePermission
;
import
fi.codecrew.moya.enums.apps.IAppPermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.PollPermission
;
...
...
@@ -24,7 +24,7 @@ public enum BortalApplication {
SALESPOINT
(
SalespointPermission
.
class
),
COMPO
(
CompoPermission
.
class
),
EVENT
(
EventPermission
.
class
),
GAME
(
Gam
ePermission
.
class
),
LICENSE
(
Licens
ePermission
.
class
),
;
...
...
code/MoyaUtilities/src/fi/codecrew/moya/enums/apps/
Gam
ePermission.java
→
code/MoyaUtilities/src/fi/codecrew/moya/enums/apps/
Licens
ePermission.java
View file @
6ff1da5
...
...
@@ -2,28 +2,27 @@ package fi.codecrew.moya.enums.apps;
import
fi.codecrew.moya.enums.BortalApplication
;
public
enum
Gam
ePermission
implements
IAppPermission
{
public
enum
Licens
ePermission
implements
IAppPermission
{
MANAGE
,
VIEW_OWN_CODES
,
;
public
static
final
String
S_MANAGE
=
"
GAM
E/MANAGE"
;
public
static
final
String
S_VIEW_OWN_CODES
=
"
GAM
E/VIEW_OWN_CODES"
;
public
static
final
String
S_MANAGE
=
"
LICENS
E/MANAGE"
;
public
static
final
String
S_VIEW_OWN_CODES
=
"
LICENS
E/VIEW_OWN_CODES"
;
private
final
String
fullName
;
private
final
String
key
;
private
static
final
String
I18N_HEADER
=
"bortalApplication.
gam
e."
;
private
static
final
String
I18N_HEADER
=
"bortalApplication.
licens
e."
;
private
Gam
ePermission
()
{
private
Licens
ePermission
()
{
fullName
=
new
StringBuilder
().
append
(
getParent
().
toString
()).
append
(
DELIMITER
).
append
(
toString
()).
toString
();
key
=
I18N_HEADER
+
name
();
}
@Override
public
BortalApplication
getParent
()
{
return
BortalApplication
.
GAM
E
;
return
BortalApplication
.
LICENS
E
;
}
@Override
...
...
code/MoyaWeb/WebContent/gamecode/manageCodes.xhtml
deleted
100644 → 0
View file @
875fb1f
<!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:products=
"http://java.sun.com/jsf/composite/tools/products"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{gameCodeView.initAdminView}"
/>
</f:metadata>
<ui:param
name=
"thispage"
value=
"page.gamecode.manageCodes"
/>
<ui:define
name=
"content"
>
<h:form>
<p:dataTable
border=
"1"
id=
"games"
value=
"#{gameCodeView.games}"
var=
"game"
>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"${i18n['game.name']}"
/>
</f:facet>
<h:outputText
value=
"#{game.name}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"edit"
/>
</f:facet>
<p:commandButton
value=
"muokkaa"
update=
":editgame"
>
<f:setPropertyActionListener
value=
"#{game}"
target=
"#{gameCodeView.currentGame}"
/>
</p:commandButton>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"game.codecount"
/>
</f:facet>
<h:outputText
value=
"#{game.gameCodes.size()}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"GENEROI"
/>
</f:facet>
<p:commandButton
value=
"generoi kaikille paikoille"
action=
"#{gameCodeView.generateSelectedToAllPlaces}"
>
<f:setPropertyActionListener
value=
"#{game}"
target=
"#{gameCodeView.currentGame}"
/>
</p:commandButton>
</p:column>
</p:dataTable>
</h:form>
<br
/><br
/>
<h:form
id=
"editgame"
>
<p:panelGrid
columns=
"2"
>
<f:facet
name=
"header"
>
<h:outputLabel
rendered=
"#{gameCodeView.currentGame.id == null}"
value=
"#{i18n['game.create']}"
/>
<h:outputLabel
rendered=
"#{gameCodeView.currentGame.id != null}"
value=
"#{i18n['game.edit']}"
/>
</f:facet>
<h:outputLabel
value=
"service"
/>
<p:inputText
value=
"#{gameCodeView.currentGame.service}"
/>
<h:outputLabel
value=
"name"
/>
<p:inputText
value=
"#{gameCodeView.currentGame.name}"
/>
<h:outputLabel
value=
"description"
/>
<p:inputText
value=
"#{gameCodeView.currentGame.description}"
/>
<h:outputLabel
value=
"url"
/>
<p:inputText
value=
"#{gameCodeView.currentGame.codeUrl}"
/>
<p:commandButton
action=
"#{gameCodeView.saveCurrentGame}"
value=
"save"
/>
</p:panelGrid>
</h:form>
<h:form>
<p:commandButton
id=
"cancelbtn"
onclick=
"confirmation.show()"
value=
"#{i18n['bill.cancel']}"
/>
<p:confirmDialog
id=
"confirmDialog"
message=
"#{i18n['generic.sure.message']}"
header=
"#{i18n['generic.sure.header']}"
severity=
"alert"
widgetVar=
"confirmation"
>
<p:commandButton
value=
"#{i18n['generic.sure.yes']}"
onclick=
"confirmation.hide()"
actionListener=
"#{billEditView.expireBill()}"
ajax=
"false"
/>
<p:commandButton
value=
"#{i18n['generic.sure.no']}"
onclick=
"confirmation.hide()"
type=
"button"
/>
</p:confirmDialog>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/MoyaWeb/WebContent/gamecode/viewCodes.xhtml
deleted
100644 → 0
View file @
875fb1f
<!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:products=
"http://java.sun.com/jsf/composite/tools/products"
xmlns:tools=
"http://java.sun.com/jsf/composite/tools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.org/ui"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<ui:param
name=
"thispage"
value=
"page.gamecode.viewCodes"
/>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{gameCodeView.initUserView}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<h:form>
<h:outputLabel
rendered=
"#{gameCodeView.noGameCodes}"
value=
"#{i18n['game.noGameCodes']}"
/>
<p:dataTable
rendered=
"#{not gameCodeView.noGameCodes}"
columnClasses=
"nowrap,numalign,numalign,nowrap,numalign"
styleClass=
"bordertable"
id=
"codes"
value=
"#{gameCodeView.gameCodes}"
var=
"code"
>
<p:column
sortBy=
"#{code.game.service}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.service']}"
/>
</f:facet>
<h:outputText
value=
"#{code.game.service}"
/>
</p:column>
<p:column
sortBy=
"#{code.game.name}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.name']}"
/>
</f:facet>
<h:outputText
value=
"#{code.game.name}"
/>
</p:column>
<p:column
sortBy=
"#{code.game.description}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.description']}"
/>
</f:facet>
<h:outputText
value=
"#{code.game.description}"
/>
</p:column>
<p:column
sortBy=
"#{code.code}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.code']}"
/>
</f:facet>
<h:outputText
rendered=
"#{not code.accessed}"
value=
"ei avattu"
/>
<h:commandButton
rendered=
"#{not code.accessed}"
value=
"#{i18n['game.open']}"
action=
"#{gameCodeView.openSelectedCode}"
/>
<h:outputText
rendered=
"#{code.accessed}"
value=
"#{code.code}"
/>
</p:column>
</p:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/MoyaWeb/WebContent/resources/cditools/role/edit.xhtml
View file @
6ff1da5
...
...
@@ -41,17 +41,7 @@
<h:selectManyCheckbox
id=
"permissions"
layout=
"pageDirection"
value=
"#{bapp.selected}"
>
<f:selectItems
value=
"#{bapp.permissions}"
var=
"per"
itemLabel=
"#{i18n[per.i18nKey]}"
/>
</h:selectManyCheckbox>
<!-- <ui:repeat id="permDescs" var="perm" value="#{bapp.permissions}"> -->
<!-- <div>#{perm.name} / #{perm.description}</div> -->
<!-- </ui:repeat> -->
</h:column>
<!-- <h:column> -->
<!-- <ui:repeat id="permissions" var="perm" value="#{bapp.permissions}"> -->
<!-- <div> -->
<!-- <h:selectBooleanCheckbox value="#{perm.canHas}" /> -->
<!-- </div> -->
<!-- </ui:repeat> -->
<!-- </h:column> -->
</h:dataTable>
<h:commandButton
id=
"save2"
value=
"#{i18n['role.savePermissions']}"
action=
"#{roleView.savePermissions}"
/>
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
View file @
6ff1da5
...
...
@@ -86,9 +86,12 @@ error.error = You have encountered an error.
eventorg.create
=
Create
game.create
=
Create
game.edit
=
Edit
game.out
=
Gamecodes are out, pleace contact administration
game.active
=
Aktiivinen
game.codecount
=
Avattuja
game.create
=
Create
game.edit
=
Edit
game.out
=
Gamecodes are out, pleace contact administration
game.product
=
Tuote
generic.sure.header
=
Confirmation
generic.sure.message
=
Are you sure?
...
...
@@ -162,4 +165,6 @@ resetmailSent.header = Email sent
subnavi.cards
=
\u0009\u0009
topnavi.license
=
Lisenssikoodit
user.unauthenticated
=
Kirjautumaton
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
6ff1da5
...
...
@@ -277,7 +277,9 @@ foodwavetemplate.selectproducts = Products
foodwavetemplate.startTime
=
Foodwave time
foodwavetemplate.waveName
=
Wave name
game.active
=
Active
game.code
=
Code
game.codecount
=
Opened
game.create
=
Create
game.description
=
Description
game.edit
=
Edit
...
...
@@ -286,6 +288,7 @@ game.name = Name
game.noGameCodes
=
You have no gamecodes
game.open
=
Open code
game.out
=
Please contact out customer service
game.product
=
Product
game.service
=
Game service
gamepoints
=
Gamepoints
...
...
@@ -782,6 +785,7 @@ topnavi.event = Event
topnavi.foodwave
=
Food
topnavi.frontpage
=
Front page
topnavi.game
=
Gamecodes
topnavi.license
=
Licensecodes
topnavi.log
=
Log
topnavi.maps
=
Maps
topnavi.placemap
=
Map
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
6ff1da5
...
...
@@ -277,7 +277,9 @@ foodwavetemplate.selectproducts = Tuotteet
foodwavetemplate.startTime
=
Tilausaika
foodwavetemplate.waveName
=
Tilauksen nimi
game.active
=
Aktiivinen
game.code
=
Koodi
game.codecount
=
Avattuja
game.create
=
Luo
game.description
=
Kuvaus
game.edit
=
Muokkaa
...
...
@@ -286,6 +288,7 @@ game.name = Nimi
game.noGameCodes
=
Sinulla ei ole pelikoodeja
game.open
=
Ota koodi k
\u
00E4ytt
\u
00F6
\u
00F6n
game.out
=
Ei voitu avata pelikoodia, ota yhteytt
\u
00E4 asiakaspalveluun.
game.product
=
Tuote
game.service
=
Pelipalvelu
gamepoints
=
Pelipisteit
\u
00E4
...
...
@@ -767,6 +770,7 @@ topnavi.event = Tapahtuma
topnavi.foodwave
=
Ruokatilaus
topnavi.frontpage
=
Etusivu
topnavi.game
=
Pelikoodit
topnavi.license
=
Lisenssikoodit
topnavi.log
=
Logi
topnavi.maps
=
Kartat
topnavi.placemap
=
Paikkakartta
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/
game/GameCod
eView.java
→
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/
license/Licens
eView.java
View file @
6ff1da5
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
game
;
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
license
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.application.FacesMessage
;
import
javax.faces.context.FacesContext
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.GameBeanLocal
;
import
fi.codecrew.moya.enums.apps.BillPermission
;
import
fi.codecrew.moya.enums.apps.GamePermission
;
import
fi.codecrew.moya.model.Bill
;
import
fi.codecrew.moya.beans.LicenseBeanLocal
;
import
fi.codecrew.moya.beans.ProductBeanLocal
;
import
fi.codecrew.moya.enums.apps.LicensePermission
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.Game
;
import
fi.codecrew.moya.model.GameCode
;
import
fi.codecrew.moya.model.LicenseCode
;
import
fi.codecrew.moya.model.LicenseTarget
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.web.annotations.SelectedUser
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
@Named
@ConversationScoped
public
class
GameCod
eView
extends
GenericCDIView
{
public
class
Licens
eView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
-
8346420143750551402L
;
...
...
@@ -33,92 +33,93 @@ public class GameCodeView extends GenericCDIView {
EventBeanLocal
eventBean
;
@EJB
GameBeanLocal
gameBean
;
LicenseBeanLocal
licenseBean
;
@EJB
ProductBeanLocal
productBean
;
ListDataModel
<
Game
>
gamesDataModel
;
ListDataModel
<
GameCode
>
gameCodesDataModel
;
private
ListDataModel
<
LicenseTarget
>
licenses
;
private
ListDataModel
<
LicenseCode
>
licenseCodes
;
private
Game
currentGam
e
;
private
LicenseTarget
currentLicens
e
;
public
void
initAdminView
()
{
if
(
super
.
requirePermissions
(
Gam
ePermission
.
MANAGE
))
{
if
(
gamesDataModel
==
null
)
{
this
.
current
Game
=
new
Game
();
this
.
current
Gam
e
.
setEvent
(
eventBean
.
getCurrentEvent
());
this
.
gamesDataModel
=
new
ListDataModel
<
Game
>(
gam
eBean
.
findAll
(
eventBean
.
getCurrentEvent
()));
if
(
super
.
requirePermissions
(
Licens
ePermission
.
MANAGE
))
{
if
(
licenses
==
null
)
{
this
.
current
License
=
new
LicenseTarget
();
this
.
current
Licens
e
.
setEvent
(
eventBean
.
getCurrentEvent
());
this
.
licenses
=
new
ListDataModel
<
LicenseTarget
>(
licens
eBean
.
findAll
(
eventBean
.
getCurrentEvent
()));
this
.
beginConversation
();
}
}
}
public
void
initUserView
()
{
if
(
super
.
requirePermissions
(
GamePermission
.
VIEW_OWN_CODES
))
{
if
(
gamesDataModel
==
null
)
{
this
.
gameCodesDataModel
=
new
ListDataModel
<
GameCode
>(
gameBean
.
findUserCodes
(
user
));
System
.
out
.
println
(
"codecount: "
+
gameCodesDataModel
.
getRowCount
());
if
(
super
.
requirePermissions
(
LicensePermission
.
VIEW_OWN_CODES
))
{
if
(
licenses
==
null
)
{
this
.
licenseCodes
=
new
ListDataModel
<
LicenseCode
>(
licenseBean
.
findUserCodes
(
user
));
this
.
beginConversation
();
}
}
}
public
ListDataModel
<
Game
>
getGames
()
{
return
gamesDataModel
;
}
public
ListDataModel
<
GameCode
>
getGameCodes
()
{
return
gameCodesDataModel
;
public
String
saveCurrentLicense
()
{
licenseBean
.
saveOrCreateLicense
(
currentLicense
);
return
null
;
}
public
Game
getCurrentGame
()
{
return
this
.
currentGame
;
}
public
void
setCurrentGame
(
Game
game
)
{
this
.
currentGame
=
game
;
}
public
String
saveCurrentGame
()
{
gameBean
.
saveOrCreateGame
(
currentGame
);
public
String
editSelected
()
{
return
null
;
}
public
String
generateSelectedToAllPlaces
()
{
if
(
gamesDataModel
!=
null
&&
gam
esDataModel
.
isRowAvailable
())
{
Game
game
=
gam
esDataModel
.
getRowData
();
public
String
openSelectedCode
()
{
/*if (gameCodesDataModel != null && gameCod
esDataModel.isRowAvailable()) {
LicenseCode code = gameCod
esDataModel.getRowData();
gameBean
.
generateCodesForAllPlaces
(
game
);
if (!licenseBean.accessCode(code, user)) {
this.addFaceMessage("game.out");
}
}
return
null
;
*/
return
"todo"
;
}
public
String
editSelected
()
{
/*if (gamesDataModel != null && gamesDataModel.isRowAvailable()) {
currentGame = gamesDataModel.getRowData();
public
boolean
isNoGameCodes
()
{
//return (getGameCodes().getRowCount() <= 0);
return
false
;
}
}*/
public
ListDataModel
<
LicenseCode
>
getLicenseCodes
()
{
return
licenseCodes
;
}
return
null
;
public
void
setLicenseCodes
(
ListDataModel
<
LicenseCode
>
licenseCodes
)
{
this
.
licenseCodes
=
licenseCodes
;
}
public
String
openSelectedCode
()
{
if
(
gameCodesDataModel
!=
null
&&
gameCodesDataModel
.
isRowAvailable
())
{
GameCode
code
=
gameCodesDataModel
.
getRowData
();
public
ListDataModel
<
LicenseTarget
>
getLicenses
()
{
return
licenses
;
}
if
(!
gameBean
.
accessCode
(
code
,
user
))
{
this
.
addFaceMessage
(
"game.out"
);
}
}
public
void
setLicenses
(
ListDataModel
<
LicenseTarget
>
licenses
)
{
this
.
licenses
=
licenses
;
}
return
null
;
public
LicenseTarget
getCurrentLicense
()
{
return
currentLicense
;
}
public
boolean
isNoGameCodes
()
{
return
(
getGameCodes
().
getRowCount
()
<=
0
);
public
void
setCurrentLicense
(
LicenseTarget
currentLicense
)
{
this
.
currentLicense
=
currentLicense
;
}
public
List
<
Product
>
getProductsForLicenses
()
{
return
productBean
.
findPlaceProducts
();
}
}
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