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 417092e2
authored
Nov 08, 2014
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Place slot facade implementations
1 parent
9c338a42
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
4 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PlaceBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/facade/EventMapFacade.java
code/moya-beans/ejbModule/fi/codecrew/moya/facade/PlaceSlotFacade.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/PlaceBeanLocal.java
View file @
417092e
...
@@ -65,8 +65,10 @@ public interface PlaceBeanLocal {
...
@@ -65,8 +65,10 @@ public interface PlaceBeanLocal {
Place
unbuyPlace
(
Place
place
);
Place
unbuyPlace
(
Place
place
);
@Deprecated
BigDecimal
getTotalReservationPrice
(
EventUser
user
,
Place
newPlace
);
BigDecimal
getTotalReservationPrice
(
EventUser
user
,
Place
newPlace
);
@Deprecated
BigDecimal
getTotalReservationPrice
(
Place
newPlace
);
BigDecimal
getTotalReservationPrice
(
Place
newPlace
);
/**
/**
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
View file @
417092e
...
@@ -706,7 +706,7 @@ public class PlaceBean implements PlaceBeanLocal {
...
@@ -706,7 +706,7 @@ public class PlaceBean implements PlaceBeanLocal {
if
(!
permbean
.
isCurrentUser
(
user
)
&&
!
permbean
.
hasPermission
(
MapPermission
.
MANAGE_OTHERS
))
if
(!
permbean
.
isCurrentUser
(
user
)
&&
!
permbean
.
hasPermission
(
MapPermission
.
MANAGE_OTHERS
))
throw
new
EJBAccessException
(
"User "
+
permbean
.
getCurrentUser
()
+
"tried to fetch free places for user "
+
user
);
throw
new
EJBAccessException
(
"User "
+
permbean
.
getCurrentUser
()
+
"tried to fetch free places for user "
+
user
);
return
placeSlotFacade
.
findFreePlaces
(
user
);
return
placeSlotFacade
.
findFreePlace
Slot
s
(
user
);
}
}
@Override
@Override
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/facade/EventMapFacade.java
View file @
417092e
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
fi
.
codecrew
.
moya
.
facade
;
package
fi
.
codecrew
.
moya
.
facade
;
import
java.util.List
;
import
java.util.List
;
import
javax.ejb.EJBAccessException
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.ejb.LocalBean
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
...
@@ -50,5 +50,19 @@ public class EventMapFacade extends IntegerPkGenericFacade<EventMap> {
...
@@ -50,5 +50,19 @@ public class EventMapFacade extends IntegerPkGenericFacade<EventMap> {
cq
.
where
(
cb
.
equal
(
root
.
get
(
EventMap_
.
event
),
eventbean
.
getCurrentEvent
()),
cq
.
where
(
cb
.
equal
(
root
.
get
(
EventMap_
.
event
),
eventbean
.
getCurrentEvent
()),
cb
.
isTrue
(
root
.
get
(
EventMap_
.
active
)));
cb
.
isTrue
(
root
.
get
(
EventMap_
.
active
)));
return
getEm
().
createQuery
(
cq
).
getResultList
();
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
return
ret
;
}
@Override
public
EventMap
find
(
Integer
id
)
{
EventMap
ret
=
super
.
find
(
id
);
if
(
ret
!=
null
&&
!
ret
.
getEvent
().
equals
(
eventbean
.
getCurrentEvent
()))
{
throw
new
EJBAccessException
(
"Trying to find map from wrong event!"
);
}
return
ret
;
}
}
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/facade/PlaceSlotFacade.java
View file @
417092e
...
@@ -64,8 +64,11 @@ public class PlaceSlotFacade extends IntegerPkGenericFacade<Place> {
...
@@ -64,8 +64,11 @@ public class PlaceSlotFacade extends IntegerPkGenericFacade<Place> {
CriteriaQuery
<
PlaceSlot
>
q
=
cb
.
createQuery
(
PlaceSlot
.
class
);
CriteriaQuery
<
PlaceSlot
>
q
=
cb
.
createQuery
(
PlaceSlot
.
class
);
Root
<
PlaceSlot
>
root
=
q
.
from
(
PlaceSlot
.
class
);
Root
<
PlaceSlot
>
root
=
q
.
from
(
PlaceSlot
.
class
);
Path
<
Bill
>
bill
=
root
.
get
(
PlaceSlot_
.
bill
);
Path
<
Bill
>
bill
=
root
.
get
(
PlaceSlot_
.
bill
);
q
.
where
(
cb
.(
bill
.
get
(
Bill_
.
accountEvent
))
q
.
where
(
cb
.
equal
(
bill
.
get
(
Bill_
.
user
),
user
),
cb
.
isNotNull
(
bill
.
get
(
Bill_
.
paidDate
)),
cb
.
isNull
(
root
.
get
(
PlaceSlot_
.
used
))
);
return
getEm
().
createQuery
(
q
).
getResultList
();
}
}
// private List<PlaceSlot> getSlotsForUser(EventUser u) {
// private List<PlaceSlot> getSlotsForUser(EventUser u) {
//
//
...
...
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