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 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;
...
@@ -9,6 +9,7 @@ import javax.ejb.Stateless;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.enums.Role
;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.facade.UserFacade
;
import
fi.insomnia.bortal.model.User
;
import
fi.insomnia.bortal.model.User
;
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/PlaceMapBean.java
View file @
9c91723
package
fi
.
insomnia
.
bortal
.
beans
;
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.awt.Graphics
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
...
@@ -37,6 +39,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -37,6 +39,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
public
PlaceMapBean
()
{
public
PlaceMapBean
()
{
// TODO Auto-generated constructor stub
// TODO Auto-generated constructor stub
}
}
@EJB
@EJB
private
PlaceFacade
placeFacade
;
private
PlaceFacade
placeFacade
;
@EJB
@EJB
...
@@ -46,6 +49,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -46,6 +49,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
@Override
@Override
public
void
printPlaceMapToStream
(
OutputStream
outputStream
,
String
filetype
,
Event
event
,
Integer
mapId
,
Integer
userId
,
List
<
Integer
>
placeIds
)
throws
IOException
{
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
();
Integer
eventId
=
event
.
getId
();
List
<
Place
>
selectedPlaceList
=
new
ArrayList
<
Place
>();
List
<
Place
>
selectedPlaceList
=
new
ArrayList
<
Place
>();
...
@@ -55,7 +59,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -55,7 +59,7 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
selectedPlaceList
.
add
(
placeFacade
.
find
(
eventId
,
id
));
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
)
{
if
(
selectedPlaceList
.
size
()
>
0
)
{
map
=
selectedPlaceList
.
get
(
0
).
getMap
();
map
=
selectedPlaceList
.
get
(
0
).
getMap
();
...
@@ -65,11 +69,9 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -65,11 +69,9 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
List
<
Place
>
places
=
map
.
getPlaces
();
List
<
Place
>
places
=
map
.
getPlaces
();
logger
.
info
(
"Places: from map {}, time {}"
,
places
.
size
(),
new
Date
().
getTime
()
-
begin
);
logger
.
info
(
"Places: from map {}"
,
places
.
size
());
BufferedImage
image
=
map
.
getMapWithPlaces
();
BufferedImage
image
=
map
.
getMapWithPlaces
();
if
(
userId
!=
null
)
{
if
(
userId
!=
null
)
{
User
user
=
userFacade
.
find
(
userId
);
User
user
=
userFacade
.
find
(
userId
);
...
@@ -83,12 +85,14 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -83,12 +85,14 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
}
}
}
}
}
}
logger
.
info
(
"sometime {}"
,
new
Date
().
getTime
()
-
begin
);
for
(
Place
place
:
selectedPlaceList
)
{
for
(
Place
place
:
selectedPlaceList
)
{
place
.
drawSelectedPlace
(
image
);
place
.
drawSelectedPlace
(
image
);
}
}
logger
.
info
(
"Prewrite {}"
,
new
Date
().
getTime
()
-
begin
);
ImageIO
.
write
(
image
,
filetype
,
outputStream
);
ImageIO
.
write
(
image
,
filetype
,
outputStream
);
logger
.
info
(
"postwrite {}"
,
new
Date
().
getTime
()
-
begin
);
}
}
public
String
getSelectPlaceMapUrl
(
EventMap
activeMap
,
List
<
Place
>
selectedPlace
,
User
user
)
{
public
String
getSelectPlaceMapUrl
(
EventMap
activeMap
,
List
<
Place
>
selectedPlace
,
User
user
)
{
...
@@ -105,7 +109,6 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
...
@@ -105,7 +109,6 @@ public class PlaceMapBean implements PlaceMapBeanLocal {
parameters
+=
"&userid="
+
user
.
getId
();
parameters
+=
"&userid="
+
user
.
getId
();
}
}
return
"/PlaceMap"
+
parameters
;
return
"/PlaceMap"
+
parameters
;
// TODO: do something.
// TODO: do something.
}
}
...
...
code/LanBortalBeansClient/.classpath
View file @
9c91723
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
<classpath>
<classpath>
<classpathentry
kind=
"src"
path=
"ejbModule"
/>
<classpathentry
kind=
"src"
path=
"ejbModule"
/>
<classpathentry
kind=
"con"
path=
"org.eclipse.jst.j2ee.internal.module.container"
/>
<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"
>
<classpathentry
kind=
"con"
path=
"org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish v3 Java EE 6"
>
<attributes>
<attributes>
<attribute
name=
"owner.project.facets"
value=
"jst.utility"
/>
<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
;
package
fi
.
insomnia
.
bortal
.
enums
;
public
enum
Role
{
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;
...
@@ -15,6 +15,7 @@ import javax.persistence.CascadeType;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.EmbeddedId
;
import
javax.persistence.EmbeddedId
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
...
@@ -24,7 +25,8 @@ import javax.persistence.OneToMany;
...
@@ -24,7 +25,8 @@ import javax.persistence.OneToMany;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.persistence.Version
;
import
javax.persistence.Version
;
import
org.eclipse.persistence.annotations.Cache
;
import
org.eclipse.persistence.annotations.CacheType
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -36,7 +38,6 @@ import org.slf4j.LoggerFactory;
...
@@ -36,7 +38,6 @@ import org.slf4j.LoggerFactory;
@NamedQueries
({
@NamedQueries
({
@NamedQuery
(
name
=
"EventMap.findAll"
,
query
=
"SELECT e FROM EventMap e"
),
@NamedQuery
(
name
=
"EventMap.findAll"
,
query
=
"SELECT e FROM EventMap e"
),
@NamedQuery
(
name
=
"EventMap.findByName"
,
query
=
"SELECT e FROM EventMap e WHERE e.name = :name"
)
})
@NamedQuery
(
name
=
"EventMap.findByName"
,
query
=
"SELECT e FROM EventMap e WHERE e.name = :name"
)
})
public
class
EventMap
implements
EventChildInterface
{
public
class
EventMap
implements
EventChildInterface
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventMap
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EventMap
.
class
);
...
@@ -48,7 +49,7 @@ public class EventMap implements EventChildInterface {
...
@@ -48,7 +49,7 @@ public class EventMap implements EventChildInterface {
private
byte
[]
mapData
;
private
byte
[]
mapData
;
@Column
(
name
=
"map_name"
)
@Column
(
name
=
"map_name"
)
private
String
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
>();
private
List
<
Place
>
places
=
new
ArrayList
<
Place
>();
@ManyToOne
(
optional
=
false
)
@ManyToOne
(
optional
=
false
)
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
insertable
=
false
,
updatable
=
false
,
nullable
=
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;
...
@@ -22,6 +22,9 @@ import javax.persistence.OneToOne;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.persistence.Version
;
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 {
...
@@ -206,12 +209,11 @@ public class Place implements EventChildInterface {
public
boolean
equals
(
Object
object
)
{
public
boolean
equals
(
Object
object
)
{
// TODO: Warning - this method won't work in the case the id fields are
// TODO: Warning - this method won't work in the case the id fields are
// not set
// not set
if
(!(
object
instanceof
Place
))
{
if
(
object
==
null
||
!(
object
instanceof
Place
))
{
return
false
;
return
false
;
}
}
Place
other
=
(
Place
)
object
;
Place
other
=
(
Place
)
object
;
if
((
this
.
getId
()
==
null
&&
other
.
getId
()
!=
null
)
if
((
this
.
getId
()
==
null
&&
other
.
getId
()
!=
null
)
||
(
this
.
getId
()
!=
null
&&
!
this
.
getId
().
equals
(
other
.
id
)))
{
||
(
this
.
getId
()
!=
null
&&
!
this
.
id
.
equals
(
other
.
id
)))
{
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/PlaceMap.java
View file @
9c91723
...
@@ -68,9 +68,9 @@ public class PlaceMap extends HttpServlet {
...
@@ -68,9 +68,9 @@ public class PlaceMap extends HttpServlet {
Integer
userId
=
getIntegerParameter
(
request
,
PARAMETER_CURRENT_USER_ID
);
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>");
* 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