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 64f8854a
authored
May 10, 2013
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gameCodes' into devel
2 parents
decca77b
b17f91ab
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
1052 additions
and
103 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/beans/UserBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/LicenseCodeFacade.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/LicenseTargetFacade.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/UserFacade.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/AccountEvent.java
code/MoyaDatabase/src/fi/codecrew/moya/model/EventUser.java
code/MoyaDatabase/src/fi/codecrew/moya/model/GroupMembership.java
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEvent.java
code/MoyaDatabase/src/fi/codecrew/moya/model/LicenseCode.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/LicensePermission.java
code/MoyaUtilities/src/fi/codecrew/moya/utilities/jpa/GenericFacade.java
code/MoyaWeb/WebContent/license/manageCodes.xhtml
code/MoyaWeb/WebContent/license/viewCodes.xhtml
code/MoyaWeb/WebContent/resources/cditools/role/edit.xhtml
code/MoyaWeb/WebContent/resources/templates/insomnia2/template.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/license/LicenseView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/GameBean.java
deleted
100644 → 0
View file @
decca77
package
fi
.
codecrew
.
moya
.
beans
;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
import
fi.codecrew.moya.facade.NewsGroupFacade
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.GameBeanLocal
;
/**
* Session Bean implementation class GameBean
*/
@Stateless
public
class
GameBean
implements
GameBeanLocal
{
@EJB
private
EventBeanLocal
eventbean
;
@EJB
private
NewsGroupFacade
ngfacade
;
/**
* Default constructor.
*/
public
GameBean
()
{
// TODO Auto-generated constructor stub
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/LicenseBean.java
0 → 100644
View file @
64f8854
package
fi
.
codecrew
.
moya
.
beans
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.Stateless
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.facade.LicenseCodeFacade
;
import
fi.codecrew.moya.facade.LicenseTargetFacade
;
import
fi.codecrew.moya.facade.UserFacade
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.GroupMembership
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.LicenseCode
;
import
fi.codecrew.moya.model.LicenseTarget
;
import
fi.codecrew.moya.model.User
;
/**
* Session Bean implementation class GameBean
*/
@Stateless
public
class
LicenseBean
implements
LicenseBeanLocal
{
@EJB
LicenseCodeFacade
licenseCodeFacade
;
@EJB
UserFacade
userFacade
;
@EJB
LicenseTargetFacade
licenseTargetFacade
;
@EJB
EventBeanLocal
eventBean
;
@EJB
PlaceBeanLocal
placeBean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
LicenseBean
.
class
);
/**
* Check, and if needed generate code for gamecode.
*
* @param code
*/
private
LicenseCode
generateCode
(
LicenseCode
code
)
throws
GenerationException
{
if
(
code
.
getCode
()
==
null
||
code
.
getCode
().
trim
().
equals
(
""
))
{
if
(
code
.
getLicenseTarget
().
getCodeUrl
()
==
null
||
code
.
getLicenseTarget
().
getCodeUrl
().
trim
().
equals
(
""
))
{
throw
new
GenerationException
(
"Code generate failed"
);
}
try
{
URL
url
=
new
URL
(
code
.
getLicenseTarget
().
getCodeUrl
());
URLConnection
uc
;
uc
=
url
.
openConnection
();
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
uc
.
getInputStream
()));
String
codeString
=
""
;
String
tmpLine
;
while
((
tmpLine
=
in
.
readLine
())
!=
null
)
{
if
(!
codeString
.
equals
(
""
))
{
codeString
+=
"\n"
;
}
codeString
+=
tmpLine
;
}
if
(
codeString
.
trim
().
equals
(
"0"
)
||
codeString
.
trim
().
equals
(
""
))
{
throw
new
GenerationException
(
"Code generate failed"
);
}
code
.
setCode
(
codeString
);
code
=
licenseCodeFacade
.
merge
(
code
);
return
code
;
}
catch
(
IOException
e
)
{
logger
.
warn
(
"Code generate failed"
,
e
);
throw
new
GenerationException
(
"Code generate failed"
);
}
}
throw
new
RuntimeException
(
"LOL, what?"
);
}
public
LicenseCode
accessCode
(
LicenseCode
code
)
throws
GenerationException
{
code
=
generateCode
(
code
);
if
(!
code
.
isAccessed
())
{
code
.
setAccessed
(
Calendar
.
getInstance
());
code
=
licenseCodeFacade
.
merge
(
code
);
}
return
code
;
}
public
List
<
LicenseTarget
>
findAll
(
LanEvent
event
)
{
return
event
.
getGames
();
}
public
void
saveOrCreateLicense
(
LicenseTarget
target
)
{
if
(
target
.
getId
()
==
null
)
{
target
.
setEvent
(
eventBean
.
getCurrentEvent
());
eventBean
.
getCurrentEvent
().
getGames
().
add
(
target
);
licenseTargetFacade
.
create
(
target
);
target
=
licenseTargetFacade
.
merge
(
target
);
}
else
{
target
=
licenseTargetFacade
.
merge
(
target
);
}
}
/**
* Default constructor.
*/
public
LicenseBean
()
{
// TODO Auto-generated constructor stub
}
@Override
public
List
<
LicenseTarget
>
findUserGames
(
EventUser
user
)
{
ArrayList
<
LicenseTarget
>
returnLicenses
=
new
ArrayList
<
LicenseTarget
>();
if
(
user
.
getGroupMemberships
()
!=
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
:
user
.
getUser
().
getLicenseCodes
())
{
returnLicenses
.
remove
(
code
.
getLicenseTarget
());
}
return
returnLicenses
;
}
@Override
public
LicenseCode
createAndAccessCode
(
LicenseTarget
target
,
User
user
)
throws
GenerationException
{
user
=
userFacade
.
reload
(
user
);
LicenseCode
code
=
new
LicenseCode
(
target
);
user
.
getLicenseCodes
().
add
(
code
);
code
.
setUser
(
user
);
licenseCodeFacade
.
create
(
code
);
code
=
accessCode
(
code
);
return
code
;
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
View file @
64f8854
...
...
@@ -14,6 +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.LicensePermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.PollPermission
;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
...
...
@@ -304,6 +305,7 @@ public class MenuBean implements MenuBeanLocal {
userTopnavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/user/accountEvents"
),
UserPermission
.
VIEW_SELF
);
userTopnavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/place/myGroups"
),
UserPermission
.
VIEW_SELF
);
userTopnavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/user/sendPicture"
),
UserPermission
.
VIEW_SELF
);
MenuNavigation
placemapTopmenu
=
usernavi
.
addPage
(
null
,
null
);
placemapTopmenu
.
setKey
(
"topnavi.placemap"
);
...
...
@@ -336,6 +338,11 @@ public class MenuBean implements MenuBeanLocal {
// ShopPermission.SHOP_FOODWAVE);
foodwaveTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/foodwave/listProducts"
),
ShopPermission
.
SHOP_FOODWAVE
).
setVisible
(
false
);
foodwaveTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/foodwave/ThanksForOrderingFromCounter"
),
ShopPermission
.
SHOP_FOODWAVE
).
setVisible
(
false
);
MenuNavigation
gameTopmenu
=
usernavi
.
addPage
(
null
,
null
);
gameTopmenu
.
setKey
(
"topnavi.license"
);
gameTopmenu
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/license/viewCodes"
),
LicensePermission
.
VIEW_OWN_CODES
);
MenuNavigation
pollTopmenu
=
usernavi
.
addPage
(
null
,
null
);
pollTopmenu
.
setKey
(
"topnavi.poll"
);
...
...
@@ -424,6 +431,9 @@ public class MenuBean implements MenuBeanLocal {
foodnavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/foodadmin/createTemplate"
),
ShopPermission
.
MANAGE_FOODWAVES
);
foodnavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/foodadmin/editTemplate"
),
ShopPermission
.
MANAGE_FOODWAVES
).
setVisible
(
false
);
MenuNavigation
gamenavi
=
adminnavi
.
addPage
(
null
,
null
);
gamenavi
.
setKey
(
"topnavi.license"
);
gamenavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/license/manageCodes"
),
LicensePermission
.
MANAGE
);
}
@Override
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PermissionBean.java
View file @
64f8854
...
...
@@ -17,6 +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.LicensePermission
;
import
fi.codecrew.moya.enums.apps.IAppPermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.PollPermission
;
...
...
@@ -91,7 +92,9 @@ import fi.codecrew.moya.model.User;
EventPermission
.
S_MANAGE_PRIVATE_PROPERTIES
,
EventPermission
.
S_MANAGE_PROPERTIES
,
LicensePermission
.
S_MANAGE
,
LicensePermission
.
S_VIEW_OWN_CODES
})
@LocalBean
public
class
PermissionBean
implements
PermissionBeanLocal
{
...
...
@@ -113,11 +116,6 @@ public class PermissionBean implements PermissionBeanLocal {
@EJB
private
EventBeanLocal
eventbean
;
//
// @Override
// public boolean hasPermission(String perm) {
// return context.isCallerInRole(perm);
// }
@Override
public
boolean
hasPermission
(
IAppPermission
perm
)
{
...
...
@@ -130,36 +128,7 @@ public class PermissionBean implements PermissionBeanLocal {
}
// @Override
// public boolean fatalPermission(IAppPermission permission, Object...
// failmessage) {
// boolean ret = hasPermission(permission);
// if (!ret) {
// StringBuilder message = new
// StringBuilder().append(" permission: ").append(permission);
// if (failmessage == null || failmessage.length == 0) {
// message.append(" MSG: SessionHandler mbean permission exception: Permission: ")
// .append(permission);
// } else {
// for (Object part : failmessage) {
// message.append(part == null ? "NULL" : part.toString());
// }
// }
// // throw new SecurityException("Foobar");
//
// throw new PermissionDeniedException(loggingbean, getCurrentUser(),
// message.toString());
// }
// return true;
// }
//
// @Override
// public void fatalNotLoggedIn() throws PermissionDeniedException {
// if (!isLoggedIn()) {
// throw new PermissionDeniedException(loggingbean, getCurrentUser(),
// "User is not logged in!");
// }
// }
@Override
public
boolean
isCurrentUser
(
User
user
)
{
...
...
@@ -178,8 +147,6 @@ public class PermissionBean implements PermissionBeanLocal {
// logger.info("Checking principal {} against anon: {}", principal,
// ret);
return
ret
;
// return !getAnonEventUser().equals(getCurrentUser()) ||
// getCurrentUser().getUser().isSuperadmin();
}
@Override
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/ProductBean.java
View file @
64f8854
...
...
@@ -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/beans/UserBean.java
View file @
64f8854
...
...
@@ -274,7 +274,6 @@ public class UserBean implements UserBeanLocal {
public
void
createNewUser
(
EventUser
user
,
String
password
)
{
user
.
getUser
().
resetPassword
(
password
);
// todo add barcode
user
.
setEvent
(
eventBean
.
getCurrentEvent
());
// Tallennetaan olio kantaan...
eventUserFacade
.
create
(
user
);
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/LicenseCodeFacade.java
0 → 100644
View file @
64f8854
package
fi
.
codecrew
.
moya
.
facade
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.codecrew.moya.model.LicenseCode
;
@Stateless
@LocalBean
public
class
LicenseCodeFacade
extends
IntegerPkGenericFacade
<
LicenseCode
>
{
public
LicenseCodeFacade
()
{
super
(
LicenseCode
.
class
);
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/LicenseTargetFacade.java
0 → 100644
View file @
64f8854
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/MoyaBeans/ejbModule/fi/codecrew/moya/facade/UserFacade.java
View file @
64f8854
...
...
@@ -88,9 +88,9 @@ public class UserFacade extends IntegerPkGenericFacade<User> {
// }
@Override
public
void
create
(
User
user
)
{
public
User
create
(
User
user
)
{
user
.
setLogin
(
user
.
getLogin
().
toLowerCase
().
trim
());
super
.
create
(
user
);
return
super
.
create
(
user
);
}
@Override
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/GameBeanLocal.java
deleted
100644 → 0
View file @
decca77
package
fi
.
codecrew
.
moya
.
beans
;
import
javax.ejb.Local
;
@Local
public
interface
GameBeanLocal
{
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/LicenseBeanLocal.java
0 → 100644
View file @
64f8854
package
fi
.
codecrew
.
moya
.
beans
;
import
java.util.List
;
import
javax.ejb.ApplicationException
;
import
javax.ejb.Local
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.LicenseCode
;
import
fi.codecrew.moya.model.LicenseTarget
;
import
fi.codecrew.moya.model.User
;
@Local
public
interface
LicenseBeanLocal
{
public
LicenseCode
accessCode
(
LicenseCode
code
)
throws
GenerationException
;
public
List
<
LicenseTarget
>
findAll
(
LanEvent
event
);
public
void
saveOrCreateLicense
(
LicenseTarget
game
);
public
List
<
LicenseTarget
>
findUserGames
(
EventUser
user
);
public
List
<
LicenseTarget
>
findUnopenedUserGames
(
EventUser
user
);
public
LicenseCode
createAndAccessCode
(
LicenseTarget
target
,
User
user
)
throws
GenerationException
;
@ApplicationException
(
rollback
=
true
)
public
static
class
GenerationException
extends
Exception
{
public
GenerationException
()
{
super
();
}
public
GenerationException
(
String
message
)
{
super
(
message
);
}
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
}
}
\ No newline at end of file
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/ProductBeanLocal.java
View file @
64f8854
...
...
@@ -55,5 +55,7 @@ public interface ProductBeanLocal {
void
saveInventoryEvent
(
InventoryEvent
ie
);
List
<
Product
>
findProductsForEvent
();
List
<
Product
>
findPlaceProducts
();
}
code/MoyaDatabase/src/fi/codecrew/moya/model/AccountEvent.java
View file @
64f8854
...
...
@@ -61,7 +61,7 @@ public class AccountEvent extends GenericEntity {
private
Calendar
delivered
;
@Column
(
name
=
"delivered_count"
,
nullable
=
false
,
precision
=
24
,
scale
=
4
)
private
BigDecimal
deliveredCount
;
private
BigDecimal
deliveredCount
=
new
BigDecimal
(
0
)
;
/**
* If this AccountEvent is a product in foodwace, this field is a reference
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/EventUser.java
View file @
64f8854
...
...
@@ -104,6 +104,9 @@ public class EventUser extends GenericEntity {
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"createtime"
,
nullable
=
false
,
updatable
=
false
)
private
Date
eventuserCreated
;
public
EventUser
getCreator
()
{
return
creator
;
...
...
@@ -443,4 +446,5 @@ public class EventUser extends GenericEntity {
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/GroupMembership.java
View file @
64f8854
...
...
@@ -58,6 +58,7 @@ public class GroupMembership extends GenericEntity {
private
Place
placeReservation
;
@JoinColumn
(
name
=
EVENTUSER_ID
,
referencedColumnName
=
EventUser
.
ID_COLUMN
)
@ManyToOne
private
EventUser
user
;
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEvent.java
View file @
64f8854
...
...
@@ -73,6 +73,9 @@ public class LanEvent extends GenericEntity {
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"event"
)
private
List
<
Compo
>
compos
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"event"
)
private
List
<
LicenseTarget
>
games
;
@OneToMany
(
mappedBy
=
"event"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
CardTemplate
>
cardTemplates
;
...
...
@@ -281,4 +284,14 @@ public class LanEvent extends GenericEntity {
this
.
properties
=
properties
;
}
public
List
<
LicenseTarget
>
getGames
()
{
if
(
games
==
null
)
games
=
new
ArrayList
<
LicenseTarget
>();
return
games
;
}
public
void
setGames
(
List
<
LicenseTarget
>
games
)
{
this
.
games
=
games
;
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/LicenseCode.java
0 → 100644
View file @
64f8854
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.Calendar
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
/**
*
*/
@Entity
@Table
(
name
=
"licensecodes"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
LicenseCode
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
LicenseTarget
licenseTarget
;
@JoinColumn
(
name
=
"user_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
private
User
user
;
public
LicenseCode
()
{
super
();
}
public
LicenseCode
(
LicenseTarget
target
)
{
this
();
this
.
licenseTarget
=
target
;
}
public
boolean
isAccessed
()
{
return
(
accessed
!=
null
);
}
public
Calendar
getAccessed
()
{
return
accessed
;
}
public
void
setAccessed
(
Calendar
accessed
)
{
this
.
accessed
=
accessed
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
User
getUser
()
{
return
user
;
}
public
void
setUser
(
User
user
)
{
this
.
user
=
user
;
}
public
LicenseTarget
getLicenseTarget
()
{
return
licenseTarget
;
}
public
void
setLicenseTarget
(
LicenseTarget
licenseTarget
)
{
this
.
licenseTarget
=
licenseTarget
;
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/LicenseTarget.java
0 → 100644
View file @
64f8854
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.List
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OrderBy
;
import
javax.persistence.Table
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
/**
*
*/
@Entity
@Table
(
name
=
"licenseTargets"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
LicenseTarget
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
1L
;
@Column
(
name
=
"active"
)
private
boolean
active
=
false
;
@Column
(
name
=
"name"
)
private
String
name
;
@Column
(
name
=
"service"
)
private
String
service
;
@Column
(
name
=
"description"
)
private
String
description
;
@Column
(
name
=
"code_url"
)
private
String
codeUrl
;
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
private
LanEvent
event
;
@OneToMany
(
mappedBy
=
"licenseTarget"
,
fetch
=
FetchType
.
LAZY
)
@OrderBy
()
private
List
<
LicenseCode
>
licenseCodes
;
@JoinColumn
(
name
=
"product_id"
,
referencedColumnName
=
"id"
)
@ManyToOne
private
Product
product
;
public
LicenseTarget
()
{
super
();
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getCodeUrl
()
{
return
codeUrl
;
}
public
void
setCodeUrl
(
String
codeUrl
)
{
this
.
codeUrl
=
codeUrl
;
}
public
LanEvent
getEvent
()
{
return
event
;
}
public
void
setEvent
(
LanEvent
event
)
{
this
.
event
=
event
;
}
public
String
getService
()
{
return
service
;
}
public
void
setService
(
String
service
)
{
this
.
service
=
service
;
}
public
List
<
LicenseCode
>
getGameCodes
()
{
return
licenseCodes
;
}
public
void
setGameCodes
(
List
<
LicenseCode
>
gameCodes
)
{
this
.
licenseCodes
=
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 @
64f8854
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OneToOne
;
import
javax.persistence.OrderBy
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/Product.java
View file @
64f8854
...
...
@@ -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 @
64f8854
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -9,6 +10,7 @@ import javax.persistence.Column;
import
javax.persistence.Entity
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OneToOne
;
...
...
@@ -108,6 +110,10 @@ public class User extends GenericEntity implements IUser {
@OrderBy
@PrivateOwned
private
List
<
UserImage
>
userImageList
;
@OneToMany
(
mappedBy
=
"user"
,
fetch
=
FetchType
.
LAZY
)
@OrderBy
()
private
List
<
LicenseCode
>
licenseCodes
;
@Transient
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
User
.
class
);
...
...
@@ -353,5 +359,17 @@ public class User extends GenericEntity implements IUser {
}
return
isAnon
;
}
public
List
<
LicenseCode
>
getLicenseCodes
()
{
if
(
licenseCodes
==
null
)
licenseCodes
=
new
ArrayList
<
LicenseCode
>();
return
licenseCodes
;
}
public
void
setLicenseCodes
(
List
<
LicenseCode
>
codes
)
{
this
.
licenseCodes
=
codes
;
}
}
code/MoyaUtilities/src/fi/codecrew/moya/enums/BortalApplication.java
View file @
64f8854
...
...
@@ -4,6 +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.LicensePermission
;
import
fi.codecrew.moya.enums.apps.IAppPermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.PollPermission
;
...
...
@@ -23,6 +24,7 @@ public enum BortalApplication {
SALESPOINT
(
SalespointPermission
.
class
),
COMPO
(
CompoPermission
.
class
),
EVENT
(
EventPermission
.
class
),
LICENSE
(
LicensePermission
.
class
),
;
...
...
code/MoyaUtilities/src/fi/codecrew/moya/enums/apps/LicensePermission.java
0 → 100644
View file @
64f8854
package
fi
.
codecrew
.
moya
.
enums
.
apps
;
import
fi.codecrew.moya.enums.BortalApplication
;
public
enum
LicensePermission
implements
IAppPermission
{
MANAGE
,
VIEW_OWN_CODES
,
;
public
static
final
String
S_MANAGE
=
"LICENSE/MANAGE"
;
public
static
final
String
S_VIEW_OWN_CODES
=
"LICENSE/VIEW_OWN_CODES"
;
private
final
String
fullName
;
private
final
String
key
;
private
static
final
String
I18N_HEADER
=
"bortalApplication.license."
;
private
LicensePermission
()
{
fullName
=
new
StringBuilder
().
append
(
getParent
().
toString
()).
append
(
DELIMITER
).
append
(
toString
()).
toString
();
key
=
I18N_HEADER
+
name
();
}
@Override
public
BortalApplication
getParent
()
{
return
BortalApplication
.
LICENSE
;
}
@Override
public
String
getFullName
()
{
return
fullName
;
}
@Override
public
String
getI18nKey
()
{
return
key
;
}
}
code/MoyaUtilities/src/fi/codecrew/moya/utilities/jpa/GenericFacade.java
View file @
64f8854
...
...
@@ -38,8 +38,10 @@ public abstract class GenericFacade<C extends ModelInterface> {
protected
abstract
EntityManager
getEm
();
public
void
create
(
C
entity
)
{
public
C
create
(
C
entity
)
{
getEm
().
persist
(
entity
);
return
entity
;
}
public
void
remove
(
C
entity
)
{
...
...
@@ -52,8 +54,8 @@ public abstract class GenericFacade<C extends ModelInterface> {
}
public
void
refresh
(
C
usr
)
{
getEm
().
refresh
(
usr
);
public
void
refresh
(
C
entity
)
{
getEm
().
refresh
(
entity
);
}
public
C
find
(
Integer
id
)
{
...
...
code/MoyaWeb/WebContent/license/manageCodes.xhtml
0 → 100644
View file @
64f8854
<!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=
"#{sessionHandler.template}"
>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{licenseView.initAdminView}"
/>
</f:metadata>
<ui:param
name=
"thispage"
value=
"page.license.manageCodes"
/>
<ui:define
name=
"content"
>
<h:form
id=
"licenseForm"
>
<p:dataTable
border=
"1"
id=
"games"
value=
"#{licenseView.licenses}"
var=
"license"
>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.name']}"
/>
</f:facet>
<h:outputText
value=
"#{license.name}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"edit"
/>
</f:facet>
<p:commandButton
value=
"muokkaa"
update=
":editgame"
>
<f:setPropertyActionListener
value=
"#{license}"
target=
"#{licenseView.currentLicense}"
/>
</p:commandButton>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.codecount']}"
/>
</f:facet>
<h:outputText
value=
"#{license.licenseCodes.size()}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.active']}"
/>
</f:facet>
<h:outputText
rendered=
"#{license.active}"
value=
"X"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.product']}"
/>
</f:facet>
<h:outputText
value=
"#{license.product.name}"
/>
</p:column>
</p:dataTable>
</h:form>
<br
/><br
/>
<h:form
id=
"editgame"
>
<p:panelGrid
columns=
"2"
>
<f:facet
name=
"header"
>
<h:outputLabel
rendered=
"#{licenseView.currentLicense.id == null}"
value=
"#{i18n['game.create']}"
/>
<h:outputLabel
rendered=
"#{licenseView.currentLicense.id != null}"
value=
"#{i18n['game.edit']}"
/>
</f:facet>
<h:outputLabel
value=
"service"
/>
<p:inputText
value=
"#{licenseView.currentLicense.service}"
/>
<h:outputLabel
value=
"name"
/>
<p:inputText
value=
"#{licenseView.currentLicense.name}"
/>
<h:outputLabel
value=
"description"
/>
<p:inputText
value=
"#{licenseView.currentLicense.description}"
/>
<h:outputLabel
value=
"url"
/>
<p:inputText
value=
"#{licenseView.currentLicense.codeUrl}"
/>
<h:outputLabel
value=
"active"
/>
<p:selectBooleanCheckbox
value=
"#{licenseView.currentLicense.active}"
/>
<h:outputLabel
value=
"product"
/>
<h:selectOneMenu
converter=
"#{productConverter}"
value=
"#{licenseView.currentLicense.product}"
>
<f:selectItems
var=
"product"
itemLabel=
"#{product.name}"
value=
"#{licenseView.productsForLicenses}"
/>
</h:selectOneMenu>
<p:commandButton
action=
"#{licenseView.saveCurrentLicense}"
update=
":licenseForm"
value=
"save"
/>
</p:panelGrid>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/MoyaWeb/WebContent/license/viewCodes.xhtml
0 → 100644
View file @
64f8854
<!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=
"#{sessionHandler.template}"
>
<ui:param
name=
"thispage"
value=
"page.gamecode.viewCodes"
/>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{licenseView.initUserView}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<h:form>
<h1><h:outputLabel
value=
"#{i18n['game.codes.opened']}"
/></h1>
<h:outputLabel
rendered=
"#{licenseView.noLicenseCodes}"
value=
"#{i18n['game.noGameCodes']}"
/>
<p:dataTable
rendered=
"#{not licenseView.noLicenseCodes}"
columnClasses=
"nowrap,numalign,numalign,nowrap,numalign"
styleClass=
"bordertable"
id=
"codes"
value=
"#{licenseView.licenseCodes}"
var=
"code"
>
<p:column
sortBy=
"#{code.license.service}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.service']}"
/>
</f:facet>
<h:outputText
value=
"#{code.licenseTarget.service}"
/>
</p:column>
<p:column
sortBy=
"#{code.license.name}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.name']}"
/>
</f:facet>
<h:outputText
value=
"#{code.licenseTarget.name}"
/>
</p:column>
<p:column
sortBy=
"#{code.license.description}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.description']}"
/>
</f:facet>
<h:outputText
value=
"#{code.licenseTarget.description}"
/>
</p:column>
<p:column
sortBy=
"#{code.code}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.code']}"
/>
</f:facet>
<h:outputText
rendered=
"#{code.accessed}"
value=
"#{code.code}"
/>
<h:outputText
rendered=
"#{not code.accessed}"
value=
"ei avattu, ota yhteyttä ylläpitoon"
/>
</p:column>
</p:dataTable>
</h:form>
<br
/><br
/><br
/>
<h:form>
<h1><h:outputLabel
rendered=
"#{not licenseView.noLicenses}"
value=
"#{i18n['game.codes.available']}"
/></h1>
<p:dataTable
rendered=
"#{not licenseView.noLicenses}"
columnClasses=
"nowrap,numalign,numalign,nowrap,numalign"
styleClass=
"bordertable"
id=
"codes"
value=
"#{licenseView.licenses}"
var=
"license"
>
<p:column
sortBy=
"#{license.service}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.service']}"
/>
</f:facet>
<h:outputText
value=
"#{license.service}"
/>
</p:column>
<p:column
sortBy=
"#{license.name}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.name']}"
/>
</f:facet>
<h:outputText
value=
"#{license.name}"
/>
</p:column>
<p:column
sortBy=
"#{license.description}"
>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.description']}"
/>
</f:facet>
<h:outputText
value=
"#{license.description}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['game.open']}"
/>
</f:facet>
<h:commandButton
value=
"#{i18n['game.open']}"
action=
"#{licenseView.openSelectedCode}"
/>
</p:column>
</p:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
code/MoyaWeb/WebContent/resources/cditools/role/edit.xhtml
View file @
64f8854
...
...
@@ -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/WebContent/resources/templates/insomnia2/template.xhtml
View file @
64f8854
...
...
@@ -7,8 +7,7 @@
<h:head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title><h:outputText
value=
"#{layoutView.getHeader()}"
/></title>
<meta
name=
"description"
content=
"Insomnia lippukauppa"
/>
<meta
name=
"author"
content=
"Niko Juusela, csharp"
/>
<meta
name=
"description"
content=
"#{layoutView.getHeader()}"
/>
<meta
http-equiv=
"Content-Language"
content=
"fi"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"#{request.contextPath}/resources/templates/insomnia2/css/tyyli.css"
/>
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
View file @
64f8854
...
...
@@ -86,6 +86,15 @@ error.error = You have encountered an error.
eventorg.create
=
Create
game.active
=
Aktiivinen
game.codecount
=
Avattuja
game.codes.available
=
Lisenssikoodit
game.codes.opened
=
Avatut lisenssikoodit
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?
generic.sure.no
=
No
...
...
@@ -158,4 +167,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 @
64f8854
...
...
@@ -277,7 +277,21 @@ foodwavetemplate.selectproducts = Products
foodwavetemplate.startTime
=
Foodwave time
foodwavetemplate.waveName
=
Wave name
game.gamepoints
=
Game points
game.active
=
Active
game.code
=
Code
game.codecount
=
Opened
game.codes.available
=
Licensecodes
game.codes.opened
=
Opened licensecodes
game.create
=
Create
game.description
=
Description
game.edit
=
Edit
game.gamepoints
=
Game points
game.name
=
Name
game.noGameCodes
=
You have no opened gamecodes
game.open
=
Open code
game.out
=
Please contact out customer service
game.product
=
Product
game.service
=
Game service
gamepoints
=
Gamepoints
...
...
@@ -779,6 +793,8 @@ topnavi.createuser = Create user
topnavi.event
=
Event
topnavi.foodwave
=
Food
topnavi.frontpage
=
Front page
topnavi.game
=
Gamecodes
topnavi.license
=
Licensecodes
topnavi.log
=
Log
topnavi.login
=
Login
topnavi.maps
=
Maps
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
64f8854
...
...
@@ -277,7 +277,21 @@ foodwavetemplate.selectproducts = Tuotteet
foodwavetemplate.startTime
=
Tilausaika
foodwavetemplate.waveName
=
Tilauksen nimi
game.gamepoints
=
Insomnia Game pisteet:
game.active
=
Aktiivinen
game.code
=
Koodi
game.codecount
=
Avattuja
game.codes.available
=
Lisenssikoodit
game.codes.opened
=
Avatut lisenssikoodit
game.create
=
Luo
game.description
=
Kuvaus
game.edit
=
Muokkaa
game.gamepoints
=
Insomnia Game pisteet:
game.name
=
Nimi
game.noGameCodes
=
Sinulla ei ole avattuja 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
...
...
@@ -764,6 +778,8 @@ topnavi.createuser = Luo k\u00E4ytt\u00E4j\u00E4
topnavi.event
=
Tapahtuma
topnavi.foodwave
=
Ruokatilaus
topnavi.frontpage
=
Etusivu
topnavi.game
=
Pelikoodit
topnavi.license
=
Lisenssikoodit
topnavi.log
=
Logi
topnavi.login
=
Kirjaudu sis
\u
00E4
\u
00E4n
topnavi.maps
=
Kartat
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/license/LicenseView.java
0 → 100644
View file @
64f8854
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
license
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Named
;
import
fi.codecrew.moya.beans.EventBeanLocal
;
import
fi.codecrew.moya.beans.LicenseBeanLocal
;
import
fi.codecrew.moya.beans.LicenseBeanLocal.GenerationException
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.beans.ProductBeanLocal
;
import
fi.codecrew.moya.enums.apps.LicensePermission
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.LicenseCode
;
import
fi.codecrew.moya.model.LicenseTarget
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
@Named
@ConversationScoped
public
class
LicenseView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
-
8346420143750551402L
;
private
EventUser
currentUser
;
@EJB
private
PermissionBeanLocal
permissionBean
;
@EJB
private
EventBeanLocal
eventBean
;
@EJB
private
LicenseBeanLocal
licenseBean
;
@EJB
private
ProductBeanLocal
productBean
;
private
ListDataModel
<
LicenseTarget
>
licenses
;
private
ListDataModel
<
LicenseCode
>
licenseCodes
;
private
LicenseTarget
currentLicense
;
public
void
initAdminView
()
{
if
(
super
.
requirePermissions
(
LicensePermission
.
MANAGE
))
{
if
(
licenses
==
null
)
{
this
.
currentLicense
=
new
LicenseTarget
();
this
.
currentLicense
.
setEvent
(
eventBean
.
getCurrentEvent
());
this
.
licenses
=
new
ListDataModel
<
LicenseTarget
>(
licenseBean
.
findAll
(
eventBean
.
getCurrentEvent
()));
this
.
beginConversation
();
}
}
}
public
void
initUserView
()
{
if
(
super
.
requirePermissions
(
LicensePermission
.
VIEW_OWN_CODES
))
{
if
(
licenseCodes
==
null
)
{
currentUser
=
permissionBean
.
getCurrentUser
();
this
.
licenseCodes
=
new
ListDataModel
<
LicenseCode
>(
currentUser
.
getUser
().
getLicenseCodes
());
this
.
licenses
=
new
ListDataModel
<
LicenseTarget
>(
licenseBean
.
findUnopenedUserGames
(
currentUser
));
this
.
beginConversation
();
}
}
}
public
String
saveCurrentLicense
()
{
licenseBean
.
saveOrCreateLicense
(
currentLicense
);
this
.
licenses
=
new
ListDataModel
<
LicenseTarget
>(
licenseBean
.
findAll
(
eventBean
.
getCurrentEvent
()));
return
null
;
}
public
String
editSelected
()
{
return
null
;
}
public
String
openSelectedCode
()
{
if
(
this
.
licenses
!=
null
&&
this
.
licenses
.
isRowAvailable
())
{
LicenseTarget
license
=
this
.
licenses
.
getRowData
();
try
{
LicenseCode
code
=
licenseBean
.
createAndAccessCode
(
license
,
currentUser
.
getUser
());
}
catch
(
GenerationException
x
)
{
this
.
addFaceMessage
(
"game.out"
);
}
licenseCodes
=
null
;
initUserView
();
}
return
null
;
}
public
boolean
isNoLicenseCodes
()
{
return
(
getLicenseCodes
().
getRowCount
()
<=
0
);
}
public
boolean
isNoLicenses
()
{
return
(
getLicenses
().
getRowCount
()
<=
0
);
}
public
ListDataModel
<
LicenseCode
>
getLicenseCodes
()
{
return
licenseCodes
;
}
public
void
setLicenseCodes
(
ListDataModel
<
LicenseCode
>
licenseCodes
)
{
this
.
licenseCodes
=
licenseCodes
;
}
public
ListDataModel
<
LicenseTarget
>
getLicenses
()
{
return
licenses
;
}
public
void
setLicenses
(
ListDataModel
<
LicenseTarget
>
licenses
)
{
this
.
licenses
=
licenses
;
}
public
LicenseTarget
getCurrentLicense
()
{
return
currentLicense
;
}
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