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 9c91723f
authored
May 09, 2010
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.intra.insomnia.fi:/data/bortal
2 parents
d118aa2d
90f3a3b1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
16 deletions
code/LanBortalAuthModule.jar
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/JaasBean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceMapBean.java
code/LanBortalBeansClient/.classpath
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/enums/Role.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventMap.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Place.java
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/PlaceMap.java
code/LanBortalAuthModule.jar
View file @
9c91723
No preview for this file type
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/JaasBean.java
View file @
9c91723
...
...
@@ -9,6 +9,7 @@ import javax.ejb.Stateless;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.enums.Role
;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.model.User
;
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceMapBean.java
View file @
9c91723
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.awt.Graphics
;
import
java.awt.image.BufferedImage
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.Date
;
import
java.util.List
;
import
javax.ejb.EJB
;
...
...
@@ -37,6 +39,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
public
PlaceMapBean
()
{
// TODO Auto-generated constructor stub
}
@EJB
private
PlaceFacade
placeFacade
;
@EJB
...
...
@@ -46,6 +49,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
@Override
public
void
printPlaceMapToStream
(
OutputStream
outputStream
,
String
filetype
,
Event
event
,
Integer
mapId
,
Integer
userId
,
List
<
Integer
>
placeIds
)
throws
IOException
{
long
begin
=
new
Date
().
getTime
();
Integer
eventId
=
event
.
getId
();
List
<
Place
>
selectedPlaceList
=
new
ArrayList
<
Place
>();
...
...
@@ -55,7 +59,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
selectedPlaceList
.
add
(
placeFacade
.
find
(
eventId
,
id
));
}
logger
.
info
(
"Got
event {}, mapid {}"
,
event
,
mapId
);
logger
.
info
(
"Got
mapid {}, time {}"
,
mapId
,
new
Date
().
getTime
()
-
begin
);
if
(
selectedPlaceList
.
size
()
>
0
)
{
map
=
selectedPlaceList
.
get
(
0
).
getMap
();
...
...
@@ -65,11 +69,9 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
List
<
Place
>
places
=
map
.
getPlaces
();
logger
.
info
(
"Places: from map {}"
,
places
.
size
());
logger
.
info
(
"Places: from map {}, time {}"
,
places
.
size
(),
new
Date
().
getTime
()
-
begin
);
BufferedImage
image
=
map
.
getMapWithPlaces
();
if
(
userId
!=
null
)
{
User
user
=
userFacade
.
find
(
userId
);
...
...
@@ -83,12 +85,14 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
}
}
}
logger
.
info
(
"sometime {}"
,
new
Date
().
getTime
()
-
begin
);
for
(
Place
place
:
selectedPlaceList
)
{
place
.
drawSelectedPlace
(
image
);
}
logger
.
info
(
"Prewrite {}"
,
new
Date
().
getTime
()
-
begin
);
ImageIO
.
write
(
image
,
filetype
,
outputStream
);
logger
.
info
(
"postwrite {}"
,
new
Date
().
getTime
()
-
begin
);
}
public
String
getSelectPlaceMapUrl
(
EventMap
activeMap
,
List
<
Place
>
selectedPlace
,
User
user
)
{
...
...
@@ -105,7 +109,6 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
parameters
+=
"&userid="
+
user
.
getId
();
}
return
"/PlaceMap"
+
parameters
;
// TODO: do something.
}
...
...
code/LanBortalBeansClient/.classpath
View file @
9c91723
...
...
@@ -2,7 +2,6 @@
<classpath>
<classpathentry
kind=
"src"
path=
"ejbModule"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jst.j2ee.internal.module.container"
/>
<classpathentry
kind=
"lib"
path=
"/LanBortal/EarContent/lib/LanBortalDatabase.jar"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"
>
<attributes>
<attribute
name=
"owner.project.facets"
value=
"jst.utility"
/>
...
...
code/LanBortalBeansClient/ejbModule/fi/insomnia/bortal/enums/Role.java
View file @
9c91723
package
fi
.
insomnia
.
bortal
.
enums
;
public
enum
Role
{
USER_BASE
(
true
),
// Logged in user
ADMIN_BASE
(
true
),
SUPERADMIN
(
false
)
// Admin for this event
;
private
boolean
inDatabase
;
Role
(
boolean
inDb
)
{
inDatabase
=
inDb
;
}
public
boolean
isInDatabase
()
{
return
inDatabase
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventMap.java
View file @
9c91723
...
...
@@ -15,6 +15,7 @@ import javax.persistence.CascadeType;
import
javax.persistence.Column
;
import
javax.persistence.EmbeddedId
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
...
...
@@ -24,7 +25,8 @@ import javax.persistence.OneToMany;
import
javax.persistence.Table
;
import
javax.persistence.Version
;
import
org.eclipse.persistence.annotations.Cache
;
import
org.eclipse.persistence.annotations.CacheType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -36,7 +38,6 @@ import org.slf4j.LoggerFactory;
@NamedQueries
({
@NamedQuery
(
name
=
"EventMap.findAll"
,
query
=
"SELECT e FROM EventMap e"
),
@NamedQuery
(
name
=
"EventMap.findByName"
,
query
=
"SELECT e FROM EventMap e WHERE e.name = :name"
)
})
public
class
EventMap
implements
EventChildInterface
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventMap
.
class
);
...
...
@@ -48,7 +49,7 @@ public class EventMap implements EventChildInterface {
private
byte
[]
mapData
;
@Column
(
name
=
"map_name"
)
private
String
name
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"map"
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
fetch
=
FetchType
.
EAGER
,
mappedBy
=
"map"
)
private
List
<
Place
>
places
=
new
ArrayList
<
Place
>();
@ManyToOne
(
optional
=
false
)
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
insertable
=
false
,
updatable
=
false
,
nullable
=
false
)
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Place.java
View file @
9c91723
...
...
@@ -22,6 +22,9 @@ import javax.persistence.OneToOne;
import
javax.persistence.Table
;
import
javax.persistence.Version
;
import
org.eclipse.persistence.annotations.Cache
;
import
org.eclipse.persistence.annotations.CacheType
;
/**
*
...
...
@@ -206,12 +209,11 @@ public class Place implements EventChildInterface {
public
boolean
equals
(
Object
object
)
{
// TODO: Warning - this method won't work in the case the id fields are
// not set
if
(!(
object
instanceof
Place
))
{
if
(
object
==
null
||
!(
object
instanceof
Place
))
{
return
false
;
}
Place
other
=
(
Place
)
object
;
if
((
this
.
getId
()
==
null
&&
other
.
getId
()
!=
null
)
||
(
this
.
getId
()
!=
null
&&
!
this
.
id
.
equals
(
other
.
id
)))
{
if
((
this
.
getId
()
==
null
&&
other
.
getId
()
!=
null
)
||
(
this
.
getId
()
!=
null
&&
!
this
.
getId
().
equals
(
other
.
id
)))
{
return
false
;
}
return
true
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/PlaceMap.java
View file @
9c91723
...
...
@@ -68,9 +68,9 @@ public class PlaceMap extends HttpServlet {
Integer
userId
=
getIntegerParameter
(
request
,
PARAMETER_CURRENT_USER_ID
);
response
.
setContentType
(
"image/
png
"
);
response
.
setContentType
(
"image/
gif
"
);
placemapBean
.
printPlaceMapToStream
(
ostream
,
"
png
"
,
getEvent
(
request
),
mapId
,
userId
,
placeIds
);
placemapBean
.
printPlaceMapToStream
(
ostream
,
"
gif
"
,
getEvent
(
request
),
mapId
,
userId
,
placeIds
);
/*
* TODO output your page here out.println("<html>");
...
...
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