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 87b56a89
authored
May 08, 2010
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
I can has testdata! \o/
1 parent
46e9694e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
35 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/TestDataBean.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventChildInterface.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventPk.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Place.java
code/LanBortalWeb/WebContent/WEB-INF/faces-config.xml
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/PlaceMap.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/TestDataBean.java
View file @
87b56a8
...
...
@@ -128,12 +128,12 @@ public class TestDataBean implements TestDataBeanLocal {
return
user
;
}
public
void
generateTestPlaces
(
EventMap
map
,
Event
e
)
{
public
void
generateTestPlaces
(
EventMap
map
)
{
logger
.
info
(
"Adding places to map {}, event {}"
,
map
);
for
(
int
x
=
5
;
x
<
400
;
x
+=
50
)
{
for
(
int
y
=
5
;
y
<
150
;
y
+=
50
)
{
Place
place
=
new
Place
(
e
);
place
.
setMap
(
map
);
Place
place
=
new
Place
(
map
);
place
.
setMapX
(
x
);
place
.
setMapY
(
y
);
placeFacade
.
create
(
place
);
...
...
@@ -141,4 +141,6 @@ public class TestDataBean implements TestDataBeanLocal {
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventChildInterface.java
View file @
87b56a8
...
...
@@ -15,6 +15,7 @@ public interface EventChildInterface extends ModelInterface<EventPk> {
public
void
setId
(
EventPk
id
);
public
int
getJpaVersionField
();
public
void
setJpaVersionField
(
int
jpaVersionField
);
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventPk.java
View file @
87b56a8
...
...
@@ -17,10 +17,6 @@ public class EventPk implements Serializable {
@Column
(
name
=
"event_id"
,
nullable
=
false
,
updatable
=
false
)
private
Integer
eventId
;
// @JoinColumn(name = "event_id", referencedColumnName = "event_id")
// @ManyToOne
// private Event event;
private
static
final
long
serialVersionUID
=
1L
;
public
EventPk
()
{
...
...
@@ -28,12 +24,12 @@ public class EventPk implements Serializable {
public
EventPk
(
Event
event
)
{
super
();
this
.
eventId
=
event
.
getId
(
);
this
.
setEventId
(
event
.
getId
()
);
}
public
EventPk
(
Integer
eventId
)
{
super
();
this
.
eventId
=
eventId
;
this
.
setEventId
(
eventId
)
;
}
public
void
setId
(
Integer
id
)
{
...
...
@@ -45,7 +41,7 @@ public class EventPk implements Serializable {
}
public
int
hashCode
()
{
return
id
.
hashCode
()
+
eventId
.
hashCode
();
return
id
.
hashCode
()
+
getEventId
()
.
hashCode
();
}
public
boolean
equals
(
Object
obj
)
{
...
...
@@ -56,18 +52,19 @@ public class EventPk implements Serializable {
if
(!(
obj
instanceof
EventPk
))
return
false
;
EventPk
pk
=
(
EventPk
)
obj
;
return
pk
.
id
==
this
.
id
&&
pk
.
eventId
==
this
.
eventId
;
return
pk
.
id
==
this
.
id
&&
pk
.
getEventId
()
==
this
.
getEventId
()
;
}
@Override
public
String
toString
()
{
return
"fi.insomnia.bortal.model.EventPk[id="
+
id
+
", eventId="
+
eventId
+
"]"
;
return
"fi.insomnia.bortal.model.EventPk[id="
+
id
+
", eventId="
+
getEventId
()
+
"]"
;
}
public
void
setEventId
(
Integer
eventId
)
{
this
.
eventId
=
eventId
;
}
public
Integer
getEventId
()
{
return
eventId
;
}
// public void setEvent(Event event) {
// this.event = event;
// }
//
// public Event getEvent() {
// return event;
// }
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Place.java
View file @
87b56a8
...
...
@@ -27,7 +27,7 @@ import javax.persistence.Version;
*/
@Entity
@Table
(
name
=
"places"
)
@NamedQueries
(
{
@NamedQueries
({
@NamedQuery
(
name
=
"Place.findAll"
,
query
=
"SELECT p FROM Place p"
),
@NamedQuery
(
name
=
"Place.findByDescription"
,
query
=
"SELECT p FROM Place p WHERE p.description = :description"
),
@NamedQuery
(
name
=
"Place.findByName"
,
query
=
"SELECT p FROM Place p WHERE p.name = :name"
),
...
...
@@ -60,16 +60,25 @@ public class Place implements EventChildInterface {
private
String
code
;
@OneToOne
(
mappedBy
=
"placeReservation"
)
private
GroupMembership
placeReserver
;
@SuppressWarnings
(
"unused"
)
@Column
(
name
=
"group_id"
)
private
Integer
groupId
;
/**
* Which group has bought the place
*/
@JoinColumns
(
{
@JoinColumn
(
name
=
"group_id"
,
referencedColumnName
=
"id"
,
null
able
=
false
),
@JoinColumns
({
@JoinColumn
(
name
=
"group_id"
,
referencedColumnName
=
"id"
,
updatable
=
false
,
insert
able
=
false
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@ManyToOne
private
PlaceGroup
group
;
@JoinColumns
(
{
@SuppressWarnings
(
"unused"
)
@Column
(
name
=
"map_id"
,
nullable
=
false
)
private
Integer
mapId
;
@JoinColumns
({
@JoinColumn
(
name
=
"map_id"
,
referencedColumnName
=
"id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@ManyToOne
(
optional
=
false
)
...
...
@@ -77,7 +86,7 @@ public class Place implements EventChildInterface {
/**
* Which ticket type is this place sold as
*/
@JoinColumns
(
{
@JoinColumns
({
@JoinColumn
(
name
=
"products_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@ManyToOne
()
...
...
@@ -96,8 +105,10 @@ public class Place implements EventChildInterface {
public
Place
()
{
}
public
Place
(
Event
event
)
{
this
.
id
=
new
EventPk
(
event
);
public
Place
(
EventMap
eventMap
)
{
this
.
id
=
new
EventPk
();
this
.
id
.
setEventId
(
eventMap
.
getId
().
getEventId
());
this
.
setMap
(
eventMap
);
}
public
String
getDescription
()
{
...
...
@@ -152,16 +163,24 @@ public class Place implements EventChildInterface {
return
group
;
}
public
void
setGroup
(
PlaceGroup
groupsId
)
{
this
.
group
=
groupsId
;
public
void
setGroup
(
PlaceGroup
group
)
{
if
(
group
.
getId
().
getEventId
()
!=
getId
().
getEventId
())
{
throw
new
RuntimeException
(
"Can not set Group from different Event to Place!"
);
}
this
.
group
=
group
;
this
.
groupId
=
group
.
getId
().
getId
();
}
public
EventMap
getMap
()
{
return
map
;
}
public
void
setMap
(
EventMap
mapsId
)
{
this
.
map
=
mapsId
;
public
void
setMap
(
EventMap
map
)
{
if
(
map
.
getId
().
getEventId
()
!=
getId
().
getEventId
())
{
throw
new
RuntimeException
(
"Can not set Map from different Event to Place!"
);
}
this
.
map
=
map
;
this
.
mapId
=
map
.
getId
().
getId
();
}
public
Product
getProduct
()
{
...
...
code/LanBortalWeb/WebContent/WEB-INF/faces-config.xml
View file @
87b56a8
...
...
@@ -18,7 +18,7 @@
<!-- Stream: ST (SAO TOME AND PRINCIPE ) -->
<!-- Vector VE (VENEZUELA, BOLIVARIAN REPUBLIC OF) -->
<locale-config>
<default-locale>
fi
</default-locale>
<default-locale>
fi
_FI
</default-locale>
<supported-locale>
fi_IN_XII
</supported-locale>
<supported-locale>
en_ST_v7
</supported-locale>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/servlet/PlaceMap.java
View file @
87b56a8
...
...
@@ -9,6 +9,7 @@ import java.io.PrintWriter;
import
javax.ejb.EJB
;
import
javax.servlet.ServletException
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServlet
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -54,8 +55,8 @@ public class PlaceMap extends HttpServlet {
protected
void
processRequest
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
response
.
setContentType
(
"text/html;charset=UTF-8"
);
PrintWriter
out
=
response
.
getWriter
();
//
PrintWriter out = response.getWriter();
ServletOutputStream
ostream
=
response
.
getOutputStream
();
try
{
Integer
placeId
=
getIntegerParameter
(
request
,
PARAMETER_SELECTED_PLACE_ID
);
Integer
mapId
=
getIntegerParameter
(
request
,
PARAMETER_EVENT_MAP_ID
);
...
...
@@ -63,7 +64,7 @@ public class PlaceMap extends HttpServlet {
response
.
setContentType
(
"image/png"
);
placemapBean
.
printPlaceMapToStream
(
response
.
getOutputStream
()
,
"png"
,
getEvent
(
request
),
mapId
,
userId
,
placeId
);
placemapBean
.
printPlaceMapToStream
(
ostream
,
"png"
,
getEvent
(
request
),
mapId
,
userId
,
placeId
);
/*
* TODO output your page here out.println("<html>");
...
...
@@ -74,7 +75,7 @@ public class PlaceMap extends HttpServlet {
* () + "</h1>"); out.println("</body>"); out.println("</html>");
*/
}
finally
{
o
ut
.
close
();
o
stream
.
close
();
}
}
...
...
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