Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 923d4f4f
authored
Dec 13, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically release slot when place is released by timeout
1 parent
a680baac
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/facade/PlaceFacade.java
code/moya-beans/ejbModule/fi/codecrew/moya/facade/PlaceFacade.java
View file @
923d4f4
...
...
@@ -40,6 +40,7 @@ import fi.codecrew.moya.model.EventMap_;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.LanEvent
;
import
fi.codecrew.moya.model.Place
;
import
fi.codecrew.moya.model.PlaceSlot
;
import
fi.codecrew.moya.model.Place_
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.model.Product_
;
...
...
@@ -51,7 +52,10 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
PlaceFacade
.
class
);
@EJB
EventBeanLocal
eventBean
;
private
EventBeanLocal
eventBean
;
@EJB
private
PlaceSlotFacade
placeslotfacade
;
public
PlaceFacade
()
{
...
...
@@ -74,6 +78,12 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
for
(
Place
p
:
q
.
getResultList
())
{
logger
.
debug
(
"Releasing place {} at automagic timed place check."
,
p
);
if
(
p
.
checkReleased
())
{
PlaceSlot
slot
=
placeslotfacade
.
findSlotForPlace
(
p
);
if
(
slot
!=
null
)
{
slot
.
setPlace
(
null
);
slot
.
setUsed
(
null
);
}
++
updated
;
}
}
...
...
@@ -173,10 +183,6 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
return
super
.
getSingleNullableResult
(
getEm
().
createQuery
(
cq
));
}
public
Long
findCountForProduct
(
Product
product
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
Long
>
cq
=
cb
.
createQuery
(
Long
.
class
);
...
...
@@ -190,10 +196,6 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
return
super
.
getSingleNullableResult
(
getEm
().
createQuery
(
cq
));
}
public
Long
countAvailable
(
EventMap
map
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
Long
>
cq
=
cb
.
createQuery
(
Long
.
class
);
...
...
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