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 5da87cc4
authored
Apr 18, 2010
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Non event entities
1 parent
bac0342d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
60 additions
and
69 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventFacade.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventSettingsFacade.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventStatusFacade.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/UserFacade.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Event.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventPk.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventSettings.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventStatus.java
code/LanBortalWeb/WebContent/shop.xhtml
code/LanBortalWeb/WebContent/user/list.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/view/ProductView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventFacade.java
View file @
5da87cc
...
...
@@ -8,7 +8,7 @@ import fi.insomnia.bortal.model.Event;
@Stateless
@LocalBean
public
class
EventFacade
extends
IntegerPkGenericFacade
<
Event
>
{
public
class
EventFacade
extends
GenericFacade
<
Integer
,
Event
>
{
@PersistenceContext
private
EntityManager
em
;
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventSettingsFacade.java
View file @
5da87cc
...
...
@@ -8,7 +8,7 @@ import fi.insomnia.bortal.model.EventSettings;
@Stateless
@LocalBean
public
class
EventSettingsFacade
extends
EventChildGenericFacade
<
EventSettings
>
{
public
class
EventSettingsFacade
extends
GenericFacade
<
Integer
,
EventSettings
>
{
@PersistenceContext
private
EntityManager
em
;
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/EventStatusFacade.java
View file @
5da87cc
...
...
@@ -8,7 +8,7 @@ import fi.insomnia.bortal.model.EventStatus;
@Stateless
@LocalBean
public
class
EventStatusFacade
extends
EventChildGenericFacade
<
EventStatus
>
{
public
class
EventStatusFacade
extends
GenericFacade
<
Integer
,
EventStatus
>
{
@PersistenceContext
private
EntityManager
em
;
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/UserFacade.java
View file @
5da87cc
...
...
@@ -11,7 +11,7 @@ import fi.insomnia.bortal.model.User;
@Stateless
@LocalBean
public
class
UserFacade
extends
IntegerPkGenericFacade
<
User
>
{
public
class
UserFacade
extends
GenericFacade
<
Integer
,
User
>
{
public
static
final
String
DEFAULT_USER_LOGIN
=
"default"
;
...
...
@@ -27,10 +27,11 @@ public class UserFacade extends IntegerPkGenericFacade<User> {
}
public
User
findByLogin
(
String
login
)
{
//TODO: Bug in glassfish.... change when fixed...
// TypedQuery<User> q = em.createNamedQuery("User.findByLogin", User.class);
// q.setParameter("login", login);
// return q.getSingleResult();
// TODO: Bug in glassfish.... change when fixed...
// TypedQuery<User> q = em.createNamedQuery("User.findByLogin",
// User.class);
// q.setParameter("login", login);
// return q.getSingleResult();
TypedQuery
<
User
>
q
=
em
.
createQuery
(
"SELECT u FROM User u WHERE u.login = :login"
,
User
.
class
);
q
.
setParameter
(
"login"
,
login
);
return
(
User
)
q
.
getSingleResult
();
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/Event.java
View file @
5da87cc
...
...
@@ -59,23 +59,17 @@ public class Event implements ModelInterface<Integer> {
@Column
(
name
=
"referer"
)
private
String
referer
;
@JoinColumns
({
@JoinColumn
(
name
=
"event_id"
,
referencedColumnName
=
"entity_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
),
@JoinColumn
(
name
=
"event_event_id"
,
referencedColumnName
=
"events_pk_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@JoinColumn
(
name
=
"event_settings_id"
,
referencedColumnName
=
"event_settings_id"
,
nullable
=
false
,
updatable
=
false
)
@ManyToOne
(
optional
=
false
)
private
EventSettings
settings
;
@JoinColumns
({
@JoinColumn
(
name
=
"event_status_id"
,
referencedColumnName
=
"entity_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
),
@JoinColumn
(
name
=
"event_status_event_id"
,
referencedColumnName
=
"events_pk_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@JoinColumn
(
name
=
"event_status_id"
,
referencedColumnName
=
"event_status_id"
,
nullable
=
false
)
@ManyToOne
(
optional
=
false
)
private
EventStatus
status
;
@JoinColumns
({
@JoinColumn
(
name
=
"default_role_id"
,
referencedColumnName
=
"entity_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
),
@JoinColumn
(
name
=
"default_role_event_id"
,
referencedColumnName
=
"events_pk_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@JoinColumns
(
{
@JoinColumn
(
name
=
"default_role_id"
,
referencedColumnName
=
"id"
),
@JoinColumn
(
name
=
"events_id"
,
referencedColumnName
=
"events_pk_id"
,
nullable
=
false
,
updatable
=
false
,
insertable
=
false
)
})
@OneToOne
private
Role
defaultRole
;
...
...
@@ -94,10 +88,10 @@ public class Event implements ModelInterface<Integer> {
@Version
@Column
(
nullable
=
false
)
private
int
jpaVersionField
;
@OneToMany
(
mappedBy
=
"event"
)
private
List
<
Bill
>
bills
;
@OneToMany
(
mappedBy
=
"event"
)
private
List
<
Reader
>
readers
;
...
...
@@ -270,7 +264,8 @@ public class Event implements ModelInterface<Integer> {
}
/**
* @param bills the bills to set
* @param bills
* the bills to set
*/
public
void
setBills
(
List
<
Bill
>
bills
)
{
this
.
bills
=
bills
;
...
...
@@ -284,7 +279,8 @@ public class Event implements ModelInterface<Integer> {
}
/**
* @param readers the readers to set
* @param readers
* the readers to set
*/
public
void
setReaders
(
List
<
Reader
>
readers
)
{
this
.
readers
=
readers
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventPk.java
View file @
5da87cc
...
...
@@ -11,12 +11,11 @@ import javax.persistence.*;
public
class
EventPk
implements
Serializable
{
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"
entity_
id"
,
nullable
=
false
)
@Column
(
name
=
"id"
,
nullable
=
false
)
private
Integer
id
;
@Column
(
name
=
"events_pk_id"
,
nullable
=
false
,
updatable
=
false
)
private
Integer
eventId
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -24,8 +23,6 @@ public class EventPk implements Serializable {
super
();
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
...
...
@@ -34,30 +31,27 @@ public class EventPk implements Serializable {
return
id
;
}
public
void
setEventId
(
Integer
eventId
)
{
this
.
eventId
=
eventId
;
}
public
Integer
getEventId
()
{
return
eventId
;
}
public
int
hashCode
()
{
return
id
.
hashCode
()
+
eventId
.
hashCode
();
return
id
.
hashCode
()
+
eventId
.
hashCode
();
}
public
boolean
equals
(
Object
obj
)
{
if
(
obj
==
null
)
return
false
;
if
(
obj
==
this
)
return
true
;
if
(!(
obj
instanceof
EventPk
))
return
false
;
if
(
obj
==
null
)
return
false
;
if
(
obj
==
this
)
return
true
;
if
(!(
obj
instanceof
EventPk
))
return
false
;
EventPk
pk
=
(
EventPk
)
obj
;
return
pk
.
id
==
this
.
id
&&
pk
.
eventId
==
this
.
eventId
;
}
}
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventSettings.java
View file @
5da87cc
...
...
@@ -10,6 +10,9 @@ import javax.persistence.CascadeType;
import
javax.persistence.Column
;
import
javax.persistence.EmbeddedId
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.NamedQueries
;
...
...
@@ -25,13 +28,14 @@ import javax.persistence.Version;
@Table
(
name
=
"event_settings"
)
@NamedQueries
(
{
@NamedQuery
(
name
=
"EventSettings.findAll"
,
query
=
"SELECT e FROM EventSettings e"
),
@NamedQuery
(
name
=
"EventSettings.findByBundleCountry"
,
query
=
"SELECT e FROM EventSettings e WHERE e.bundleCountry = :bundleCountry"
)
})
public
class
EventSettings
implements
EventChildInterface
{
@NamedQuery
(
name
=
"EventSettings.findByBundleCountry"
,
query
=
"SELECT e FROM EventSettings e WHERE e.bundleCountry = :bundleCountry"
)
})
public
class
EventSettings
implements
ModelInterface
<
Integer
>
{
private
static
final
long
serialVersionUID
=
1L
;
@EmbeddedId
private
EventPk
id
;
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"event_settings_id"
,
nullable
=
false
)
private
Integer
id
;
@Column
(
name
=
"organisation"
)
private
String
organisation
;
...
...
@@ -42,7 +46,6 @@ public class EventSettings implements EventChildInterface{
@OneToMany
(
cascade
=
CascadeType
.
ALL
,
mappedBy
=
"settings"
)
private
List
<
Event
>
events
;
@ManyToOne
@JoinColumn
(
name
=
"users_id"
,
referencedColumnName
=
"users_id"
,
nullable
=
false
)
private
User
admin
;
...
...
@@ -54,10 +57,6 @@ public class EventSettings implements EventChildInterface{
public
EventSettings
()
{
}
public
EventSettings
(
EventPk
eventSettingsId
)
{
this
.
id
=
eventSettingsId
;
}
public
List
<
Event
>
getEvents
()
{
return
events
;
}
...
...
@@ -97,7 +96,7 @@ public class EventSettings implements EventChildInterface{
* @return the id
*/
@Override
public
EventPk
getId
()
{
public
Integer
getId
()
{
return
id
;
}
...
...
@@ -106,7 +105,7 @@ public class EventSettings implements EventChildInterface{
* the id to set
*/
@Override
public
void
setId
(
EventPk
id
)
{
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
...
...
@@ -135,7 +134,8 @@ public class EventSettings implements EventChildInterface{
}
/**
* @param organisation the organisation to set
* @param organisation
* the organisation to set
*/
public
void
setOrganisation
(
String
organisation
)
{
this
.
organisation
=
organisation
;
...
...
@@ -149,7 +149,8 @@ public class EventSettings implements EventChildInterface{
}
/**
* @param bundleCountry the bundleCountry to set
* @param bundleCountry
* the bundleCountry to set
*/
public
void
setBundleCountry
(
String
bundleCountry
)
{
this
.
bundleCountry
=
bundleCountry
;
...
...
@@ -163,7 +164,8 @@ public class EventSettings implements EventChildInterface{
}
/**
* @param admin the admin to set
* @param admin
* the admin to set
*/
public
void
setAdmin
(
User
admin
)
{
this
.
admin
=
admin
;
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/EventStatus.java
View file @
5da87cc
...
...
@@ -10,6 +10,9 @@ import javax.persistence.CascadeType;
import
javax.persistence.Column
;
import
javax.persistence.EmbeddedId
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.NamedQueries
;
import
javax.persistence.NamedQuery
;
import
javax.persistence.OneToMany
;
...
...
@@ -26,12 +29,14 @@ import javax.persistence.Version;
@NamedQuery
(
name
=
"EventStatus.findAll"
,
query
=
"SELECT e FROM EventStatus e"
),
@NamedQuery
(
name
=
"EventStatus.findByStatusName"
,
query
=
"SELECT e FROM EventStatus e WHERE e.statusName = :statusName"
)
})
public
class
EventStatus
implements
EventChildInterface
{
public
class
EventStatus
implements
ModelInterface
<
Integer
>
{
private
static
final
long
serialVersionUID
=
1L
;
@EmbeddedId
private
EventPk
id
;
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"event_status_id"
,
nullable
=
false
)
private
Integer
id
;
@Column
(
name
=
"status_name"
,
nullable
=
false
)
private
String
statusName
;
...
...
@@ -46,12 +51,7 @@ public class EventStatus implements EventChildInterface{
public
EventStatus
()
{
}
public
EventStatus
(
EventPk
eventStatusId
)
{
this
.
id
=
eventStatusId
;
}
public
EventStatus
(
EventPk
eventStatusId
,
String
statusName
)
{
this
.
id
=
eventStatusId
;
public
EventStatus
(
String
statusName
)
{
this
.
statusName
=
statusName
;
}
...
...
@@ -102,7 +102,7 @@ public class EventStatus implements EventChildInterface{
* @return the id
*/
@Override
public
EventPk
getId
()
{
public
Integer
getId
()
{
return
id
;
}
...
...
@@ -111,7 +111,7 @@ public class EventStatus implements EventChildInterface{
* the id to set
*/
@Override
public
void
setId
(
EventPk
id
)
{
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
...
...
code/LanBortalWeb/WebContent/shop.xhtml
View file @
5da87cc
...
...
@@ -14,8 +14,8 @@
<ui:define
name=
"title"
>
Omnia
</ui:define>
<ui:define
name=
"header"
>
Lippukauppa
</ui:define>
<ui:define
name=
"content"
>
</ui:define>
<shop:productlist
/>
</ui:define>
<ui:define
name=
"footer"
>
Osta liput
</ui:define>
</ui:composition>
</h:body>
...
...
code/LanBortalWeb/WebContent/user/list.xhtml
View file @
5da87cc
...
...
@@ -16,6 +16,7 @@
<ui:define
name=
"header"
>
Edit user
</ui:define>
<ui:define
name=
"content"
>
<h:outputText
value=
"productlist"
/>
<users:list
/>
</ui:define>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/view/ProductView.java
View file @
5da87cc
...
...
@@ -29,9 +29,6 @@ import org.slf4j.LoggerFactory;
@SessionScoped
public
class
ProductView
{
@ManagedProperty
(
"#{sessionHandler}"
)
private
SessionHandler
sessionhandler
;
@EJB
private
ProductBeanLocal
productBean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ProductView
.
class
);
...
...
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