Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 312eff24
authored
Jul 18, 2010
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added per event object counter to EventChildGenericFacade. Created some placemap required functions
1 parent
8fab60f7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
8 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceMapBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventChildGenericFacade.java
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PlaceMapBeanLocal.java
code/LanBortalWeb/WebContent/resources/tools/map/placeSelect.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/view/MapView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceMapBean.java
View file @
312eff2
...
...
@@ -138,7 +138,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
return
"/PlaceMap"
+
parameters
;
}
public
int
selectablePlaceCount
(
User
user
,
Event
currentEvent
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
public
long
selectablePlaceCount
(
User
user
,
Event
currentEvent
)
{
return
placeFacade
.
count
(
currentEvent
);
}
}
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventChildGenericFacade.java
View file @
312eff2
package
fi
.
insomnia
.
bortal
.
facade
;
import
javax.persistence.TypedQuery
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.model.Event
;
import
fi.insomnia.bortal.model.EventChildInterface
;
import
fi.insomnia.bortal.model.EventPk
;
...
...
@@ -17,14 +23,25 @@ public abstract class EventChildGenericFacade<T extends EventChildInterface> ext
}
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventChildGenericFacade
.
class
);
public
T
find
(
Integer
eventId
,
Integer
id
)
{
EventPk
pk
=
new
EventPk
(
eventId
);
pk
.
setId
(
id
);
logger
.
debug
(
"Fetching object {} with key {}"
,
this
.
getEntityClass
(),
pk
);
return
find
(
pk
);
}
public
long
count
(
Event
e
)
{
CriteriaBuilder
builder
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
Long
>
query
=
builder
.
createQuery
(
Long
.
class
);
Root
<
T
>
entity
=
query
.
from
(
getEntityClass
());
query
.
where
(
builder
.
equal
(
entity
.
get
(
"id"
).
get
(
"eventId"
),
e
.
getId
())).
select
(
getEm
().
getCriteriaBuilder
().
count
(
entity
));
TypedQuery
<
Long
>
q
=
getEm
().
createQuery
(
query
);
return
q
.
getSingleResult
();
}
}
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/beans/PlaceMapBeanLocal.java
View file @
312eff2
...
...
@@ -21,7 +21,7 @@ public interface PlaceMapBeanLocal {
void
printPlaceMapToStream
(
OutputStream
outputStream
,
String
filetype
,
Event
event
,
Integer
mapId
,
List
<
Integer
>
placeIds
)
throws
EjbPermissionDeniedException
,
IOException
;
public
String
getSelectPlaceMapUrl
(
EventMap
activeMap
,
List
<
Place
>
selectedPlaces
,
User
user
);
public
int
selectablePlaceCount
(
User
user
,
Event
currentEvent
);
public
long
selectablePlaceCount
(
User
user
,
Event
currentEvent
);
// public EventMap findMap(int i);
...
...
code/LanBortalWeb/WebContent/resources/tools/map/placeSelect.xhtml
View file @
312eff2
...
...
@@ -19,7 +19,7 @@
<h:form>
<h:commandButton
image=
"#{mapView.selectPlaceMapUrl}"
actionListener=
"#{mapView.placeSelectActionListener}"
/>
<h:outputText
value=
"#{i18n['placeSelect.left']}: #{mapView.placeLeftToSelect}"
/>
<h:outputText
value=
"#{i18n['placeSelect.left']}: #{mapView.placeLeftToSelect
()
}"
/>
</h:form>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/view/MapView.java
View file @
312eff2
...
...
@@ -126,7 +126,7 @@ public class MapView {
}
public
String
placeLeftToSelect
()
{
int
totalPlaces
=
placeMapBean
.
selectablePlaceCount
(
sessionHandler
.
getUser
(),
sessionHandler
.
getCurrentEvent
());
long
totalPlaces
=
placeMapBean
.
selectablePlaceCount
(
sessionHandler
.
getUser
(),
sessionHandler
.
getCurrentEvent
());
return
(
totalPlaces
-
selectedPlaces
.
size
())
+
""
;
}
...
...
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