Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Antti Väyrynen
/
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 7c14cbec
authored
Apr 18, 2010
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
entity reference fixes
1 parent
8f5ce3ef
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
163 additions
and
82 deletions
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Bill.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/BillLine.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CardTemplate.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Compo.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntryParticipant.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Event.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventMap.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventPk.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWaveTemplate.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LogEntry.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/NewsGroup.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Place.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Product.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Reader.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Role.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/RoleRight.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/User.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Bill.java
View file @
7c14cbe
...
@@ -96,6 +96,10 @@ public class Bill implements EventChildInterface {
...
@@ -96,6 +96,10 @@ public class Bill implements EventChildInterface {
@ManyToOne
(
optional
=
false
)
@ManyToOne
(
optional
=
false
)
private
User
user
;
private
User
user
;
@ManyToOne
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
updatable
=
false
,
insertable
=
false
)
private
Event
event
;
/**
/**
* Commodity function to calculate the total price of the bill.
* Commodity function to calculate the total price of the bill.
*
*
...
@@ -235,4 +239,12 @@ public class Bill implements EventChildInterface {
...
@@ -235,4 +239,12 @@ public class Bill implements EventChildInterface {
public
int
getJpaVersionField
()
{
public
int
getJpaVersionField
()
{
return
jpaVersionField
;
return
jpaVersionField
;
}
}
public
void
setEvent
(
Event
event
)
{
this
.
event
=
event
;
}
public
Event
getEvent
()
{
return
event
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/BillLine.java
View file @
7c14cbe
...
@@ -96,15 +96,14 @@ public class BillLine implements EventChildInterface {
...
@@ -96,15 +96,14 @@ public class BillLine implements EventChildInterface {
public
BillLine
()
{
public
BillLine
()
{
}
}
public
BillLine
(
Bill
bill
)
{
public
BillLine
(
Event
event
,
Bill
bill
)
{
this
.
id
=
new
EventPk
(
bill
.
getId
().
getEvent
()
);
this
.
id
=
new
EventPk
(
event
);
this
.
bill
=
bill
;
this
.
bill
=
bill
;
}
}
public
BillLine
(
Bill
bill
,
String
product
,
BigDecimal
units
,
public
BillLine
(
Event
event
,
Bill
bill
,
String
product
,
BigDecimal
units
,
BigDecimal
unitPrice
,
BigDecimal
vat
)
{
BigDecimal
unitPrice
,
BigDecimal
vat
)
{
this
.
id
=
new
EventPk
(
bill
.
getId
().
getEvent
());
this
(
event
,
bill
);
this
.
bill
=
bill
;
this
.
name
=
product
;
this
.
name
=
product
;
this
.
setQuantity
(
units
);
this
.
setQuantity
(
units
);
this
.
setUnitPrice
(
unitPrice
);
this
.
setUnitPrice
(
unitPrice
);
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CardTemplate.java
View file @
7c14cbe
...
@@ -45,6 +45,10 @@ public class CardTemplate implements EventChildInterface {
...
@@ -45,6 +45,10 @@ public class CardTemplate implements EventChildInterface {
@OneToMany
(
mappedBy
=
"template"
)
@OneToMany
(
mappedBy
=
"template"
)
private
List
<
PrintedCard
>
cards
;
private
List
<
PrintedCard
>
cards
;
@ManyToOne
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
updatable
=
false
,
insertable
=
false
)
private
Event
event
;
@Version
@Version
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
...
@@ -140,4 +144,12 @@ public class CardTemplate implements EventChildInterface {
...
@@ -140,4 +144,12 @@ public class CardTemplate implements EventChildInterface {
return
cards
;
return
cards
;
}
}
public
void
setEvent
(
Event
event
)
{
this
.
event
=
event
;
}
public
Event
getEvent
()
{
return
event
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Compo.java
View file @
7c14cbe
...
@@ -99,6 +99,10 @@ public class Compo implements EventChildInterface {
...
@@ -99,6 +99,10 @@ public class Compo implements EventChildInterface {
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"compo"
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"compo"
)
private
List
<
CompoEntry
>
compoEntries
;
private
List
<
CompoEntry
>
compoEntries
;
@ManyToOne
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
insertable
=
false
,
updatable
=
false
)
private
Event
event
;
@Version
@Version
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
...
@@ -250,4 +254,12 @@ public class Compo implements EventChildInterface {
...
@@ -250,4 +254,12 @@ public class Compo implements EventChildInterface {
this
.
maxParticipantCount
=
maxParticipantCount
;
this
.
maxParticipantCount
=
maxParticipantCount
;
}
}
public
void
setEvent
(
Event
event
)
{
this
.
event
=
event
;
}
public
Event
getEvent
()
{
return
event
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/CompoEntryParticipant.java
View file @
7c14cbe
...
@@ -84,8 +84,8 @@ public class CompoEntryParticipant implements EventChildInterface {
...
@@ -84,8 +84,8 @@ public class CompoEntryParticipant implements EventChildInterface {
this
.
id
=
new
EventPk
(
event
);
this
.
id
=
new
EventPk
(
event
);
}
}
public
CompoEntryParticipant
(
CompoEntry
entry
,
User
participant
)
{
public
CompoEntryParticipant
(
Event
event
,
CompoEntry
entry
,
User
participant
)
{
this
(
e
ntry
.
getId
().
getEvent
()
);
this
(
e
vent
);
this
.
entry
=
entry
;
this
.
entry
=
entry
;
this
.
user
=
participant
;
this
.
user
=
participant
;
}
}
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Event.java
View file @
7c14cbe
...
@@ -88,10 +88,10 @@ public class Event implements ModelInterface<Integer> {
...
@@ -88,10 +88,10 @@ public class Event implements ModelInterface<Integer> {
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
@OneToMany
(
mappedBy
=
"event
_id
"
)
@OneToMany
(
mappedBy
=
"event"
)
private
List
<
Bill
>
bills
;
private
List
<
Bill
>
bills
;
@OneToMany
(
mappedBy
=
"event
_id
"
)
@OneToMany
(
mappedBy
=
"event"
)
private
List
<
Reader
>
readers
;
private
List
<
Reader
>
readers
;
public
Event
()
{
public
Event
()
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventMap.java
View file @
7c14cbe
...
@@ -8,13 +8,14 @@ import java.awt.image.BufferedImage;
...
@@ -8,13 +8,14 @@ import java.awt.image.BufferedImage;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
javax.persistence.CascadeType
;
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.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumns
;
import
javax.persistence.Lob
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQueries
;
...
@@ -48,6 +49,10 @@ public class EventMap implements EventChildInterface {
...
@@ -48,6 +49,10 @@ public class EventMap implements EventChildInterface {
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"map"
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"map"
)
private
List
<
Place
>
places
;
private
List
<
Place
>
places
;
@ManyToOne
(
optional
=
false
)
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
insertable
=
false
,
updatable
=
false
,
nullable
=
false
)
private
Event
event
;
@Version
@Version
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
...
@@ -161,19 +166,23 @@ public class EventMap implements EventChildInterface {
...
@@ -161,19 +166,23 @@ public class EventMap implements EventChildInterface {
this
.
readers
=
readers
;
this
.
readers
=
readers
;
}
}
public
BufferedImage
getMapWithPlaces
()
throws
IOException
{
public
BufferedImage
getMapWithPlaces
()
throws
IOException
{
BufferedImage
image
=
ImageIO
.
read
(
new
ByteArrayInputStream
(
getMapData
()));
BufferedImage
image
=
ImageIO
.
read
(
new
ByteArrayInputStream
(
getMapData
()));
for
(
Place
place
:
getPlaces
())
{
for
(
Place
place
:
getPlaces
())
{
place
.
drawPlace
(
image
);
place
.
drawPlace
(
image
);
}
}
return
image
;
return
image
;
}
}
public
void
setEvent
(
Event
event
)
{
this
.
event
=
event
;
}
public
Event
getEvent
()
{
return
event
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventPk.java
View file @
7c14cbe
...
@@ -17,15 +17,18 @@ public class EventPk implements Serializable {
...
@@ -17,15 +17,18 @@ public class EventPk implements Serializable {
@Column
(
name
=
"event_id"
,
nullable
=
false
,
updatable
=
false
)
@Column
(
name
=
"event_id"
,
nullable
=
false
,
updatable
=
false
)
private
Integer
eventId
;
private
Integer
eventId
;
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
)
//
@JoinColumn(name = "event_id", referencedColumnName = "event_id")
@ManyToOne
//
@ManyToOne
private
Event
event
;
//
private Event event;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
EventPk
()
{
}
public
EventPk
(
Event
event
)
{
public
EventPk
(
Event
event
)
{
super
();
super
();
this
.
event
=
event
;
this
.
event
Id
=
event
.
getId
()
;
}
}
public
void
setId
(
Integer
id
)
{
public
void
setId
(
Integer
id
)
{
...
@@ -51,11 +54,11 @@ public class EventPk implements Serializable {
...
@@ -51,11 +54,11 @@ public class EventPk implements Serializable {
return
pk
.
id
==
this
.
id
&&
pk
.
eventId
==
this
.
eventId
;
return
pk
.
id
==
this
.
id
&&
pk
.
eventId
==
this
.
eventId
;
}
}
public
void
setEvent
(
Event
event
)
{
//
public void setEvent(Event event) {
this
.
event
=
event
;
//
this.event = event;
}
//
}
//
public
Event
getEvent
()
{
//
public Event getEvent() {
return
event
;
//
return event;
}
//
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/FoodWaveTemplate.java
View file @
7c14cbe
...
@@ -39,7 +39,7 @@ public class FoodWaveTemplate implements EventChildInterface {
...
@@ -39,7 +39,7 @@ public class FoodWaveTemplate implements EventChildInterface {
@Column
(
name
=
"template_description"
)
@Column
(
name
=
"template_description"
)
private
String
description
;
private
String
description
;
@ManyToMany
(
mappedBy
=
"foodWaveTemplate"
)
@ManyToMany
(
mappedBy
=
"foodWaveTemplate
s
"
)
private
List
<
Product
>
products
;
private
List
<
Product
>
products
;
@Version
@Version
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/LogEntry.java
View file @
7c14cbe
...
@@ -12,7 +12,6 @@ import javax.persistence.Column;
...
@@ -12,7 +12,6 @@ import javax.persistence.Column;
import
javax.persistence.EmbeddedId
;
import
javax.persistence.EmbeddedId
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumns
;
import
javax.persistence.Lob
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQueries
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/NewsGroup.java
View file @
7c14cbe
...
@@ -10,6 +10,8 @@ import javax.persistence.CascadeType;
...
@@ -10,6 +10,8 @@ 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.JoinColumn
;
import
javax.persistence.JoinTable
;
import
javax.persistence.Lob
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQueries
;
...
@@ -49,6 +51,14 @@ public class NewsGroup implements EventChildInterface {
...
@@ -49,6 +51,14 @@ public class NewsGroup implements EventChildInterface {
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"group"
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"group"
)
private
List
<
News
>
news
;
private
List
<
News
>
news
;
@ManyToMany
@JoinTable
(
name
=
"newsgroup_role"
,
joinColumns
=
{
@JoinColumn
(
name
=
"newsgroup_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
)
},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
)
})
private
List
<
Role
>
roles
;
@Version
@Version
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
...
@@ -159,4 +169,12 @@ public class NewsGroup implements EventChildInterface {
...
@@ -159,4 +169,12 @@ public class NewsGroup implements EventChildInterface {
public
void
setJpaVersionField
(
int
jpaVersionField
)
{
public
void
setJpaVersionField
(
int
jpaVersionField
)
{
this
.
jpaVersionField
=
jpaVersionField
;
this
.
jpaVersionField
=
jpaVersionField
;
}
}
public
void
setRoles
(
List
<
Role
>
roles
)
{
this
.
roles
=
roles
;
}
public
List
<
Role
>
getRoles
()
{
return
roles
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Place.java
View file @
7c14cbe
...
@@ -256,7 +256,8 @@ public class Place implements EventChildInterface {
...
@@ -256,7 +256,8 @@ public class Place implements EventChildInterface {
}
}
/**
/**
* @param height the height to set
* @param height
* the height to set
*/
*/
public
void
setHeight
(
Integer
height
)
{
public
void
setHeight
(
Integer
height
)
{
this
.
height
=
height
;
this
.
height
=
height
;
...
@@ -270,7 +271,8 @@ public class Place implements EventChildInterface {
...
@@ -270,7 +271,8 @@ public class Place implements EventChildInterface {
}
}
/**
/**
* @param width the width to set
* @param width
* the width to set
*/
*/
public
void
setWidth
(
Integer
width
)
{
public
void
setWidth
(
Integer
width
)
{
this
.
width
=
width
;
this
.
width
=
width
;
...
@@ -286,6 +288,7 @@ public class Place implements EventChildInterface {
...
@@ -286,6 +288,7 @@ public class Place implements EventChildInterface {
return
false
;
return
false
;
}
}
private
static
final
Color
NORMAL_COLOR
=
Color
.
BLUE
;
private
static
final
Color
NORMAL_COLOR
=
Color
.
BLUE
;
private
static
final
Color
RESERVED_COLOR
=
Color
.
RED
;
private
static
final
Color
RESERVED_COLOR
=
Color
.
RED
;
private
static
final
Color
SELECTED_COLOR
=
Color
.
GREEN
;
private
static
final
Color
SELECTED_COLOR
=
Color
.
GREEN
;
...
@@ -294,7 +297,7 @@ public class Place implements EventChildInterface {
...
@@ -294,7 +297,7 @@ public class Place implements EventChildInterface {
public
void
drawPlace
(
BufferedImage
targetImage
)
{
public
void
drawPlace
(
BufferedImage
targetImage
)
{
Graphics2D
g
=
targetImage
.
createGraphics
();
Graphics2D
g
=
targetImage
.
createGraphics
();
if
(
placeG
roup
!=
null
)
{
if
(
g
roup
!=
null
)
{
g
.
setColor
(
RESERVED_COLOR
);
g
.
setColor
(
RESERVED_COLOR
);
g
.
fill
(
new
Rectangle
(
mapX
,
mapY
,
width
,
height
));
g
.
fill
(
new
Rectangle
(
mapX
,
mapY
,
width
,
height
));
}
else
{
}
else
{
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Product.java
View file @
7c14cbe
...
@@ -11,13 +11,18 @@ import javax.persistence.CascadeType;
...
@@ -11,13 +11,18 @@ 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.JoinColumn
;
import
javax.persistence.JoinTable
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.OneToMany
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.persistence.UniqueConstraint
;
import
javax.persistence.Version
;
import
javax.persistence.Version
;
import
org.eclipse.persistence.annotations.PrimaryKey
;
/**
/**
*
*
*/
*/
...
@@ -58,6 +63,14 @@ public class Product implements EventChildInterface {
...
@@ -58,6 +63,14 @@ public class Product implements EventChildInterface {
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"product"
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"product"
)
private
List
<
Discount
>
discounts
;
private
List
<
Discount
>
discounts
;
@ManyToMany
()
@JoinTable
(
name
=
"product_foodwavetemplate"
,
joinColumns
=
{
@JoinColumn
(
name
=
"product_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
)
},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"food_wave_template_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
)
},
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"product_id"
,
"food_wave_template_id"
,
"event_id"
})
})
private
List
<
FoodWaveTemplate
>
foodWaveTemplates
;
@Version
@Version
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
...
@@ -191,4 +204,12 @@ public class Product implements EventChildInterface {
...
@@ -191,4 +204,12 @@ public class Product implements EventChildInterface {
public
List
<
Discount
>
getDiscounts
()
{
public
List
<
Discount
>
getDiscounts
()
{
return
discounts
;
return
discounts
;
}
}
public
void
setFoodWaveTemplates
(
List
<
FoodWaveTemplate
>
foodWaveTemplates
)
{
this
.
foodWaveTemplates
=
foodWaveTemplates
;
}
public
List
<
FoodWaveTemplate
>
getFoodWaveTemplates
()
{
return
foodWaveTemplates
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Reader.java
View file @
7c14cbe
...
@@ -4,9 +4,6 @@
...
@@ -4,9 +4,6 @@
*/
*/
package
fi
.
insomnia
.
bortal
.
model
;
package
fi
.
insomnia
.
bortal
.
model
;
import
java.util.List
;
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
;
...
@@ -16,7 +13,6 @@ import javax.persistence.Lob;
...
@@ -16,7 +13,6 @@ import javax.persistence.Lob;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
javax.persistence.Table
;
import
javax.persistence.Version
;
import
javax.persistence.Version
;
...
@@ -44,20 +40,22 @@ public class Reader implements EventChildInterface {
...
@@ -44,20 +40,22 @@ public class Reader implements EventChildInterface {
@Column
(
name
=
"reader_description"
)
@Column
(
name
=
"reader_description"
)
private
String
description
;
private
String
description
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"reader"
)
private
List
<
ReaderEvent
>
events
;
@JoinColumns
(
{
@JoinColumns
(
{
@JoinColumn
(
name
=
"location_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"location_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
updatable
=
false
,
insertable
=
false
)
})
@ManyToOne
@ManyToOne
private
Location
location
;
private
Location
location
;
@ManyToOne
@ManyToOne
@JoinColumns
(
{
@JoinColumns
(
{
@JoinColumn
(
name
=
"map_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"map_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
updatable
=
false
,
insertable
=
false
)
})
private
EventMap
eventMap
;
private
EventMap
eventMap
;
@ManyToOne
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
updatable
=
false
,
insertable
=
false
)
private
Event
event
;
@Column
(
name
=
"map_x"
)
@Column
(
name
=
"map_x"
)
private
Integer
mapX
;
private
Integer
mapX
;
@Column
(
name
=
"map_y"
)
@Column
(
name
=
"map_y"
)
...
@@ -90,14 +88,6 @@ public class Reader implements EventChildInterface {
...
@@ -90,14 +88,6 @@ public class Reader implements EventChildInterface {
this
.
description
=
readerDescription
;
this
.
description
=
readerDescription
;
}
}
public
List
<
ReaderEvent
>
getEvents
()
{
return
events
;
}
public
void
setEvents
(
List
<
ReaderEvent
>
readerEventList
)
{
this
.
events
=
readerEventList
;
}
public
Location
getLocation
()
{
public
Location
getLocation
()
{
return
location
;
return
location
;
}
}
...
@@ -168,21 +158,6 @@ public class Reader implements EventChildInterface {
...
@@ -168,21 +158,6 @@ public class Reader implements EventChildInterface {
}
}
/**
/**
* @return the event
*/
public
Event
getEvent
()
{
return
event
;
}
/**
* @param event
* the event to set
*/
public
void
setEvent
(
Event
event
)
{
this
.
event
=
event
;
}
/**
* @return the mapX
* @return the mapX
*/
*/
public
Integer
getMapX
()
{
public
Integer
getMapX
()
{
...
@@ -226,4 +201,12 @@ public class Reader implements EventChildInterface {
...
@@ -226,4 +201,12 @@ public class Reader implements EventChildInterface {
public
void
setEventMap
(
EventMap
eventMap
)
{
public
void
setEventMap
(
EventMap
eventMap
)
{
this
.
eventMap
=
eventMap
;
this
.
eventMap
=
eventMap
;
}
}
public
void
setEvent
(
Event
event
)
{
this
.
event
=
event
;
}
public
Event
getEvent
()
{
return
event
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Role.java
View file @
7c14cbe
...
@@ -27,7 +27,7 @@ import javax.persistence.Version;
...
@@ -27,7 +27,7 @@ import javax.persistence.Version;
*
*
*/
*/
@Entity
@Entity
@Table
(
name
=
"roles"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"events_
pk_
id"
,
"role_name"
})
})
@Table
(
name
=
"roles"
,
uniqueConstraints
=
{
@UniqueConstraint
(
columnNames
=
{
"events_id"
,
"role_name"
})
})
@NamedQueries
(
{
@NamedQueries
(
{
@NamedQuery
(
name
=
"Role.findAll"
,
query
=
"SELECT r FROM Role r"
),
@NamedQuery
(
name
=
"Role.findAll"
,
query
=
"SELECT r FROM Role r"
),
@NamedQuery
(
name
=
"Role.findByRoleName"
,
query
=
"SELECT r FROM Role r WHERE r.name = :name"
)
})
@NamedQuery
(
name
=
"Role.findByRoleName"
,
query
=
"SELECT r FROM Role r WHERE r.name = :name"
)
})
...
@@ -74,6 +74,10 @@ public class Role implements EventChildInterface {
...
@@ -74,6 +74,10 @@ public class Role implements EventChildInterface {
@ManyToMany
(
mappedBy
=
"roles"
)
@ManyToMany
(
mappedBy
=
"roles"
)
private
List
<
NewsGroup
>
newsGroups
;
private
List
<
NewsGroup
>
newsGroups
;
@ManyToOne
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"event_id"
,
updatable
=
false
,
insertable
=
false
)
private
Event
event
;
@Version
@Version
@Column
(
nullable
=
false
)
@Column
(
nullable
=
false
)
private
int
jpaVersionField
=
0
;
private
int
jpaVersionField
=
0
;
...
@@ -214,4 +218,12 @@ public class Role implements EventChildInterface {
...
@@ -214,4 +218,12 @@ public class Role implements EventChildInterface {
public
List
<
NewsGroup
>
getNewsGroups
()
{
public
List
<
NewsGroup
>
getNewsGroups
()
{
return
newsGroups
;
return
newsGroups
;
}
}
public
void
setEvent
(
Event
event
)
{
this
.
event
=
event
;
}
public
Event
getEvent
()
{
return
event
;
}
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/RoleRight.java
View file @
7c14cbe
...
@@ -70,8 +70,8 @@ public class RoleRight implements EventChildInterface {
...
@@ -70,8 +70,8 @@ public class RoleRight implements EventChildInterface {
this
.
id
=
new
EventPk
(
event
);
this
.
id
=
new
EventPk
(
event
);
}
}
public
RoleRight
(
Role
role
,
AccessRight
right
,
boolean
read
,
boolean
write
,
boolean
execute
)
{
public
RoleRight
(
Event
event
,
Role
role
,
AccessRight
right
,
boolean
read
,
boolean
write
,
boolean
execute
)
{
this
(
role
.
getId
().
getEvent
()
);
this
(
event
);
this
.
role
=
role
;
this
.
role
=
role
;
this
.
accessRight
=
right
;
this
.
accessRight
=
right
;
this
.
read
=
read
;
this
.
read
=
read
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/User.java
View file @
7c14cbe
...
@@ -27,8 +27,6 @@ import org.slf4j.Logger;
...
@@ -27,8 +27,6 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.utilities.PasswordFunctions
;
import
fi.insomnia.bortal.utilities.PasswordFunctions
;
import
java.io.Serializable
;
/**
/**
*
*
...
@@ -127,14 +125,14 @@ public class User implements ModelInterface<Integer> {
...
@@ -127,14 +125,14 @@ public class User implements ModelInterface<Integer> {
@OneToMany
(
mappedBy
=
"user"
)
@OneToMany
(
mappedBy
=
"user"
)
private
List
<
UserImage
>
userImageList
;
private
List
<
UserImage
>
userImageList
;
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"user
s
"
)
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"user"
)
private
List
<
CompoEntryParticipant
>
compoEntryParticipant
List
;
private
List
<
CompoEntryParticipant
>
compoEntryParticipant
s
;
@OneToMany
(
mappedBy
=
"creator"
)
@OneToMany
(
mappedBy
=
"creator"
)
private
List
<
CompoEntry
>
compoEntr
yList
;
private
List
<
CompoEntry
>
compoEntr
ies
;
@OneToMany
(
mappedBy
=
"creator"
)
@OneToMany
(
mappedBy
=
"creator"
)
private
List
<
PlaceGroup
>
placeGroup
List
;
private
List
<
PlaceGroup
>
placeGroup
s
;
@OneToMany
(
mappedBy
=
"user"
)
@OneToMany
(
mappedBy
=
"user"
)
private
List
<
GroupMembership
>
groupMemberships
;
private
List
<
GroupMembership
>
groupMemberships
;
...
@@ -340,29 +338,29 @@ public class User implements ModelInterface<Integer> {
...
@@ -340,29 +338,29 @@ public class User implements ModelInterface<Integer> {
this
.
userImageList
=
userImageList
;
this
.
userImageList
=
userImageList
;
}
}
public
List
<
CompoEntryParticipant
>
getCompoEntryParticipant
List
()
{
public
List
<
CompoEntryParticipant
>
getCompoEntryParticipant
s
()
{
return
compoEntryParticipant
List
;
return
compoEntryParticipant
s
;
}
}
public
void
setCompoEntryParticipant
List
(
public
void
setCompoEntryParticipant
s
(
List
<
CompoEntryParticipant
>
compoEntryParticipantList
)
{
List
<
CompoEntryParticipant
>
compoEntryParticipantList
)
{
this
.
compoEntryParticipant
List
=
compoEntryParticipantList
;
this
.
compoEntryParticipant
s
=
compoEntryParticipantList
;
}
}
public
List
<
CompoEntry
>
getCompoEntr
yList
()
{
public
List
<
CompoEntry
>
getCompoEntr
ies
()
{
return
compoEntr
yList
;
return
compoEntr
ies
;
}
}
public
void
setCompoEntr
yList
(
List
<
CompoEntry
>
compoEntryList
)
{
public
void
setCompoEntr
ies
(
List
<
CompoEntry
>
compoEntryList
)
{
this
.
compoEntr
yList
=
compoEntryList
;
this
.
compoEntr
ies
=
compoEntryList
;
}
}
public
List
<
PlaceGroup
>
getPlaceGroup
List
()
{
public
List
<
PlaceGroup
>
getPlaceGroup
s
()
{
return
placeGroup
List
;
return
placeGroup
s
;
}
}
public
void
setPlaceGroup
List
(
List
<
PlaceGroup
>
placeGroupList
)
{
public
void
setPlaceGroup
s
(
List
<
PlaceGroup
>
placeGroupList
)
{
this
.
placeGroup
List
=
placeGroupList
;
this
.
placeGroup
s
=
placeGroupList
;
}
}
public
List
<
GroupMembership
>
getGroupMemberships
()
{
public
List
<
GroupMembership
>
getGroupMemberships
()
{
...
...
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