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 1aaf2bac
authored
Aug 31, 2013
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add game to tournament and update db
1 parent
155aceb3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
13 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Tournament.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentCreateView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
View file @
1aaf2ba
...
@@ -27,6 +27,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
...
@@ -27,6 +27,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
static
{
static
{
// {"Query1","Query2",...}
// {"Query1","Query2",...}
dbUpdates
.
add
(
new
String
[]
{
""
});
// first version, no changes
dbUpdates
.
add
(
new
String
[]
{
""
});
// first version, no changes
dbUpdates
.
add
(
new
String
[]
{
"ALTER TABLE tournaments ADD COLUMN game integer NOT NULL REFERENCES tournament_games(id)"
});
// dbUpdates.add(new String[] { "ALTER TABLE users ALTER COLUMN birthday TYPE date" });
// dbUpdates.add(new String[] { "ALTER TABLE users ALTER COLUMN birthday TYPE date" });
}
}
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
View file @
1aaf2ba
...
@@ -8,7 +8,7 @@ import javax.ejb.Stateless;
...
@@ -8,7 +8,7 @@ import javax.ejb.Stateless;
*/
*/
@Stateless
@Stateless
@LocalBean
@LocalBean
public
class
TournamentBean
{
public
class
TournamentBean
implements
TournamentBeanLocal
{
/**
/**
* Default constructor.
* Default constructor.
...
@@ -16,6 +16,5 @@ public class TournamentBean {
...
@@ -16,6 +16,5 @@ public class TournamentBean {
public
TournamentBean
()
{
public
TournamentBean
()
{
// TODO Auto-generated constructor stub
// TODO Auto-generated constructor stub
}
}
}
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
0 → 100644
View file @
1aaf2ba
package
fi
.
codecrew
.
moya
.
beans
;
import
javax.ejb.Local
;
@Local
public
interface
TournamentBeanLocal
{
}
code/MoyaDatabase/src/fi/codecrew/moya/model/Tournament.java
View file @
1aaf2ba
...
@@ -60,6 +60,9 @@ public class Tournament extends GenericEntity implements Serializable {
...
@@ -60,6 +60,9 @@ public class Tournament extends GenericEntity implements Serializable {
@Column
(
name
=
"players_per_team"
)
@Column
(
name
=
"players_per_team"
)
private
Integer
playersPerTeam
;
private
Integer
playersPerTeam
;
@JoinColumn
(
name
=
"game"
,
nullable
=
false
)
private
TournamentGame
tournamentGame
;
@OneToMany
@OneToMany
@OrderBy
(
"id ASC"
)
@OrderBy
(
"id ASC"
)
private
List
<
Tournament
>
subTournaments
;
private
List
<
Tournament
>
subTournaments
;
...
@@ -105,4 +108,12 @@ public class Tournament extends GenericEntity implements Serializable {
...
@@ -105,4 +108,12 @@ public class Tournament extends GenericEntity implements Serializable {
public
void
setTournamentType
(
TournamentType
tournamentType
)
{
public
void
setTournamentType
(
TournamentType
tournamentType
)
{
this
.
tournamentType
=
tournamentType
;
this
.
tournamentType
=
tournamentType
;
}
}
public
TournamentGame
getTournamentGame
()
{
return
tournamentGame
;
}
public
void
setTournamentGame
(
TournamentGame
tournamentGame
)
{
this
.
tournamentGame
=
tournamentGame
;
}
}
}
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentCreateView.java
View file @
1aaf2ba
...
@@ -2,7 +2,11 @@ package fi.codecrew.moya.web.cdiview.tournaments;
...
@@ -2,7 +2,11 @@ package fi.codecrew.moya.web.cdiview.tournaments;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
fi.codecrew.moya.beans.TournamentBeanLocal
;
import
fi.codecrew.moya.model.Role
;
import
fi.codecrew.moya.model.Role
;
import
fi.codecrew.moya.model.Tournament
;
import
fi.codecrew.moya.model.TournamentGame
;
import
fi.codecrew.moya.model.TournamentRule
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
...
@@ -14,26 +18,29 @@ import org.primefaces.event.FlowEvent;
...
@@ -14,26 +18,29 @@ import org.primefaces.event.FlowEvent;
@Named
@Named
@ConversationScoped
@ConversationScoped
public
class
TournamentCreateView
implements
Serializable
{
public
class
TournamentCreateView
extends
GenericCDIView
{
/**
*
*/
private
static
final
long
serialVersionUID
=
2547358764980373797L
;
private
static
final
long
serialVersionUID
=
2547358764980373797L
;
private
TournamentRule
rules
=
null
;
private
TournamentGame
game
=
null
;
private
Tournament
tournament
=
null
;
@EJB
TournamentBeanLocal
tournamentBean
;
public
void
initView
()
{
public
void
initView
()
{
System
.
out
.
println
(
"MOI"
);
if
(
tournament
==
null
)
{
this
.
beginConversation
();
tournament
=
new
Tournament
();
}
}
}
// called on finish
public
void
save
(
ActionEvent
actionEvent
)
{
public
void
save
(
ActionEvent
actionEvent
)
{
}
}
public
String
onFlowProcess
(
FlowEvent
event
)
{
public
String
onFlowProcess
(
FlowEvent
event
)
{
System
.
out
.
println
(
event
.
getOldStep
());
return
event
.
getNewStep
();
return
event
.
getNewStep
();
}
}
}
}
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