Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 980ef3d9
authored
Mar 01, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #21 , Admin voi varata nyt lukitun paikan
1 parent
49e5e369
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
View file @
980ef3d
...
@@ -182,7 +182,8 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -182,7 +182,8 @@ public class PlaceBean implements PlaceBeanLocal {
}
}
/**
/**
* Reserve the place for user. This reservation will timeout after a while buy() method should be called after this when buying place;
* Reserve the place for user. This reservation will timeout after a while
* buy() method should be called after this when buying place;
*
*
* @param place
* @param place
* place to be reserved
* place to be reserved
...
@@ -196,24 +197,31 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -196,24 +197,31 @@ public class PlaceBean implements PlaceBeanLocal {
place
=
placeFacade
.
find
(
place
.
getId
());
place
=
placeFacade
.
find
(
place
.
getId
());
user
=
eventUserFacade
.
find
(
user
.
getId
());
user
=
eventUserFacade
.
find
(
user
.
getId
());
boolean
ret
=
false
;
boolean
ret
=
false
;
if
(
place
.
isBuyable
()
&&
!
place
.
isTaken
())
{
if
(!
place
.
isTaken
())
{
place
.
setCurrentUser
(
user
);
if
(
place
.
isBuyable
()
||
permbean
.
hasPermission
(
MapPermission
.
MANAGE_OTHERS
))
{
place
.
setReleaseTime
(
Calendar
.
getInstance
());
place
.
getReleaseTime
().
add
(
Calendar
.
MINUTE
,
RESERVE_MINUTES
);
if
(!
place
.
isBuyable
())
{
place
.
setBuyable
(
true
);
// 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
;
}
}
place
.
setCurrentUser
(
user
);
place
.
setReleaseTime
(
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
;
}
}
if
(!
foundTimeout
)
{
logger
.
info
(
"Place timeout calculator not started. Starting new."
);
ts
.
createTimer
(
new
Date
(),
1000
*
60
,
PLACE_RESERVE_TIMEOUTER
);
}
ret
=
true
;
}
}
if
(!
foundTimeout
)
{
logger
.
info
(
"Place timeout calculator not started. Starting new."
);
ts
.
createTimer
(
new
Date
(),
1000
*
60
,
PLACE_RESERVE_TIMEOUTER
);
}
ret
=
true
;
}
}
return
ret
;
return
ret
;
}
}
...
...
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