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 9c15227b
authored
Sep 01, 2013
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tournament shenanigans
1 parent
863ae773
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
10 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/TournamentFacade.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Tournament.java
code/MoyaWeb/WebContent/tournaments/admin/index.xhtml
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentAdminView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/TournamentBean.java
View file @
9c15227
...
...
@@ -6,6 +6,7 @@ import javax.ejb.EJB;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.codecrew.moya.enums.TournamentStatus
;
import
fi.codecrew.moya.facade.TournamentFacade
;
import
fi.codecrew.moya.facade.TournamentGameFacade
;
import
fi.codecrew.moya.facade.TournamentRuleFacade
;
...
...
@@ -65,4 +66,9 @@ public class TournamentBean implements TournamentBeanLocal {
public
void
createTournament
(
Tournament
tournament
)
{
tournamentFacade
.
create
(
tournament
);
}
@Override
public
List
<
Tournament
>
getActiveTournaments
()
{
return
tournamentFacade
.
getTournamentsNotInStatus
(
TournamentStatus
.
COMPLETED
);
}
}
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/TournamentFacade.java
View file @
9c15227
package
fi
.
codecrew
.
moya
.
facade
;
import
java.util.List
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Root
;
import
fi.codecrew.moya.enums.TournamentStatus
;
import
fi.codecrew.moya.model.Tournament
;
import
fi.codecrew.moya.model.Tournament_
;
import
fi.codecrew.moya.model.User
;
import
fi.codecrew.moya.model.User_
;
@Stateless
@LocalBean
...
...
@@ -11,5 +20,15 @@ public class TournamentFacade extends IntegerPkGenericFacade<Tournament> {
public
TournamentFacade
()
{
super
(
Tournament
.
class
);
}
public
List
<
Tournament
>
getTournamentsNotInStatus
(
TournamentStatus
status
)
{
CriteriaBuilder
cb
=
getEm
().
getCriteriaBuilder
();
CriteriaQuery
<
Tournament
>
cq
=
cb
.
createQuery
(
Tournament
.
class
);
Root
<
Tournament
>
root
=
cq
.
from
(
Tournament
.
class
);
cq
.
where
(
cb
.
notEqual
(
root
.
get
(
Tournament_
.
tournamentStatus
),
status
));
return
getEm
().
createQuery
(
cq
).
getResultList
();
}
}
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/TournamentBeanLocal.java
View file @
9c15227
...
...
@@ -18,5 +18,6 @@ public interface TournamentBeanLocal {
TournamentGame
findGame
(
Integer
id
);
TournamentRule
findRule
(
Integer
id
);
void
createTournament
(
Tournament
tournament
);
List
<
Tournament
>
getActiveTournaments
();
}
code/MoyaDatabase/src/fi/codecrew/moya/model/Tournament.java
View file @
9c15227
...
...
@@ -65,14 +65,6 @@ public class Tournament extends GenericEntity implements Serializable {
@JoinColumn
(
name
=
"rules"
,
nullable
=
false
)
private
TournamentRule
rules
;
public
TournamentRule
getRules
()
{
return
rules
;
}
public
void
setRules
(
TournamentRule
rules
)
{
this
.
rules
=
rules
;
}
@OneToMany
@OrderBy
(
"id ASC"
)
...
...
@@ -183,4 +175,11 @@ public class Tournament extends GenericEntity implements Serializable {
public
void
setSubTournaments
(
List
<
Tournament
>
subTournaments
)
{
this
.
subTournaments
=
subTournaments
;
}
public
TournamentRule
getRules
()
{
return
rules
;
}
public
void
setRules
(
TournamentRule
rules
)
{
this
.
rules
=
rules
;
}
}
code/MoyaWeb/WebContent/tournaments/admin/index.xhtml
View file @
9c15227
...
...
@@ -13,7 +13,44 @@
<h1>
#{i18n['tournaments.admin.title']}
</h1>
<p>
#{i18n['tournaments.admin.description']}
</p>
<h2>
#{i18n['tournaments.active_tournaments']}
</h2>
<!-- <p:dataTable styleClass="bordertable" id="actionlogtable" value="#{actionLogMessageView.messages}" var="message" paginator="true" rows="30" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="10,20,30,50,100" > -->
<p:dataTable
value=
"#{tournamentAdminView.activeTournaments}"
var=
"tournament"
>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.name']}"
/>
</f:facet>
<h:outputText
value=
"#{tournament.tournamentName}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.status']}"
/>
</f:facet>
<h:outputText
value=
"#{tournament.tournamentStatus}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.type']}"
/>
</f:facet>
<h:outputText
value=
"#{tournament.tournamentType}"
/>
</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}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.game']}"
/>
</f:facet>
<h:outputText
value=
"#{tournament.tournamentGame.name}"
/>
</p:column>
<p:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['tournament.rules']}"
/>
</f:facet>
<h:outputText
value=
"#{tournament.rules.name}"
/>
</p:column>
</p:dataTable>
</ui:define>
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/tournaments/TournamentAdminView.java
View file @
9c15227
...
...
@@ -15,6 +15,7 @@ public class TournamentAdminView {
@EJB
private
TournamentBeanLocal
tournamentBean
;
public
List
<
Tournament
>
getActiveTournaments
()
{
return
null
;
List
<
Tournament
>
tl
=
tournamentBean
.
getActiveTournaments
();
return
tl
;
}
}
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