Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Max Mecklin
/
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 cea82251
authored
Apr 09, 2016
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no longer place timeout
1 parent
55325248
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
125 additions
and
133 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PlaceBeanLocal.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/map/QueueBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/map/QueueBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/facade/PlaceFacade.java
code/moya-database/src/main/java/fi/codecrew/moya/model/Place.java
code/moya-web/WebContent/bill/list.xhtml
code/moya-web/WebContent/place/myGroups.xhtml
code/moya-web/WebContent/place/unlockedPlaces.xhtml
code/moya-web/WebContent/resources/seatjs/seatmap.js
code/moya-web/src/main/java/fi/codecrew/moya/rest/PojoUtils.java
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/MapManageView.java
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/PlacegroupView.java
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/UnlockedPlaceView.java
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n.properties
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_en.properties
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_fi.properties
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PlaceBeanLocal.java
View file @
cea8225
...
@@ -145,4 +145,6 @@ public interface PlaceBeanLocal {
...
@@ -145,4 +145,6 @@ public interface PlaceBeanLocal {
*/
*/
List
<
Place
>
findAllForEvent
();
List
<
Place
>
findAllForEvent
();
boolean
isUnlockedPlaces
(
EventUser
user
);
}
}
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/map/QueueBeanLocal.java
View file @
cea8225
...
@@ -52,4 +52,6 @@ public interface QueueBeanLocal {
...
@@ -52,4 +52,6 @@ public interface QueueBeanLocal {
void
forceRemove
(
EventMap
e
,
EventUser
u
);
void
forceRemove
(
EventMap
e
,
EventUser
u
);
void
removeFromAll
(
EventUser
user
);
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
View file @
cea8225
...
@@ -395,6 +395,13 @@ public class BootstrapBean implements BootstrapBeanLocal {
...
@@ -395,6 +395,13 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE help_texts DROP COLUMN title;"
"ALTER TABLE help_texts DROP COLUMN title;"
});
});
// we do rename magic, so we do not lose reserve -information. We don't really care about this time maybe being 1hour offsync
dbUpdates
.
add
(
new
String
[]
{
"ALTER TABLE places RENAME release_time TO reserve_time;"
});
}
}
public
BootstrapBean
()
{
public
BootstrapBean
()
{
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
View file @
cea8225
...
@@ -78,14 +78,13 @@ import fi.codecrew.moya.utilities.moyamessage.MoyaEventType;
...
@@ -78,14 +78,13 @@ import fi.codecrew.moya.utilities.moyamessage.MoyaEventType;
MapPermission
.
S_MANAGE_OTHERS
,
MapPermission
.
S_MANAGE_OTHERS
,
})
})
public
class
PlaceBean
implements
PlaceBeanLocal
{
public
class
PlaceBean
implements
PlaceBeanLocal
{
private
static
final
String
PLACE_RESERVE_TIMEOUTER
=
"Map reserve timeouter"
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PlaceBean
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PlaceBean
.
class
);
public
static
final
int
RESERVE_MINUTES
=
20
;
@EJB
@EJB
private
GroupMembershipFacade
gmemfacade
;
private
GroupMembershipFacade
gmemfacade
;
@Resource
//
@Resource
private
TimerService
ts
;
//
private TimerService ts;
@EJB
@EJB
private
PlaceFacade
placeFacade
;
private
PlaceFacade
placeFacade
;
...
@@ -262,47 +261,16 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -262,47 +261,16 @@ public class PlaceBean implements PlaceBeanLocal {
}
}
place
.
setCurrentUser
(
user
);
place
.
setCurrentUser
(
user
);
place
.
setReleaseTime
(
Calendar
.
getInstance
());
place
.
setReserveTime
(
Calendar
.
getInstance
());
place
.
getReleaseTime
().
add
(
Calendar
.
MINUTE
,
RESERVE_MINUTES
);
// Create timeout service to timeout the reserved place in
// RESERVE_MINUTES
boolean
foundTimeout
=
false
;
for
(
Timer
t
:
ts
.
getTimers
())
{
if
(
t
.
getInfo
().
equals
(
PLACE_RESERVE_TIMEOUTER
))
{
foundTimeout
=
true
;
break
;
}
}
if
(!
foundTimeout
)
{
logger
.
info
(
"Place timeout calculator not started. Starting new."
);
ts
.
createTimer
(
new
Date
(),
1000
*
60
,
PLACE_RESERVE_TIMEOUTER
);
}
ret
=
true
;
ret
=
true
;
}
}
}
}
return
ret
;
return
ret
;
}
}
@Timeout
public
void
checkTimedOutPlaces
(
Timer
timer
)
{
// logger.debug("Checking Timed out places at {}", new Date());
placeFacade
.
timeoutPlaces
();
}
//
// @Override
// public void releaseUsersPlaces(User user) throws
// PermissionDeniedException {
// if (user == null) {
// user = permbean.getCurrentUser();
// } else if (!permbean.isCurrentUser(user)) {
// permbean.fatalPermission(MapPermission.MANAGE_OTHERS,
// "Not enough rights to release users ", user, " places");
// }
// logger.debug("timeouting places");
// placeFacade.releasePlaces(permbean.getCurrentUser());
// }
@Override
@Override
@RolesAllowed
({
MapPermission
.
S_BUY_PLACES
,
MapPermission
.
S_MANAGE_OTHERS
})
@RolesAllowed
({
MapPermission
.
S_BUY_PLACES
,
MapPermission
.
S_MANAGE_OTHERS
})
public
PlaceGroup
buySelectedPlaces
(
EventUser
user
)
throws
BortalCatchableException
{
public
PlaceGroup
buySelectedPlaces
(
EventUser
user
)
throws
BortalCatchableException
{
...
@@ -490,7 +458,7 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -490,7 +458,7 @@ public class PlaceBean implements PlaceBeanLocal {
private
GroupMembership
buy
(
Place
p
,
PlaceGroup
pg
)
{
private
GroupMembership
buy
(
Place
p
,
PlaceGroup
pg
)
{
p
.
setGroup
(
pg
);
p
.
setGroup
(
pg
);
p
.
setReleaseTime
(
null
);
// Current user temporarily used at place reservation. When buying
// Current user temporarily used at place reservation. When buying
// release field for its original use ( show who is sitting here ).
// release field for its original use ( show who is sitting here ).
p
.
setCurrentUser
(
null
);
p
.
setCurrentUser
(
null
);
...
@@ -530,7 +498,9 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -530,7 +498,9 @@ public class PlaceBean implements PlaceBeanLocal {
return
false
;
return
false
;
}
}
place
.
setCurrentUser
(
null
);
place
.
setCurrentUser
(
null
);
place
.
setReleaseTime
(
null
);
place
.
setReserveTime
(
null
);
PlaceSlot
slot
=
placeSlotFacade
.
findSlotForPlace
(
place
);
PlaceSlot
slot
=
placeSlotFacade
.
findSlotForPlace
(
place
);
if
(
slot
!=
null
)
{
if
(
slot
!=
null
)
{
slot
.
setPlace
(
null
);
slot
.
setPlace
(
null
);
...
@@ -848,4 +818,19 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -848,4 +818,19 @@ public class PlaceBean implements PlaceBeanLocal {
List
<
Place
>
ret
=
placeFacade
.
findAllForEvent
(
event
);
List
<
Place
>
ret
=
placeFacade
.
findAllForEvent
(
event
);
return
ret
;
return
ret
;
}
}
@Override
public
boolean
isUnlockedPlaces
(
EventUser
user
)
{
List
<
Place
>
places
=
placeFacade
.
findUsersReservations
(
user
.
getEvent
(),
user
);
for
(
Place
p
:
places
)
{
if
(
p
.
isReservedFor
(
user
))
{
return
true
;
}
}
return
false
;
}
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/map/QueueBean.java
View file @
cea8225
...
@@ -5,6 +5,7 @@ import java.util.List;
...
@@ -5,6 +5,7 @@ import java.util.List;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.atomic.AtomicLong
;
import
java.util.concurrent.atomic.AtomicLong
;
import
javax.annotation.OverridingMethodsMustInvokeSuper
;
import
javax.annotation.security.DeclareRoles
;
import
javax.annotation.security.DeclareRoles
;
import
javax.annotation.security.RolesAllowed
;
import
javax.annotation.security.RolesAllowed
;
import
javax.ejb.Asynchronous
;
import
javax.ejb.Asynchronous
;
...
@@ -214,6 +215,13 @@ public class QueueBean implements QueueBeanLocal {
...
@@ -214,6 +215,13 @@ public class QueueBean implements QueueBeanLocal {
}
}
@Override
public
void
removeFromAll
(
EventUser
user
)
{
for
(
MapQueue
m
:
mapqueues
.
values
())
{
m
.
remove
(
user
);
}
}
@Lock
(
LockType
.
READ
)
@Lock
(
LockType
.
READ
)
@RolesAllowed
({
MapPermission
.
S_MANAGE_MAPS
,
MapPermission
.
S_BUY_PLACES
})
@RolesAllowed
({
MapPermission
.
S_MANAGE_MAPS
,
MapPermission
.
S_BUY_PLACES
})
@Override
@Override
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/facade/PlaceFacade.java
View file @
cea8225
...
@@ -57,38 +57,6 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
...
@@ -57,38 +57,6 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
super
(
Place
.
class
);
super
(
Place
.
class
);
}
}
public
void
timeoutPlaces
()
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
Place
>
cq
=
cb
.
createQuery
(
Place
.
class
);
Root
<
Place
>
root
=
cq
.
from
(
Place
.
class
);
cq
.
select
(
root
);
cq
.
where
(
cb
.
lessThan
(
root
.
get
(
Place_
.
releaseTime
),
Calendar
.
getInstance
()),
cb
.
isNull
(
root
.
get
(
Place_
.
group
)));
TypedQuery
<
Place
>
q
=
getEm
().
createQuery
(
cq
);
int
updated
=
0
;
for
(
Place
p
:
q
.
getResultList
())
{
logger
.
debug
(
"Releasing place {} at automagic timed place check."
,
p
);
final
EventUser
cu
=
p
.
getCurrentUser
();
if
(
p
.
checkReleased
())
{
PlaceSlot
slot
=
placeslotfacade
.
findSlotForPlace
(
p
);
if
(
slot
!=
null
)
{
slot
.
setPlace
(
null
);
slot
.
setUsed
(
null
);
}
logbean
.
sendMessage
(
MoyaEventType
.
PLACE_ERROR
,
cu
,
"Automatically release unlocked place "
,
p
.
getName
());
++
updated
;
}
}
if
(
updated
>
0
)
{
logger
.
info
(
"{} places released for sale after release time exceeded."
,
updated
);
}
}
public
List
<
Place
>
findUsersReservations
(
LanEvent
event
,
EventUser
user
)
{
public
List
<
Place
>
findUsersReservations
(
LanEvent
event
,
EventUser
user
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
...
@@ -191,7 +159,7 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
...
@@ -191,7 +159,7 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
cq
.
where
(
cq
.
where
(
cb
.
equal
(
root
.
get
(
Place_
.
product
),
product
),
cb
.
equal
(
root
.
get
(
Place_
.
product
),
product
),
cb
.
isNull
(
root
.
get
(
Place_
.
re
leas
eTime
)),
cb
.
isNull
(
root
.
get
(
Place_
.
re
serv
eTime
)),
cb
.
isNull
(
root
.
get
(
Place_
.
group
)),
cb
.
isNull
(
root
.
get
(
Place_
.
group
)),
cb
.
isFalse
(
root
.
get
(
Place_
.
disabled
)),
cb
.
isFalse
(
root
.
get
(
Place_
.
disabled
)),
cb
.
isTrue
(
root
.
get
(
Place_
.
buyable
))
cb
.
isTrue
(
root
.
get
(
Place_
.
buyable
))
...
@@ -247,7 +215,7 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
...
@@ -247,7 +215,7 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
cq
.
where
(
cq
.
where
(
cb
.
equal
(
root
.
get
(
Place_
.
map
),
map
),
cb
.
equal
(
root
.
get
(
Place_
.
map
),
map
),
cb
.
isNull
(
root
.
get
(
Place_
.
re
leas
eTime
)),
cb
.
isNull
(
root
.
get
(
Place_
.
re
serv
eTime
)),
cb
.
isNull
(
root
.
get
(
Place_
.
group
)),
cb
.
isNull
(
root
.
get
(
Place_
.
group
)),
cb
.
isFalse
(
root
.
get
(
Place_
.
disabled
)),
cb
.
isFalse
(
root
.
get
(
Place_
.
disabled
)),
// TKwtf lisäsi:
// TKwtf lisäsi:
...
...
code/moya-database/src/main/java/fi/codecrew/moya/model/Place.java
View file @
cea8225
...
@@ -18,24 +18,12 @@
...
@@ -18,24 +18,12 @@
*/
*/
package
fi
.
codecrew
.
moya
.
model
;
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.Calendar
;
import
fi.codecrew.moya.utilities.NumericStringComparator
;
import
javax.persistence.CascadeType
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.OneToOne
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
javax.persistence.Transient
;
import
org.eclipse.persistence.annotations.BatchFetch
;
import
org.eclipse.persistence.annotations.BatchFetch
;
import
org.eclipse.persistence.annotations.BatchFetchType
;
import
org.eclipse.persistence.annotations.BatchFetchType
;
import
fi.codecrew.moya.utilities.NumericStringComparator
;
import
javax.persistence.*
;
import
java.util.Calendar
;
/**
/**
*
*
...
@@ -62,9 +50,9 @@ public class Place extends GenericEntity implements Comparable<Place> {
...
@@ -62,9 +50,9 @@ public class Place extends GenericEntity implements Comparable<Place> {
private
int
width
=
0
;
private
int
width
=
0
;
@Column
(
name
=
"height"
)
@Column
(
name
=
"height"
)
private
int
height
=
0
;
private
int
height
=
0
;
@Column
(
name
=
"re
leas
e_time"
)
@Column
(
name
=
"re
serv
e_time"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
re
leas
eTime
;
private
Calendar
re
serv
eTime
;
@Column
(
name
=
"place_details"
)
@Column
(
name
=
"place_details"
)
@Lob
@Lob
private
String
details
=
""
;
private
String
details
=
""
;
...
@@ -293,7 +281,7 @@ public class Place extends GenericEntity implements Comparable<Place> {
...
@@ -293,7 +281,7 @@ public class Place extends GenericEntity implements Comparable<Place> {
public
boolean
isTaken
()
{
public
boolean
isTaken
()
{
return
(
getRe
leas
eTime
()
!=
null
||
getGroup
()
!=
null
);
return
(
getRe
serv
eTime
()
!=
null
||
getGroup
()
!=
null
);
}
}
/**
/**
...
@@ -304,22 +292,6 @@ public class Place extends GenericEntity implements Comparable<Place> {
...
@@ -304,22 +292,6 @@ public class Place extends GenericEntity implements Comparable<Place> {
return
(
u
.
equals
(
getCurrentUser
())
&&
getGroup
()
==
null
);
return
(
u
.
equals
(
getCurrentUser
())
&&
getGroup
()
==
null
);
}
}
/**
* Check if the places releasetime has expired and it should be released for
* shopping
*
* @return If the status of thie entity changed and it should be merged.
*/
public
boolean
checkReleased
()
{
boolean
ret
=
false
;
if
(
getGroup
()
==
null
&&
getReleaseTime
()
!=
null
&&
Calendar
.
getInstance
().
after
(
getReleaseTime
()))
{
setCurrentUser
(
null
);
setReleaseTime
(
null
);
ret
=
true
;
}
return
ret
;
}
public
void
setBuyable
(
boolean
buyable
)
{
public
void
setBuyable
(
boolean
buyable
)
{
this
.
buyable
=
buyable
;
this
.
buyable
=
buyable
;
}
}
...
@@ -341,14 +313,6 @@ public class Place extends GenericEntity implements Comparable<Place> {
...
@@ -341,14 +313,6 @@ public class Place extends GenericEntity implements Comparable<Place> {
this
.
reserverSlot
=
reserverSlot
;
this
.
reserverSlot
=
reserverSlot
;
}
}
public
void
setReleaseTime
(
Calendar
releaseTime
)
{
this
.
releaseTime
=
releaseTime
;
}
public
Calendar
getReleaseTime
()
{
return
releaseTime
;
}
public
void
setProvidesRole
(
Role
providesRole
)
{
public
void
setProvidesRole
(
Role
providesRole
)
{
this
.
providesRole
=
providesRole
;
this
.
providesRole
=
providesRole
;
}
}
...
@@ -396,4 +360,13 @@ public class Place extends GenericEntity implements Comparable<Place> {
...
@@ -396,4 +360,13 @@ public class Place extends GenericEntity implements Comparable<Place> {
return
NumericStringComparator
.
numericCompare
(
this
.
getName
(),
o
.
getName
());
return
NumericStringComparator
.
numericCompare
(
this
.
getName
(),
o
.
getName
());
}
}
public
Calendar
getReserveTime
()
{
return
reserveTime
;
}
public
void
setReserveTime
(
Calendar
reserveTime
)
{
this
.
reserveTime
=
reserveTime
;
}
}
}
code/moya-web/WebContent/bill/list.xhtml
View file @
cea8225
...
@@ -95,7 +95,7 @@
...
@@ -95,7 +95,7 @@
<p:outputPanel
rendered=
"#{placeGroupView.useEticket}"
>
<p:outputPanel
rendered=
"#{placeGroupView.useEticket}"
>
<p>
<p>
<p:button
outcome=
"/place/my
Eticket
s"
value=
"#{i18n['placegroup.showEticket']}"
/>
<p:button
outcome=
"/place/my
Group
s"
value=
"#{i18n['placegroup.showEticket']}"
/>
</p>
</p>
</p:outputPanel>
</p:outputPanel>
...
...
code/moya-web/WebContent/place/myGroups.xhtml
View file @
cea8225
...
@@ -16,6 +16,15 @@
...
@@ -16,6 +16,15 @@
<ui:define
name=
"content"
>
<ui:define
name=
"content"
>
<h:outputText
rendered=
"#{placeGroupView.groupMemberships.rowCount == 0}"
value=
"#{i18n['placegroupview.noMemberships']}"
/>
<h:outputText
rendered=
"#{placeGroupView.groupMemberships.rowCount == 0}"
value=
"#{i18n['placegroupview.noMemberships']}"
/>
<p:outputPanel
rendered=
"#{placeGroupView.unlockedPlaces}"
>
<span
class=
"error"
><h:outputText
value=
"#{i18n['placegroupview.unlockedPlacesNotification']}"
/></span><br
/><br
/>
<p:commandButton
value=
"#{i18n['placegroupview.lockPlaces']}"
actionListener=
"#{placeGroupView.buySelectedPlaces}"
/><br
/><br
/><br
/>
</p:outputPanel>
<h:form
rendered=
"#{placeGroupView.groupMemberships.rowCount > 0}"
id=
"placelistform"
styleClass=
"moya_datatable2"
>
<h:form
rendered=
"#{placeGroupView.groupMemberships.rowCount > 0}"
id=
"placelistform"
styleClass=
"moya_datatable2"
>
<p:dataTable
value=
"#{placeGroupView.groupMemberships}"
var=
"member"
id=
"placestable"
>
<p:dataTable
value=
"#{placeGroupView.groupMemberships}"
var=
"member"
id=
"placestable"
>
...
@@ -90,7 +99,7 @@
...
@@ -90,7 +99,7 @@
<p:outputPanel
rendered=
"#{placeGroupView.useEticket}"
>
<p:outputPanel
rendered=
"#{placeGroupView.useEticket}"
>
<p>
<p>
<p:button
outcome=
"/place/myEtickets"
value=
"#{i18n['placegroup.showEticket']}"
/>
<p:button
rendered=
"#{not placeGroupView.unlockedPlaces}"
outcome=
"/place/myEtickets"
value=
"#{i18n['placegroup.showEticket']}"
/>
</p>
</p>
</p:outputPanel>
</p:outputPanel>
...
...
code/moya-web/WebContent/place/unlockedPlaces.xhtml
View file @
cea8225
...
@@ -30,8 +30,7 @@
...
@@ -30,8 +30,7 @@
<h:form>
<h:form>
<p:dataTable
var=
"pc"
value=
"#{unlockedPlaceView.places}"
>
<p:dataTable
var=
"pc"
value=
"#{unlockedPlaceView.places}"
>
<p:column>
<p:column>
<h:outputText
<h:outputText
value=
"#{pc.user.user.login} #{pc.user.user.wholeName}"
/>
value=
"#{pc.user.user.login} #{pc.user.user.wholeName}"
/>
</p:column>
</p:column>
<p:column>
<p:column>
<p:dataTable
var=
"p"
value=
"#{pc.places}"
>
<p:dataTable
var=
"p"
value=
"#{pc.places}"
>
...
@@ -46,8 +45,7 @@
...
@@ -46,8 +45,7 @@
</p:dataTable>
</p:dataTable>
</p:column>
</p:column>
<p:column>
<p:column>
<p:commandButton
ajax=
"false"
value=
"#{i18n['placegroup.lock']}"
<p:commandButton
ajax=
"false"
value=
"#{i18n['placegroup.lock']}"
action=
"#{unlockedPlaceView.lockUser()}"
/>
action=
"#{unlockedPlaceView.lockUser()}"
/>
</p:column>
</p:column>
</p:dataTable>
</p:dataTable>
</h:form>
</h:form>
...
...
code/moya-web/WebContent/resources/seatjs/seatmap.js
View file @
cea8225
...
@@ -404,7 +404,7 @@ function placemap(opts)
...
@@ -404,7 +404,7 @@ function placemap(opts)
.
header
(
"Content-Type"
,
"application/json"
)
.
header
(
"Content-Type"
,
"application/json"
)
.
post
(
.
post
(
JSON
.
stringify
({}),
JSON
.
stringify
({}),
function
(
err
,
rawData
){
function
(
err
,
rawData
)
{
console
.
log
(
rawData
);
console
.
log
(
rawData
);
var
data
=
JSON
.
parse
(
rawData
.
response
);
var
data
=
JSON
.
parse
(
rawData
.
response
);
draw_places
(
data
.
places
);
draw_places
(
data
.
places
);
...
...
code/moya-web/src/main/java/fi/codecrew/moya/rest/PojoUtils.java
View file @
cea8225
...
@@ -2,6 +2,7 @@ package fi.codecrew.moya.rest;
...
@@ -2,6 +2,7 @@ package fi.codecrew.moya.rest;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.List
;
import
java.util.List
;
import
fi.codecrew.moya.model.*
;
import
fi.codecrew.moya.model.*
;
...
@@ -94,8 +95,22 @@ public class PojoUtils {
...
@@ -94,8 +95,22 @@ public class PojoUtils {
ret
.
setWidth
(
place
.
getWidth
());
ret
.
setWidth
(
place
.
getWidth
());
ret
.
setTaken
(
place
.
isTaken
());
ret
.
setTaken
(
place
.
isTaken
());
ret
.
setBuyable
(
place
.
isBuyable
());
ret
.
setBuyable
(
place
.
isBuyable
());
ret
.
setReleaseTime
(
place
.
getReleaseTime
());
ret
.
setDisabled
(
place
.
isDisabled
());
ret
.
setDisabled
(
place
.
isDisabled
());
// I cannot change REST -api without making new version, so let's simulate this ReleaseTime -feature from reserveTime
Calendar
relTime
=
Calendar
.
getInstance
();
relTime
.
add
(
relTime
.
HOUR
,
4
);
if
(
place
.
getReserveTime
()
!=
null
)
ret
.
setReleaseTime
(
relTime
);
else
ret
.
setReleaseTime
(
null
);
if
(
place
.
getMap
()
!=
null
)
{
if
(
place
.
getMap
()
!=
null
)
{
ret
.
setMapId
(
place
.
getMap
().
getId
());
ret
.
setMapId
(
place
.
getMap
().
getId
());
}
}
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/MapManageView.java
View file @
cea8225
...
@@ -217,7 +217,7 @@ public class MapManageView extends GenericCDIView {
...
@@ -217,7 +217,7 @@ public class MapManageView extends GenericCDIView {
List
<
Place
>
mapplaces
=
map
.
getPlaces
();
List
<
Place
>
mapplaces
=
map
.
getPlaces
();
if
(
mapplaces
==
null
||
mapplaces
.
isEmpty
())
{
if
(
mapplaces
==
null
||
mapplaces
.
isEmpty
())
{
mapplaces
=
new
ArrayList
<
Place
>();
mapplaces
=
new
ArrayList
<>();
map
.
setPlaces
(
mapplaces
);
map
.
setPlaces
(
mapplaces
);
}
}
for
(
int
tableI
=
0
;
tableI
<
tableCount
;
++
tableI
)
{
for
(
int
tableI
=
0
;
tableI
<
tableCount
;
++
tableI
)
{
...
@@ -235,8 +235,8 @@ public class MapManageView extends GenericCDIView {
...
@@ -235,8 +235,8 @@ public class MapManageView extends GenericCDIView {
Place
place
=
new
Place
(
map
);
Place
place
=
new
Place
(
map
);
place
.
setHeight
(
Math
.
abs
(
height
));
place
.
setHeight
(
Math
.
abs
(
height
));
place
.
setWidth
(
Math
.
abs
(
width
));
place
.
setWidth
(
Math
.
abs
(
width
));
int
xpos
=
startX
+
rowXStart
+
(
tablesHorizontal
?
placeI
*
width
:
0
);
int
xpos
=
startX
+
rowXStart
+
(
tablesHorizontal
?
(
placeI
-
1
)
*
width
:
0
);
int
ypos
=
startY
+
rowYStart
+
(
tablesHorizontal
?
0
:
placeI
*
height
);
int
ypos
=
startY
+
rowYStart
+
(
tablesHorizontal
?
0
:
(
placeI
-
1
)
*
height
);
logger
.
debug
(
"Creating map in {} {}"
,
xpos
,
ypos
);
logger
.
debug
(
"Creating map in {} {}"
,
xpos
,
ypos
);
place
.
setMapX
(
xpos
);
place
.
setMapX
(
xpos
);
place
.
setMapY
(
ypos
);
place
.
setMapY
(
ypos
);
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/PlacegroupView.java
View file @
cea8225
...
@@ -18,10 +18,7 @@
...
@@ -18,10 +18,7 @@
*/
*/
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
map
;
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
map
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.ConversationScoped
;
...
@@ -30,6 +27,7 @@ import javax.inject.Inject;
...
@@ -30,6 +27,7 @@ import javax.inject.Inject;
import
javax.inject.Named
;
import
javax.inject.Named
;
import
fi.codecrew.moya.beans.*
;
import
fi.codecrew.moya.beans.*
;
import
fi.codecrew.moya.beans.map.QueueBeanLocal
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.model.*
;
import
fi.codecrew.moya.model.*
;
import
fi.codecrew.moya.web.annotations.SelectedUser
;
import
fi.codecrew.moya.web.annotations.SelectedUser
;
...
@@ -62,6 +60,12 @@ public class PlacegroupView extends GenericCDIView {
...
@@ -62,6 +60,12 @@ public class PlacegroupView extends GenericCDIView {
@EJB
@EJB
private
EventBeanLocal
eventBean
;
private
EventBeanLocal
eventBean
;
@EJB
private
PlaceBeanLocal
placeBean
;
@EJB
private
QueueBeanLocal
queueBean
;
@Inject
@Inject
private
InviteView
inviteView
;
private
InviteView
inviteView
;
...
@@ -341,6 +345,21 @@ public class PlacegroupView extends GenericCDIView {
...
@@ -341,6 +345,21 @@ public class PlacegroupView extends GenericCDIView {
public
boolean
isUnlockedPlaces
()
{
return
placeBean
.
isUnlockedPlaces
(
user
);
}
public
void
buySelectedPlaces
()
{
placeBean
.
buySelectedPlaces
(
user
);
queueBean
.
removeFromAll
(
user
);
// lost of stuff changed, reload page
super
.
navihandler
.
forward
(
"/place/myGroups?faces-redirect=true"
);
}
}
}
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/UnlockedPlaceView.java
View file @
cea8225
...
@@ -93,7 +93,7 @@ public class UnlockedPlaceView extends GenericCDIView {
...
@@ -93,7 +93,7 @@ public class UnlockedPlaceView extends GenericCDIView {
mapId
=
map
.
getId
();
mapId
=
map
.
getId
();
for
(
Place
p
:
map
.
getPlaces
())
{
for
(
Place
p
:
map
.
getPlaces
())
{
if
(
p
.
getRe
leas
eTime
()
!=
null
)
{
if
(
p
.
getRe
serv
eTime
()
!=
null
)
{
UnlockedPlaceContainer
uc
=
usermap
.
get
(
p
.
getCurrentUser
());
UnlockedPlaceContainer
uc
=
usermap
.
get
(
p
.
getCurrentUser
());
if
(
uc
==
null
)
{
if
(
uc
==
null
)
{
uc
=
new
UnlockedPlaceContainer
(
p
.
getCurrentUser
());
uc
=
new
UnlockedPlaceContainer
(
p
.
getCurrentUser
());
...
...
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n.properties
View file @
cea8225
...
@@ -762,6 +762,7 @@ placegroupView.editplace = Edit place
...
@@ -762,6 +762,7 @@ placegroupView.editplace = Edit place
placegroupview.groupCreator
=
Orderer
placegroupview.groupCreator
=
Orderer
placegroupview.header
=
My places
placegroupview.header
=
My places
placegroupview.lockPlaces
=
Lock places
placegroupview.noMemberships
=
No places
placegroupview.noMemberships
=
No places
placegroupview.owner
=
Owner
placegroupview.owner
=
Owner
placegroupview.placeReleaseFailed
=
Releasing place failed!
placegroupview.placeReleaseFailed
=
Releasing place failed!
...
@@ -774,6 +775,7 @@ placegroupview.reserveForSelf = Select the place for yourself
...
@@ -774,6 +775,7 @@ placegroupview.reserveForSelf = Select the place for yourself
placegroupview.token
=
Place token / user
placegroupview.token
=
Place token / user
placegroupview.toptext
=
\
placegroupview.toptext
=
\
placegroupview.unlockedPlacesNotification
=
You have unlocked places, you must lock them before you can see your tickets
\!
placeslot.add
=
Add place slot
placeslot.add
=
Add place slot
placeslot.bill
=
Bill
placeslot.bill
=
Bill
placeslot.id
=
ID
placeslot.id
=
ID
...
...
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_en.properties
View file @
cea8225
...
@@ -1021,6 +1021,7 @@ placegroupView.editplace = Edit place
...
@@ -1021,6 +1021,7 @@ placegroupView.editplace = Edit place
placegroupview.groupCreator
=
Orderer
placegroupview.groupCreator
=
Orderer
placegroupview.header
=
My places
placegroupview.header
=
My places
placegroupview.lockPlaces
=
Lock places
placegroupview.noMemberships
=
No places
placegroupview.noMemberships
=
No places
placegroupview.owner
=
Owner
placegroupview.owner
=
Owner
placegroupview.placeReleaseFailed
=
Releasing place failed!
placegroupview.placeReleaseFailed
=
Releasing place failed!
...
@@ -1032,6 +1033,7 @@ placegroupview.reservationProduct = Ticket
...
@@ -1032,6 +1033,7 @@ placegroupview.reservationProduct = Ticket
placegroupview.reserveForSelf
=
Select the place for yourself
placegroupview.reserveForSelf
=
Select the place for yourself
placegroupview.token
=
Place token / user
placegroupview.token
=
Place token / user
placegroupview.unlockedPlacesNotification
=
You have unlocked places, you must lock them before you can see your tickets
\!
placeslot.add
=
Add place slot
placeslot.add
=
Add place slot
placeslot.bill
=
Bill
placeslot.bill
=
Bill
placeslot.id
=
ID
placeslot.id
=
ID
...
...
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_fi.properties
View file @
cea8225
...
@@ -1008,6 +1008,7 @@ placegroupView.editplace = Muokkaa paikkaa
...
@@ -1008,6 +1008,7 @@ placegroupView.editplace = Muokkaa paikkaa
placegroupview.groupCreator
=
Tilaaja
placegroupview.groupCreator
=
Tilaaja
placegroupview.header
=
Omat paikat
placegroupview.header
=
Omat paikat
placegroupview.lockPlaces
=
Lukitse paikat
placegroupview.noMemberships
=
Ei omia paikkoja
placegroupview.noMemberships
=
Ei omia paikkoja
placegroupview.owner
=
Omistaja
placegroupview.owner
=
Omistaja
placegroupview.placeReleaseFailed
=
Paikan vapauttaminen ep
\u
00E4onnistui!
placegroupview.placeReleaseFailed
=
Paikan vapauttaminen ep
\u
00E4onnistui!
...
@@ -1019,6 +1020,7 @@ placegroupview.reservationProduct = Lippu
...
@@ -1019,6 +1020,7 @@ placegroupview.reservationProduct = Lippu
placegroupview.reserveForSelf
=
Valitse paikka itsellesi
placegroupview.reserveForSelf
=
Valitse paikka itsellesi
placegroupview.token
=
Paikkakoodi / k
\u
00E4ytt
\u
00E4j
\u
00E4
placegroupview.token
=
Paikkakoodi / k
\u
00E4ytt
\u
00E4j
\u
00E4
placegroupview.unlockedPlacesNotification
=
Sinulla on lukitsemattomia paikkoja, sinun tulee lukita ne ennenkuin voit tarkastella lippuasi
\!
placeslot.add
=
Lis
\u
00E4
\u
00E4 paikkaslotti
placeslot.add
=
Lis
\u
00E4
\u
00E4 paikkaslotti
placeslot.bill
=
Lasku
placeslot.bill
=
Lasku
placeslot.id
=
ID
placeslot.id
=
ID
...
...
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