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 3cfd73d9
authored
May 25, 2014
by
Tuukka Kivilahti
Committed by
Tuukka Kivilahti
Jun 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moar of database
1 parent
d1976590
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
233 additions
and
0 deletions
code/MoyaDatabase/src/fi/codecrew/moya/model/Lecture.java
code/MoyaDatabase/src/fi/codecrew/moya/model/LectureGroup.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Lecture.java
0 → 100644
View file @
3cfd73d
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.Calendar
;
import
java.util.List
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinTable
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToMany
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.Table
;
import
javax.persistence.Temporal
;
import
javax.persistence.TemporalType
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
/**
* Group for lectures, so you can set limits how many of these the user can choose
*/
@Entity
@Table
(
name
=
"lectures"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
Lecture
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
3L
;
@Column
(
name
=
"name"
)
private
String
name
;
@Lob
@Column
(
name
=
"description"
)
private
String
description
;
@ManyToOne
@JoinColumn
(
name
=
"lecture_group_id"
,
referencedColumnName
=
LectureGroup
.
ID_COLUMN
)
private
LectureGroup
lectureGroup
;
@ManyToMany
()
@JoinTable
(
name
=
"lecture_participants"
,
joinColumns
=
{
@JoinColumn
(
name
=
"lecture_id"
,
referencedColumnName
=
Lecture
.
ID_COLUMN
)
},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"eventuser_id"
,
referencedColumnName
=
EventUser
.
ID_COLUMN
)
})
private
List
<
EventUser
>
participants
;
@ManyToMany
()
@JoinTable
(
name
=
"lecture_roles"
,
joinColumns
=
{
@JoinColumn
(
name
=
"lecture_id"
,
referencedColumnName
=
Lecture
.
ID_COLUMN
)
},
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
,
referencedColumnName
=
Role
.
ID_COLUMN
)
})
private
List
<
Role
>
openForRoles
;
@Column
(
name
=
"max_participants_count"
)
private
Integer
maxParticipantsCount
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"start_time"
)
private
Calendar
startTime
;
@Temporal
(
TemporalType
.
TIMESTAMP
)
@Column
(
name
=
"end_time"
)
private
Calendar
endTime
;
public
Lecture
()
{
super
();
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
LectureGroup
getLectureGroup
()
{
return
lectureGroup
;
}
public
void
setLectureGroup
(
LectureGroup
lectureGroup
)
{
this
.
lectureGroup
=
lectureGroup
;
}
public
List
<
EventUser
>
getParticipants
()
{
return
participants
;
}
public
void
setParticipants
(
List
<
EventUser
>
participants
)
{
this
.
participants
=
participants
;
}
public
List
<
Role
>
getOpenForRoles
()
{
return
openForRoles
;
}
public
void
setOpenForRoles
(
List
<
Role
>
openForRoles
)
{
this
.
openForRoles
=
openForRoles
;
}
public
Integer
getMaxParticipantsCount
()
{
return
maxParticipantsCount
;
}
public
void
setMaxParticipantsCount
(
Integer
maxParticipantsCount
)
{
this
.
maxParticipantsCount
=
maxParticipantsCount
;
}
public
Calendar
getStartTime
()
{
return
startTime
;
}
public
void
setStartTime
(
Calendar
startTime
)
{
this
.
startTime
=
startTime
;
}
public
Calendar
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Calendar
endTime
)
{
this
.
endTime
=
endTime
;
}
public
boolean
isFull
()
{
return
(
getParticipants
().
size
()
>=
maxParticipantsCount
);
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/LectureGroup.java
0 → 100644
View file @
3cfd73d
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package
fi
.
codecrew
.
moya
.
model
;
import
java.util.List
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Lob
;
import
javax.persistence.OneToMany
;
import
javax.persistence.Table
;
import
org.eclipse.persistence.annotations.OptimisticLocking
;
import
org.eclipse.persistence.annotations.OptimisticLockingType
;
/**
* Group for lectures, so you can set limits how many of these the user can choose
*/
@Entity
@Table
(
name
=
"lecture_groups"
)
@OptimisticLocking
(
type
=
OptimisticLockingType
.
CHANGED_COLUMNS
)
public
class
LectureGroup
extends
GenericEntity
{
private
static
final
long
serialVersionUID
=
3L
;
@Column
(
name
=
"select_count"
)
private
Integer
selectCount
;
@Column
(
name
=
"name"
)
private
String
name
;
@Lob
@Column
(
name
=
"description"
)
private
String
description
;
@OneToMany
(
mappedBy
=
"lectureGroup"
)
private
List
<
Lecture
>
lectures
;
public
LectureGroup
()
{
super
();
}
public
Integer
getSelectCount
()
{
return
selectCount
;
}
public
void
setSelectCount
(
Integer
selectCount
)
{
this
.
selectCount
=
selectCount
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
}
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