Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
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 69904e1f
authored
Sep 01, 2013
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TournamentStuff
1 parent
2ee18976
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
56 additions
and
4 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/MoyaDatabase/src/fi/codecrew/moya/model/TournamentParticipant.java
code/MoyaWeb/WebContent/tournaments/admin/createwizard.xhtml
code/MoyaWeb/WebContent/tournaments/admin/index.xhtml
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentCreateView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentListView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/BootstrapBean.java
View file @
69904e1
...
...
@@ -29,6 +29,8 @@ public class BootstrapBean implements BootstrapBeanLocal {
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 tournaments ADD COLUMN rules integer NOT NULL REFERENCES tournament_rules(id)"
});
dbUpdates
.
add
(
new
String
[]
{
"ALTER TABLE tournaments ADD COLUMN max_participants integer NOT NULL DEFAULT 0"
});
dbUpdates
.
add
(
new
String
[]
{
"ALTER TABLE tournament_participants ADD COLUMN tournament integer NOT NULL REFERENCES tournaments(id)"
});
// dbUpdates.add(new String[] { "ALTER TABLE users ALTER COLUMN birthday TYPE date" });
}
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
View file @
69904e1
...
...
@@ -43,8 +43,8 @@ public class TournamentBean implements TournamentBeanLocal {
}
@Override
public
void
createGame
(
TournamentGame
tg
)
{
tournamentGameFacade
.
create
(
tg
);
public
TournamentGame
createGame
(
TournamentGame
tg
)
{
return
tournamentGameFacade
.
create
(
tg
);
}
@Override
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
View file @
69904e1
...
...
@@ -13,7 +13,7 @@ public interface TournamentBeanLocal {
List
<
TournamentGame
>
getGames
();
List
<
TournamentRule
>
getRulesByGame
(
TournamentGame
tg
);
void
createGame
(
TournamentGame
tg
);
TournamentGame
createGame
(
TournamentGame
tg
);
TournamentRule
createRule
(
TournamentRule
tr
);
TournamentGame
findGame
(
Integer
id
);
TournamentRule
findRule
(
Integer
id
);
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/Tournament.java
View file @
69904e1
...
...
@@ -51,6 +51,7 @@ public class Tournament extends GenericEntity implements Serializable {
@Enumerated
(
EnumType
.
STRING
)
private
TournamentStatus
tournamentStatus
;
@OneToOne
@JoinColumn
(
name
=
"tournament_root"
)
private
TournamentMatch
tournamentRoot
;
...
...
@@ -60,9 +61,14 @@ public class Tournament extends GenericEntity implements Serializable {
@Column
(
name
=
"players_per_team"
)
private
Integer
playersPerTeam
;
@Column
(
name
=
"max_participants"
)
private
Integer
maxParticipants
;
@ManyToOne
@JoinColumn
(
name
=
"game"
,
nullable
=
false
)
private
TournamentGame
tournamentGame
;
@ManyToOne
@JoinColumn
(
name
=
"rules"
,
nullable
=
false
)
private
TournamentRule
rules
;
...
...
@@ -70,6 +76,9 @@ public class Tournament extends GenericEntity implements Serializable {
@OrderBy
(
"id ASC"
)
private
List
<
Tournament
>
subTournaments
;
@OneToMany
private
List
<
TournamentParticipant
>
participants
;
public
Tournament
()
{
super
();
}
public
Integer
getTalynTournamentId
()
{
...
...
@@ -182,4 +191,20 @@ public class Tournament extends GenericEntity implements Serializable {
public
void
setRules
(
TournamentRule
rules
)
{
this
.
rules
=
rules
;
}
public
Integer
getMaxParticipants
()
{
return
maxParticipants
;
}
public
void
setMaxParticipants
(
Integer
maxParticipants
)
{
this
.
maxParticipants
=
maxParticipants
;
}
public
List
<
TournamentParticipant
>
getParticipants
()
{
return
participants
;
}
public
void
setTournamentParticipants
(
List
<
TournamentParticipant
>
participants
)
{
this
.
participants
=
participants
;
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/TournamentParticipant.java
View file @
69904e1
...
...
@@ -25,6 +25,10 @@ public class TournamentParticipant extends GenericEntity implements Serializable
@OneToMany
private
List
<
EventUser
>
teamMembers
;
@ManyToOne
@JoinColumn
(
name
=
"tournament"
)
private
Tournament
tournament
;
public
TournamentParticipant
()
{
super
();
}
...
...
code/MoyaWeb/WebContent/tournaments/admin/createwizard.xhtml
View file @
69904e1
...
...
@@ -80,6 +80,14 @@
<f:selectItems
value=
"#{tournamentCreateView.tournamentTypes}"
var=
"val"
itemLabel=
"#{val}"
/>
</h:selectOneMenu>
<br
/>
<h:outputText
value=
"#{i18n['tournaments.max_participants']}"
/>
<h:panelGrid
columns=
"1"
style=
"margin-bottom:10px"
>
<p:inputText
id=
"maxParticipantsSlider"
value=
"#{tournamentCreateView.tournament.maxParticipants}"
/>
<p:slider
for=
"maxParticipantsSlider"
/>
</h:panelGrid>
<h:outputText
value=
"#{i18n['tournaments.players_per_match']}"
/>
<h:panelGrid
columns=
"1"
style=
"margin-bottom:10px"
>
<p:inputText
id=
"playerSlider"
value=
"#{tournamentCreateView.tournament.playersPerMatch}"
/>
...
...
code/MoyaWeb/WebContent/tournaments/admin/index.xhtml
View file @
69904e1
...
...
@@ -34,6 +34,12 @@
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.fillamount']}"
/>
</f:facet>
<h:outputText
value=
"#{tournament.participants.size()}/#{tournament.maxParticipants}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.playerspermatch_slash_teamsize']}"
/>
</f:facet>
<h:outputText
value=
"#{tournament.playersPerMatch}/#{tournament.playersPerTeam}"
/>
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentCreateView.java
View file @
69904e1
...
...
@@ -50,11 +50,13 @@ public class TournamentCreateView extends GenericCDIView {
this
.
beginConversation
();
tournament
=
new
Tournament
();
tournament
.
setPlayersPerMatch
(
0
);
tournament
.
setMaxParticipants
(
0
);
backupPlayers
=
0
;
tournamentGames
=
tournamentBean
.
getGames
();
}
}
public
String
save
()
{
tournament
.
setPlayersPerTeam
(
tournament
.
getPlayersPerMatch
()
+
backupPlayers
);
tournament
.
setLanEvent
(
eventBean
.
getCurrentEvent
());
...
...
@@ -95,7 +97,7 @@ public class TournamentCreateView extends GenericCDIView {
tg
.
setDescription
(
tournamentGameDescription
);
tg
.
setLanEvent
(
eventBean
.
getCurrentEvent
());
tournamentBean
.
createGame
(
tg
);
game
=
tournamentBean
.
createGame
(
tg
);
}
tournamentRules
=
tournamentBean
.
getRulesByGame
(
game
);
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentListView.java
0 → 100644
View file @
69904e1
package
fi
.
codecrew
.
moya
.
web
.
cdiview
.
tournaments
;
public
class
TournamentListView
{
}
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