├── de.hatoka.group
├── .gitignore
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── application-test.properties
│ │ │ └── logback-test.xml
│ │ └── java
│ │ │ ├── tests
│ │ │ └── de
│ │ │ │ └── hatoka
│ │ │ │ └── group
│ │ │ │ └── GroupTestConfiguration.java
│ │ │ └── de
│ │ │ └── hatoka
│ │ │ └── group
│ │ │ └── internal
│ │ │ └── persistence
│ │ │ ├── GroupDaoTest.java
│ │ │ └── MemberDaoTest.java
│ └── main
│ │ └── java
│ │ └── de
│ │ └── hatoka
│ │ └── group
│ │ ├── capi
│ │ ├── business
│ │ │ ├── GroupBusinessFactory.java
│ │ │ ├── GroupAdminBO.java
│ │ │ ├── GroupMemberBO.java
│ │ │ ├── GroupBOComparators.java
│ │ │ ├── MemberBOComparators.java
│ │ │ ├── GroupBO.java
│ │ │ ├── GroupBORepository.java
│ │ │ └── GroupRef.java
│ │ ├── GroupConfiguration.java
│ │ └── remote
│ │ │ ├── GroupInfoRO.java
│ │ │ ├── GroupDataRO.java
│ │ │ └── GroupRO.java
│ │ └── internal
│ │ ├── business
│ │ ├── GroupBOFactory.java
│ │ ├── GroupAdminBOFactory.java
│ │ ├── GroupMemberBOFactory.java
│ │ ├── GroupBOFactoryImpl.java
│ │ ├── GroupAdminBOFactoryImpl.java
│ │ └── GroupMemberBOFactoryImpl.java
│ │ ├── persistence
│ │ ├── GroupDao.java
│ │ ├── GroupAdminDao.java
│ │ └── GroupMemberDao.java
│ │ └── remote
│ │ └── GroupBO2RO.java
└── build.gradle
├── de.hatoka.user
├── .gitignore
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── application-test.properties
│ │ │ └── logback-test.xml
│ │ └── java
│ │ │ ├── tests
│ │ │ └── de
│ │ │ │ └── hatoka
│ │ │ │ └── user
│ │ │ │ └── UserTestConfiguration.java
│ │ │ └── de
│ │ │ └── hatoka
│ │ │ └── user
│ │ │ ├── capi
│ │ │ └── business
│ │ │ │ └── UserRefTest.java
│ │ │ └── internal
│ │ │ └── persistence
│ │ │ └── UserDaoTest.java
│ └── main
│ │ ├── webapp
│ │ ├── WEB-INF
│ │ │ ├── resources
│ │ │ │ └── css
│ │ │ │ │ ├── account.less
│ │ │ │ │ └── login.css
│ │ │ └── web.xml
│ │ ├── index.html
│ │ └── META-INF
│ │ │ └── context.xml
│ │ ├── resources
│ │ └── de
│ │ │ └── hatoka
│ │ │ └── user
│ │ │ └── internal
│ │ │ └── templates
│ │ │ ├── app
│ │ │ ├── login_de.properties
│ │ │ └── login_en.properties
│ │ │ └── mail
│ │ │ ├── signup_en.properties
│ │ │ └── signUpVerifyEmail.html.xslt
│ │ └── java
│ │ └── de
│ │ └── hatoka
│ │ └── user
│ │ ├── internal
│ │ ├── business
│ │ │ ├── UserBOFactory.java
│ │ │ ├── UserBOFactoryImpl.java
│ │ │ └── UserBORepositoryImpl.java
│ │ └── persistence
│ │ │ └── UserDao.java
│ │ └── capi
│ │ ├── UserConfiguration.java
│ │ └── business
│ │ ├── UserBORepository.java
│ │ ├── UserBO.java
│ │ └── UserRef.java
└── build.gradle
├── de.hatoka.common
├── .gitignore
├── src
│ ├── main
│ │ ├── java
│ │ │ └── de
│ │ │ │ └── hatoka
│ │ │ │ └── common
│ │ │ │ ├── capi
│ │ │ │ ├── configuration
│ │ │ │ │ ├── DateProvider.java
│ │ │ │ │ └── SystemPropertyProvider.java
│ │ │ │ ├── CommonConfiguration.java
│ │ │ │ ├── math
│ │ │ │ │ ├── CurrencyConstants.java
│ │ │ │ │ ├── Unit.java
│ │ │ │ │ ├── BigDecimalConstants.java
│ │ │ │ │ └── UnitScale.java
│ │ │ │ ├── locale
│ │ │ │ │ └── LocalizationConstants.java
│ │ │ │ ├── exceptions
│ │ │ │ │ ├── MandatoryParameterException.java
│ │ │ │ │ └── DuplicateObjectException.java
│ │ │ │ ├── rest
│ │ │ │ │ ├── JsonSerializationException.java
│ │ │ │ │ ├── DateParseException.java
│ │ │ │ │ ├── ErrorROFactory.java
│ │ │ │ │ ├── RestControllerException.java
│ │ │ │ │ └── ErrorRO.java
│ │ │ │ ├── persistence
│ │ │ │ │ ├── MoneyPOConverter.java
│ │ │ │ │ ├── PricePO.java
│ │ │ │ │ └── QuantityPO.java
│ │ │ │ └── encoding
│ │ │ │ │ ├── StringSerializer.java
│ │ │ │ │ └── ObjectSerializer.java
│ │ │ │ └── internal
│ │ │ │ └── configuration
│ │ │ │ └── CurrentDateProvider.java
│ │ └── resources
│ │ │ └── logback.xml
│ └── test
│ │ ├── java
│ │ └── de
│ │ │ └── hatoka
│ │ │ └── common
│ │ │ └── capi
│ │ │ ├── locale
│ │ │ └── DateTest.java
│ │ │ ├── encoding
│ │ │ └── StringSerializerTest.java
│ │ │ ├── math
│ │ │ ├── ComparatorsTest.java
│ │ │ ├── PriceTest.java
│ │ │ └── QuantityTest.java
│ │ │ └── rest
│ │ │ └── MoneyDeserializerTest.java
│ │ └── resources
│ │ └── logback-test.xml
└── build.gradle
├── de.hatoka.player
├── .gitignore
├── src
│ ├── main
│ │ └── java
│ │ │ └── de
│ │ │ └── hatoka
│ │ │ └── player
│ │ │ ├── capi
│ │ │ ├── types
│ │ │ │ └── HistoryEntryType.java
│ │ │ ├── PlayerConfiguration.java
│ │ │ ├── remote
│ │ │ │ ├── PlayerDataRO.java
│ │ │ │ ├── HistoryEntryRO.java
│ │ │ │ ├── PlayerRO.java
│ │ │ │ └── PlayerInfoRO.java
│ │ │ └── business
│ │ │ │ ├── HistoryEntryBO.java
│ │ │ │ ├── HistoryBORepository.java
│ │ │ │ ├── PlayerBO.java
│ │ │ │ └── PlayerBORepository.java
│ │ │ └── internal
│ │ │ ├── business
│ │ │ ├── HistoryBOFactory.java
│ │ │ ├── PlayerBOFactory.java
│ │ │ ├── HistoryBOFactoryImpl.java
│ │ │ └── PlayerBOFactoryImpl.java
│ │ │ ├── persistence
│ │ │ ├── HistoryDao.java
│ │ │ └── PlayerDao.java
│ │ │ └── remote
│ │ │ ├── HistoryEntryBO2RO.java
│ │ │ └── PlayerBO2RO.java
│ └── test
│ │ ├── resources
│ │ ├── application-test.properties
│ │ ├── de
│ │ │ └── hatoka
│ │ │ │ └── tournament
│ │ │ │ └── internal
│ │ │ │ ├── templates
│ │ │ │ └── app
│ │ │ │ │ ├── tournament_no_unassigned.result.xml
│ │ │ │ │ ├── cashgame_history.result.xml
│ │ │ │ │ ├── player_list.result.xml
│ │ │ │ │ ├── tournament_list.result.xml
│ │ │ │ │ ├── tournament_players.result.xml
│ │ │ │ │ ├── tournament_bigscreen.result.xml
│ │ │ │ │ ├── cashgame_players.result.xml
│ │ │ │ │ └── tournament_tables.result.xml
│ │ │ │ └── business
│ │ │ │ └── tournament_export.result.xml
│ │ └── logback-test.xml
│ │ └── java
│ │ ├── tests
│ │ └── de
│ │ │ └── hatoka
│ │ │ └── player
│ │ │ ├── PlayerTestConfiguration.java
│ │ │ └── PlayerTestApplication.java
│ │ └── de
│ │ └── hatoka
│ │ └── player
│ │ └── capi
│ │ └── business
│ │ └── PlayerBORepositoryTest.java
└── build.gradle
├── gradle.properties
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── ide.gradle
├── de.hatoka.tournament
├── src
│ ├── main
│ │ └── java
│ │ │ └── de
│ │ │ └── hatoka
│ │ │ └── tournament
│ │ │ ├── capi
│ │ │ ├── business
│ │ │ │ ├── PauseBO.java
│ │ │ │ ├── BlindLevelBO.java
│ │ │ │ ├── TableBO.java
│ │ │ │ ├── TournamentBORepository.java
│ │ │ │ ├── RankBO.java
│ │ │ │ ├── TournamentRoundBO.java
│ │ │ │ ├── CompetitorComparators.java
│ │ │ │ └── CompetitorBO.java
│ │ │ ├── types
│ │ │ │ └── CompetitorState.java
│ │ │ └── TournamentConfiguration.java
│ │ │ └── internal
│ │ │ ├── business
│ │ │ ├── IPauseBO.java
│ │ │ ├── RankBOFactory.java
│ │ │ ├── IBlindLevelBO.java
│ │ │ ├── PauseBOFactory.java
│ │ │ ├── TournamentBOFactory.java
│ │ │ ├── BlindLevelBOFactory.java
│ │ │ ├── CompetitorBOFactory.java
│ │ │ ├── IRankBO.java
│ │ │ ├── ITableBO.java
│ │ │ ├── RankBOFactoryImpl.java
│ │ │ ├── PauseBOFactoryImpl.java
│ │ │ ├── TournamentBOFactoryImpl.java
│ │ │ ├── ITournamentBO.java
│ │ │ ├── TournamentBOComparators.java
│ │ │ ├── BlindLevelBOFactoryImpl.java
│ │ │ ├── CompetitorBOFactoryImpl.java
│ │ │ ├── TournamentTools.java
│ │ │ ├── ICompetitorBO.java
│ │ │ ├── RankPOComparators.java
│ │ │ ├── TableBOImpl.java
│ │ │ └── TournamentBORepositoryImpl.java
│ │ │ ├── persistence
│ │ │ ├── RankDao.java
│ │ │ ├── BlindLevelDao.java
│ │ │ ├── CompetitorDao.java
│ │ │ └── TournamentDao.java
│ │ │ └── remote
│ │ │ ├── model
│ │ │ ├── CashGameDataRO.java
│ │ │ ├── CashGameInfoRO.java
│ │ │ ├── TableRO.java
│ │ │ ├── CashGameRO.java
│ │ │ └── RankRO.java
│ │ │ └── mapper
│ │ │ ├── TableBO2RO.java
│ │ │ ├── RankBO2RO.java
│ │ │ ├── TournamentBO2RO.java
│ │ │ ├── CompetitorBO2RO.java
│ │ │ └── BlindLevelBO2RO.java
│ ├── test
│ │ ├── resources
│ │ │ ├── application-test.properties
│ │ │ ├── de
│ │ │ │ └── hatoka
│ │ │ │ │ └── tournament
│ │ │ │ │ └── internal
│ │ │ │ │ ├── templates
│ │ │ │ │ └── app
│ │ │ │ │ │ ├── tournament_no_unassigned.result.xml
│ │ │ │ │ │ ├── cashgame_history.result.xml
│ │ │ │ │ │ ├── player_list.result.xml
│ │ │ │ │ │ ├── tournament_list.result.xml
│ │ │ │ │ │ ├── tournament_players.result.xml
│ │ │ │ │ │ ├── tournament_bigscreen.result.xml
│ │ │ │ │ │ ├── cashgame_players.result.xml
│ │ │ │ │ │ └── tournament_tables.result.xml
│ │ │ │ │ └── business
│ │ │ │ │ └── tournament_export.result.xml
│ │ │ └── logback-test.xml
│ │ └── java
│ │ │ ├── tests
│ │ │ └── de
│ │ │ │ └── hatoka
│ │ │ │ └── tournament
│ │ │ │ ├── TournamentTestApplication.java
│ │ │ │ └── TournamentTestConfiguration.java
│ │ │ └── de
│ │ │ └── hatoka
│ │ │ └── tournament
│ │ │ └── internal
│ │ │ └── business
│ │ │ └── TournamentToolsTest.java
│ └── clickdummy
│ │ └── tournament
│ │ └── bigScreen.html
└── build.gradle
├── de.hatoka.cashgame
├── src
│ ├── test
│ │ ├── resources
│ │ │ ├── application-test.properties
│ │ │ ├── de
│ │ │ │ └── hatoka
│ │ │ │ │ └── tournament
│ │ │ │ │ └── internal
│ │ │ │ │ ├── templates
│ │ │ │ │ └── app
│ │ │ │ │ │ ├── tournament_no_unassigned.result.xml
│ │ │ │ │ │ ├── cashgame_history.result.xml
│ │ │ │ │ │ ├── player_list.result.xml
│ │ │ │ │ │ ├── tournament_list.result.xml
│ │ │ │ │ │ ├── tournament_players.result.xml
│ │ │ │ │ │ ├── tournament_bigscreen.result.xml
│ │ │ │ │ │ ├── cashgame_players.result.xml
│ │ │ │ │ │ ├── tournament_tables.result.xml
│ │ │ │ │ │ └── tournament_general.result.xml
│ │ │ │ │ └── business
│ │ │ │ │ └── tournament_export.result.xml
│ │ │ └── logback-test.xml
│ │ └── java
│ │ │ └── tests
│ │ │ └── de
│ │ │ └── hatoka
│ │ │ └── cashgame
│ │ │ ├── CashGameTestConfiguration.java
│ │ │ └── CashGameTestApplication.java
│ ├── main
│ │ └── java
│ │ │ └── de
│ │ │ └── hatoka
│ │ │ └── cashgame
│ │ │ ├── internal
│ │ │ ├── business
│ │ │ │ ├── CashGameBOFactory.java
│ │ │ │ ├── CompetitorBOFactory.java
│ │ │ │ ├── ICompetitorBO.java
│ │ │ │ ├── CashGameBOFactoryImpl.java
│ │ │ │ ├── CashGameBOComparators.java
│ │ │ │ ├── CompetitorBOFactoryImpl.java
│ │ │ │ └── CashGameComparators.java
│ │ │ ├── persistence
│ │ │ │ ├── CashGameCompetitorDao.java
│ │ │ │ └── CashGameDao.java
│ │ │ └── remote
│ │ │ │ ├── model
│ │ │ │ ├── CashGameDataRO.java
│ │ │ │ ├── CashGameInfoRO.java
│ │ │ │ ├── TableRO.java
│ │ │ │ ├── CashGameRO.java
│ │ │ │ └── RankRO.java
│ │ │ │ └── mapper
│ │ │ │ ├── CompetitorBO2RO.java
│ │ │ │ └── CashGameBO2RO.java
│ │ │ └── capi
│ │ │ ├── types
│ │ │ └── CompetitorState.java
│ │ │ ├── business
│ │ │ └── CashGameBORepository.java
│ │ │ └── CashGameConfiguration.java
│ └── clickdummy
│ │ └── tournament
│ │ └── bigScreen.html
└── build.gradle
├── CONTRIBUTORS.txt
├── de.hatoka.offlinepoker.service
└── src
│ ├── test
│ └── resources
│ │ ├── application-test.properties
│ │ └── logback-test.xml
│ └── main
│ ├── resources
│ ├── application-production.properties
│ ├── logback_json.xml
│ ├── logback.xml
│ └── application.properties
│ └── java
│ └── de
│ └── hatoka
│ └── offlinepoker
│ ├── logging
│ ├── UserConverter.java
│ └── RequestConverter.java
│ └── application
│ └── OfflinePokerApplication.java
├── docker-compose.yml
├── settings.gradle
├── .gitignore
├── .gitattributes
└── .github
├── dependabot.yml
└── workflows
└── gradle.yml
/de.hatoka.group/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 |
--------------------------------------------------------------------------------
/de.hatoka.user/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 |
--------------------------------------------------------------------------------
/de.hatoka.common/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 |
--------------------------------------------------------------------------------
/de.hatoka.player/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | versionMicrosoftSqlserverMssqlJdbc=11.2.3.jre17
2 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/test/resources/application-test.properties:
--------------------------------------------------------------------------------
1 | #test configuration
2 |
3 | spring.jpa.hibernate.ddl-auto=create-drop
4 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/test/resources/application-test.properties:
--------------------------------------------------------------------------------
1 | #test configuration
2 |
3 | spring.jpa.hibernate.ddl-auto=create-drop
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Thomas-Bergmann/poker-tournament/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/webapp/WEB-INF/resources/css/account.less:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Thomas-Bergmann/poker-tournament/HEAD/de.hatoka.user/src/main/webapp/WEB-INF/resources/css/account.less
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/webapp/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/types/HistoryEntryType.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.types;
2 |
3 | public enum HistoryEntryType
4 | {
5 | BuyIn, ReBuy, CashOut;
6 | }
7 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/application-test.properties:
--------------------------------------------------------------------------------
1 | security.basic.enable=false
2 | security.ignored=/**
3 |
4 | spring.jpa.hibernate.ddl-auto=create-drop
5 | spring.flyway.enabled=false
6 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/PauseBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 | public interface PauseBO extends TournamentRoundBO
4 | {
5 | }
6 |
--------------------------------------------------------------------------------
/gradle/ide.gradle:
--------------------------------------------------------------------------------
1 | idea{
2 | module{
3 | inheritOutputDirs = false
4 | outputDir = compileJava.destinationDir
5 | testOutputDir = compileTestJava.destinationDir
6 | }
7 | }
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/application-test.properties:
--------------------------------------------------------------------------------
1 | security.basic.enable=false
2 | security.ignored=/**
3 |
4 | spring.jpa.hibernate.ddl-auto=create-drop
5 | spring.flyway.enabled=false
6 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/application-test.properties:
--------------------------------------------------------------------------------
1 | security.basic.enable=false
2 | security.ignored=/**
3 |
4 | spring.jpa.hibernate.ddl-auto=create-drop
5 | spring.flyway.enabled=false
6 |
--------------------------------------------------------------------------------
/CONTRIBUTORS.txt:
--------------------------------------------------------------------------------
1 | The following people has contributed, at varying degree to
2 | the Offline Poker Tournament codebase;
3 |
4 | Thomas Bergmann offlinepoker@hatoka.de
5 |
6 |
7 | Thank you for joining.
8 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/test/resources/application-test.properties:
--------------------------------------------------------------------------------
1 | security.basic.enable=false
2 | security.ignored=/**
3 |
4 | spring.jpa.hibernate.ddl-auto=create-drop
5 | spring.flyway.enabled=false
6 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/configuration/DateProvider.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.configuration;
2 |
3 | import java.util.Date;
4 |
5 | public interface DateProvider
6 | {
7 | Date get();
8 | }
9 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/configuration/SystemPropertyProvider.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.configuration;
2 |
3 | public interface SystemPropertyProvider
4 | {
5 | String get(String key);
6 | }
7 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/resources/de/hatoka/user/internal/templates/app/login_de.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Thomas-Bergmann/poker-tournament/HEAD/de.hatoka.user/src/main/resources/de/hatoka/user/internal/templates/app/login_de.properties
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3"
2 | services:
3 | poker-service:
4 | hostname: poker-service
5 | image: "local/hatoka/offline-poker-cashgame:1.0.0-LOCAL"
6 | ports:
7 | - "8090:8090"
8 | - "9090:9090"
9 | env_file:
10 | - ".env"
11 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
4 | networkTimeout=10000
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/GroupBusinessFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import de.hatoka.user.capi.business.UserRef;
4 |
5 | public interface GroupBusinessFactory
6 | {
7 | GroupBORepository getGroupBORepository(UserRef user);
8 | }
9 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/IPauseBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import java.util.Date;
4 |
5 | public interface IPauseBO
6 | {
7 | Integer getPosition();
8 |
9 | void setStartDate(Date date);
10 | }
11 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'hatoka-offlinepoker'
2 |
3 | include 'de.hatoka.common'
4 | include 'de.hatoka.user'
5 | include 'de.hatoka.player'
6 | include 'de.hatoka.group'
7 | include 'de.hatoka.cashgame'
8 | include 'de.hatoka.tournament'
9 | include 'de.hatoka.offlinepoker.service'
10 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/GroupAdminBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import de.hatoka.user.capi.business.UserBO;
4 |
5 | public interface GroupAdminBO
6 | {
7 | UserBO getUser();
8 | GroupBO getGroup();
9 | void remove();
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/RankBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.tournament.internal.persistence.RankPO;
4 |
5 | public interface RankBOFactory
6 | {
7 | IRankBO get(RankPO po, ITournamentBO tournamentBO);
8 | }
9 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/BlindLevelBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 |
4 | public interface BlindLevelBO extends TournamentRoundBO
5 | {
6 | Integer getSmallBlind();
7 |
8 | Integer getBigBlind();
9 |
10 | Integer getAnte();
11 | }
12 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/internal/business/UserBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.internal.business;
2 |
3 | import de.hatoka.user.capi.business.UserBO;
4 | import de.hatoka.user.internal.persistence.UserPO;
5 |
6 | public interface UserBOFactory
7 | {
8 | UserBO get(UserPO userPO);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/business/GroupBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.business;
2 |
3 | import de.hatoka.group.capi.business.GroupBO;
4 | import de.hatoka.group.internal.persistence.GroupPO;
5 |
6 | public interface GroupBOFactory
7 | {
8 | GroupBO get(GroupPO groupPO);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/business/HistoryBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.business;
2 |
3 | import de.hatoka.player.capi.business.HistoryEntryBO;
4 | import de.hatoka.player.internal.persistence.HistoryPO;
5 |
6 | public interface HistoryBOFactory
7 | {
8 | HistoryEntryBO get(HistoryPO po);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/GroupMemberBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import java.util.Optional;
4 |
5 | import de.hatoka.player.capi.business.PlayerBO;
6 |
7 | public interface GroupMemberBO
8 | {
9 | Optional getPlayer();
10 | GroupBO getGroup();
11 | void remove();
12 | }
13 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/IBlindLevelBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import java.util.Date;
4 |
5 | import de.hatoka.tournament.capi.business.BlindLevelBO;
6 |
7 | public interface IBlindLevelBO extends BlindLevelBO
8 | {
9 |
10 | void setStartDate(Date date);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/business/CashGameBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.business;
2 |
3 | import de.hatoka.cashgame.capi.business.CashGameBO;
4 | import de.hatoka.cashgame.internal.persistence.CashGamePO;
5 |
6 | public interface CashGameBOFactory
7 | {
8 | CashGameBO get(CashGamePO tournamentPO);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/CommonConfiguration.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi;
2 |
3 | import org.springframework.context.annotation.ComponentScan;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | @Configuration
7 | @ComponentScan(basePackages = { "de.hatoka.common" })
8 | public class CommonConfiguration
9 | {
10 | }
11 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/GroupBOComparators.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import java.util.Comparator;
4 |
5 | public final class GroupBOComparators
6 | {
7 | private GroupBOComparators()
8 | {
9 | }
10 |
11 | public static final Comparator BY_NAME = (a, b) -> a.getName().compareTo(b.getName());
12 | }
13 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/persistence/GroupDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.persistence;
2 |
3 | import java.util.Optional;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface GroupDao extends JpaRepository
8 | {
9 | Optional findByGlobalGroupRef(String globalGroupRef);
10 | }
11 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/PauseBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.tournament.capi.business.PauseBO;
4 | import de.hatoka.tournament.internal.persistence.BlindLevelPO;
5 |
6 | public interface PauseBOFactory
7 | {
8 | PauseBO get(BlindLevelPO po, ITournamentBO tournament);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/TournamentBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.tournament.capi.business.TournamentBO;
4 | import de.hatoka.tournament.internal.persistence.TournamentPO;
5 |
6 | public interface TournamentBOFactory
7 | {
8 | TournamentBO get(TournamentPO tournamentPO);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/persistence/RankDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.persistence;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface RankDao extends JpaRepository
8 | {
9 | List getByTournamentID(Long tournamentID);
10 | }
11 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/business/CompetitorBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.business;
2 |
3 | import de.hatoka.cashgame.capi.business.CashGameBO;
4 | import de.hatoka.cashgame.internal.persistence.CashGameCompetitorPO;
5 |
6 | public interface CompetitorBOFactory
7 | {
8 | ICompetitorBO get(CashGameCompetitorPO po, CashGameBO cashGame);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/BlindLevelBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.tournament.capi.business.BlindLevelBO;
4 | import de.hatoka.tournament.internal.persistence.BlindLevelPO;
5 |
6 | public interface BlindLevelBOFactory
7 | {
8 | BlindLevelBO get(BlindLevelPO po, ITournamentBO tournament);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/CompetitorBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.tournament.capi.business.TournamentBO;
4 | import de.hatoka.tournament.internal.persistence.CompetitorPO;
5 |
6 | public interface CompetitorBOFactory
7 | {
8 | ICompetitorBO get(CompetitorPO po, TournamentBO tournament);
9 | }
10 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/persistence/BlindLevelDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.persistence;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface BlindLevelDao extends JpaRepository
8 | {
9 | List getByTournamentID(Long tournamentID);
10 | }
11 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/persistence/CompetitorDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.persistence;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface CompetitorDao extends JpaRepository
8 | {
9 | List getByTournamentID(Long tournamentID);
10 | }
11 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/math/CurrencyConstants.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.math;
2 |
3 | import java.util.Currency;
4 |
5 | public class CurrencyConstants
6 | {
7 | public static final Currency EUR = Currency.getInstance("EUR");
8 | public static final Currency USD = Currency.getInstance("USD");
9 |
10 | private CurrencyConstants()
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/business/PlayerBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.business;
2 |
3 | import java.util.Optional;
4 |
5 | import de.hatoka.player.capi.business.PlayerBO;
6 | import de.hatoka.player.internal.persistence.PlayerPO;
7 |
8 | public interface PlayerBOFactory
9 | {
10 | PlayerBO get(PlayerPO po);
11 | Optional get(String ref);
12 | }
13 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/persistence/CashGameCompetitorDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.persistence;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface CashGameCompetitorDao extends JpaRepository
8 | {
9 | List getByCashGameID(Long cashGameID);
10 | }
11 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/locale/LocalizationConstants.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.locale;
2 |
3 | public class LocalizationConstants
4 | {
5 | public static final String XML_DATEFORMAT_MILLIS = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX";
6 | public static final String XML_DATEFORMAT_SECONDS = "yyyy-MM-dd'T'HH:mm:ssXXX";
7 | public static final String XML_DATEFORMAT_MINUTES = "yyyy-MM-dd'T'HH:mm";
8 | }
9 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/business/GroupAdminBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.business;
2 |
3 | import de.hatoka.group.capi.business.GroupAdminBO;
4 | import de.hatoka.group.capi.business.GroupBO;
5 | import de.hatoka.group.internal.persistence.GroupAdminPO;
6 |
7 | public interface GroupAdminBOFactory
8 | {
9 | GroupAdminBO get(GroupBO group, GroupAdminPO adminPO);
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/business/GroupMemberBOFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.business;
2 |
3 | import de.hatoka.group.capi.business.GroupBO;
4 | import de.hatoka.group.capi.business.GroupMemberBO;
5 | import de.hatoka.group.internal.persistence.GroupMemberPO;
6 |
7 | public interface GroupMemberBOFactory
8 | {
9 | GroupMemberBO get(GroupBO group, GroupMemberPO memberPO);
10 | }
11 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/persistence/HistoryDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.persistence;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface HistoryDao extends JpaRepository
8 | {
9 | List getByGameRef(String gameRef);
10 | List getByPlayerRef(String playerRef);
11 | }
12 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/types/CompetitorState.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.types;
2 |
3 | public enum CompetitorState
4 | {
5 | /**
6 | * player is registered
7 | */
8 | REGISTERED,
9 |
10 | /**
11 | * player is activly playing
12 | */
13 | ACTIVE,
14 |
15 | /**
16 | * player is out of tournament (has played)
17 | */
18 | OUT;
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/capi/types/CompetitorState.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.capi.types;
2 |
3 | public enum CompetitorState
4 | {
5 | /**
6 | * player is playing
7 | */
8 | ACTIVE,
9 |
10 | /**
11 | * player is not playing, but has not payed
12 | */
13 | INACTIVE,
14 |
15 | /**
16 | * player is out of tournament (has played)
17 | */
18 | OUT;
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/exceptions/MandatoryParameterException.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.exceptions;
2 |
3 | public class MandatoryParameterException extends IllegalArgumentException
4 | {
5 | private static final long serialVersionUID = 1L;
6 |
7 | public MandatoryParameterException(String parameterName)
8 | {
9 | super("Parameter '"+parameterName+"' is mandatory.");
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/persistence/GroupAdminDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.persistence;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface GroupAdminDao extends JpaRepository
8 | {
9 | List findByUserRef(String userRef);
10 |
11 | List findByGroupRef(String groupRef);
12 | }
13 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/IRankBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.common.capi.math.Money;
4 | import de.hatoka.tournament.capi.business.RankBO;
5 |
6 | public interface IRankBO extends RankBO
7 | {
8 | /**
9 | * Set amount for rank
10 | * @param amount for all players in thank rank
11 | */
12 | void setAmount(Money amount);
13 | }
14 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/persistence/GroupMemberDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.persistence;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface GroupMemberDao extends JpaRepository
8 | {
9 | List findByPlayerRef(String playerRef);
10 |
11 | List findByGroupRef(String groupRef);
12 | }
13 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/ITableBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.tournament.capi.business.CompetitorBO;
4 | import de.hatoka.tournament.capi.business.TableBO;
5 |
6 | /**
7 | * This interface is used by game game implementation to set internal data of a competitor
8 | */
9 | public interface ITableBO extends TableBO
10 | {
11 | void add(CompetitorBO competitorBO);
12 | }
13 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/exceptions/DuplicateObjectException.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.exceptions;
2 |
3 | public class DuplicateObjectException extends RuntimeException
4 | {
5 | private static final long serialVersionUID = 1L;
6 |
7 | public DuplicateObjectException(String type, String key, String value)
8 | {
9 | super("Object of type: '" + type + "' has contains violation " + key + " with data=" + value);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/internal/configuration/CurrentDateProvider.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.internal.configuration;
2 |
3 | import java.util.Date;
4 |
5 | import org.springframework.stereotype.Component;
6 |
7 | import de.hatoka.common.capi.configuration.DateProvider;
8 |
9 | @Component
10 | public class CurrentDateProvider implements DateProvider
11 | {
12 | @Override
13 | public Date get()
14 | {
15 | return new Date();
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/TableBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 | import java.util.List;
4 |
5 | public interface TableBO
6 | {
7 | /**
8 | * @return the number of this table unique for a tournament
9 | */
10 | int getTableNo();
11 |
12 | /**
13 | * @return players sitting at the table the position of the list is the position at the table
14 | */
15 | List getCompetitors();
16 | }
17 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/internal/persistence/UserDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.internal.persistence;
2 |
3 | import java.util.Optional;
4 |
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 |
7 | public interface UserDao extends JpaRepository
8 | {
9 | /**
10 | * @param externalRef
11 | * @return user with the given login or external reference
12 | */
13 | public Optional findByGlobalRef(String externalRef);
14 |
15 | }
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/persistence/CashGameDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.persistence;
2 |
3 | import java.util.List;
4 | import java.util.Optional;
5 |
6 | import org.springframework.data.jpa.repository.JpaRepository;
7 |
8 | public interface CashGameDao extends JpaRepository
9 | {
10 | Optional findByOwnerRefAndLocalRef(String ownerRef, String localRef);
11 |
12 | List getByOwnerRef(String ownerRef);
13 | }
14 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/persistence/PlayerDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.persistence;
2 |
3 | import java.util.List;
4 | import java.util.Optional;
5 |
6 | import org.springframework.data.jpa.repository.JpaRepository;
7 |
8 | public interface PlayerDao extends JpaRepository
9 | {
10 | public Optional findByContextRefAndPlayerRef(String contextRef, String localRef);
11 |
12 | public List getByContextRef(String contextRef);
13 | }
--------------------------------------------------------------------------------
/de.hatoka.common/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation 'javax.validation:validation-api'
3 | implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
4 | implementation 'org.springframework.boot:spring-boot-starter-web'
5 | implementation 'org.springframework.boot:spring-boot-starter-security'
6 |
7 | //Test
8 | testImplementation ('org.springframework.boot:spring-boot-starter-test') {
9 | exclude group: 'com.vaadin.external.google', module: 'android-json'
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/persistence/TournamentDao.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.persistence;
2 |
3 | import java.util.List;
4 | import java.util.Optional;
5 |
6 | import org.springframework.data.jpa.repository.JpaRepository;
7 |
8 | public interface TournamentDao extends JpaRepository
9 | {
10 | Optional findByOwnerRefAndLocalRef(String ownerRef, String localRef);
11 |
12 | List getByOwnerRef(String ownerRef);
13 | }
14 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/main/resources/application-production.properties:
--------------------------------------------------------------------------------
1 | ## Production Configuration
2 |
3 | ### DATABASE ##
4 | ##
5 | spring.datasource.url=${sqlazureconnstr_database}
6 | spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
7 | spring.jpa.hibernate.ddlAuto=${hibernate_init}
8 |
9 | ### Logback ##
10 | ##
11 | logging.config=classpath:logback_json.xml
12 |
13 | ### MIGRATION ##
14 | ##
15 | spring.flyway.baseline-on-migrate=true
16 | spring.flyway.enabled=${flyway_enabled}
17 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/TournamentBORepository.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 |
6 | import de.hatoka.user.capi.business.UserRef;
7 |
8 | /**
9 | * Access to tournaments of an user
10 | */
11 | public interface TournamentBORepository
12 | {
13 | TournamentBO createTournament(UserRef userRef, String localTournamentRef, Date startDate, String name);
14 | List getTournaments(UserRef userRef);
15 | }
16 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/capi/business/CashGameBORepository.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.capi.business;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 | import java.util.Optional;
6 |
7 | import de.hatoka.user.capi.business.UserRef;
8 |
9 | /**
10 | * Access to tournaments of an user
11 | */
12 | public interface CashGameBORepository
13 | {
14 | CashGameBO createCashGame(UserRef userRef, String localRef, Date date);
15 | Optional findCashGame(CashGameRef cashGameRef);
16 | List getCashGames(UserRef userRef);
17 | }
18 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/business/ICompetitorBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.business;
2 |
3 | import de.hatoka.cashgame.capi.business.CompetitorBO;
4 |
5 | /**
6 | * This interface is used by game game implementation to set internal data of a competitor
7 | */
8 | public interface ICompetitorBO extends CompetitorBO
9 | {
10 | /**
11 | * Defines the position of the player. The position is independent from
12 | * "inPlayStatus"
13 | *
14 | * @param position
15 | */
16 | void setPosition(Integer position);
17 | }
18 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_no_unassigned.result.xml:
--------------------------------------------------------------------------------
1 | 20 players assigned.
2 |
8 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/rest/JsonSerializationException.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.rest;
2 |
3 | public class JsonSerializationException extends RuntimeException
4 | {
5 | /**
6 | * serialVersionUID
7 | */
8 | private static final long serialVersionUID = -2645273110169623826L;
9 |
10 | public JsonSerializationException(Exception e)
11 | {
12 | super("Error while serializing", e);
13 | }
14 |
15 |
16 | public JsonSerializationException(String msg, Exception e)
17 | {
18 | super(msg, e);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_no_unassigned.result.xml:
--------------------------------------------------------------------------------
1 | 20 players assigned.
2 |
8 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_no_unassigned.result.xml:
--------------------------------------------------------------------------------
1 | 20 players assigned.
2 |
8 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/math/Unit.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.math;
2 |
3 |
4 | /**
5 | * Represents unit of measurement. E.g. kilogram
6 | */
7 | public enum Unit
8 | {
9 | PCS(""), GRAM("g"), METER("m"), LITER("l");
10 |
11 | private final String abbreviation;
12 |
13 | /**
14 | * @param abbreviation
15 | */
16 | private Unit(String abbreviation)
17 | {
18 | this.abbreviation = abbreviation;
19 | }
20 |
21 | @Override
22 | public String toString()
23 | {
24 | return abbreviation;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/RankBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.tournament.internal.persistence.RankPO;
7 |
8 | @Component
9 | public class RankBOFactoryImpl implements RankBOFactory
10 | {
11 | @Lookup
12 | @Override
13 | public IRankBO get(RankPO po, ITournamentBO tournamentBO)
14 | {
15 | // done by @Lookup
16 | return null;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/rest/DateParseException.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.rest;
2 |
3 | public class DateParseException extends RuntimeException
4 | {
5 | /**
6 | * serialVersionUID
7 | */
8 | private static final long serialVersionUID = -2645273110169623826L;
9 |
10 | public DateParseException(Exception e, String elementName)
11 | {
12 | super("Error while parsing element " + elementName, e);
13 | }
14 |
15 |
16 | public DateParseException(String msg, Exception e)
17 | {
18 | super(msg, e);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/internal/business/UserBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.user.capi.business.UserBO;
7 | import de.hatoka.user.internal.persistence.UserPO;
8 |
9 | @Component
10 | public class UserBOFactoryImpl implements UserBOFactory
11 | {
12 | @Lookup
13 | @Override
14 | public UserBO get(UserPO groupPO)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/business/GroupBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.group.capi.business.GroupBO;
7 | import de.hatoka.group.internal.persistence.GroupPO;
8 |
9 | @Component
10 | public class GroupBOFactoryImpl implements GroupBOFactory
11 | {
12 | @Lookup
13 | @Override
14 | public GroupBO get(GroupPO groupPO)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 | %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC} [%thread] %-5level %logger{36} %msg%n
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/cashgame_history.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | | Name |
4 | Action |
5 | Amount |
6 | Date |
7 |
8 |
9 | | Player 1 |
10 | Buy-In |
11 | 1 $ |
12 | 11/25/12 11:45 PM |
13 |
14 |
15 | | Player 2 |
16 | Re-Buy |
17 | 1 $ |
18 | 11/26/12 1:45 AM |
19 |
20 |
21 | | Player 3 |
22 | Cash-Out |
23 | 1 $ |
24 | 11/26/12 1:45 AM |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 | %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC} [%thread] %-5level %logger{36} %msg%n
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/persistence/MoneyPOConverter.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.persistence;
2 |
3 | import de.hatoka.common.capi.math.Money;
4 |
5 | public class MoneyPOConverter
6 | {
7 | public static Money valueOf(MoneyPO po)
8 | {
9 | return po == null ? Money.NOTHING : Money.valueOf(po.getAmount(), po.getCurrencyCode());
10 | }
11 |
12 | public static MoneyPO persistence(Money value)
13 | {
14 | return value == null || Money.NOTHING.equals(value) ? null : new MoneyPO(value.getAmount(), value.getCurrency().getCurrencyCode());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/cashgame_history.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | | Name |
4 | Action |
5 | Amount |
6 | Date |
7 |
8 |
9 | | Player 1 |
10 | Buy-In |
11 | 1 $ |
12 | 11/25/12 11:45 PM |
13 |
14 |
15 | | Player 2 |
16 | Re-Buy |
17 | 1 $ |
18 | 11/26/12 1:45 AM |
19 |
20 |
21 | | Player 3 |
22 | Cash-Out |
23 | 1 $ |
24 | 11/26/12 1:45 AM |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 | %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC} [%thread] %-5level %logger{36} %msg%n
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/test/java/tests/de/hatoka/user/UserTestConfiguration.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.user;
2 |
3 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4 | import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | import de.hatoka.common.capi.CommonConfiguration;
8 | import de.hatoka.user.capi.UserConfiguration;
9 |
10 | @Configuration
11 | @EnableAutoConfiguration
12 | @ImportAutoConfiguration({ UserConfiguration.class, CommonConfiguration.class })
13 | public class UserTestConfiguration
14 | {
15 | }
16 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/cashgame_history.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | | Name |
4 | Action |
5 | Amount |
6 | Date |
7 |
8 |
9 | | Player 1 |
10 | Buy-In |
11 | 1 $ |
12 | 11/25/12 11:45 PM |
13 |
14 |
15 | | Player 2 |
16 | Re-Buy |
17 | 1 $ |
18 | 11/26/12 1:45 AM |
19 |
20 |
21 | | Player 3 |
22 | Cash-Out |
23 | 1 $ |
24 | 11/26/12 1:45 AM |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/test/java/de/hatoka/user/capi/business/UserRefTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.capi.business;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | public class UserRefTest
8 | {
9 |
10 | private static final String ABC = "abc";
11 | private static final String USER_REF_ABC = "user:abc";
12 |
13 | @Test
14 | public void test()
15 | {
16 | assertEquals(ABC, UserRef.valueOfGlobal(USER_REF_ABC).getLocalRef());
17 | assertEquals(USER_REF_ABC, UserRef.valueOfGlobal(USER_REF_ABC).toString());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/business/HistoryBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.player.capi.business.HistoryEntryBO;
7 | import de.hatoka.player.internal.persistence.HistoryPO;
8 |
9 | @Component
10 | public class HistoryBOFactoryImpl implements HistoryBOFactory
11 | {
12 | @Lookup
13 | @Override
14 | public HistoryEntryBO get(HistoryPO po)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/business/CashGameBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.cashgame.capi.business.CashGameBO;
7 | import de.hatoka.cashgame.internal.persistence.CashGamePO;
8 |
9 | @Component
10 | public class CashGameBOFactoryImpl implements CashGameBOFactory
11 | {
12 | @Lookup
13 | @Override
14 | public CashGameBO get(CashGamePO po)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/business/CashGameBOComparators.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.business;
2 |
3 | import java.util.Comparator;
4 |
5 | import de.hatoka.cashgame.capi.business.CashGameBO;
6 |
7 | public final class CashGameBOComparators
8 | {
9 | private CashGameBOComparators()
10 | {
11 | }
12 |
13 | public static final Comparator DEFAULT_CASHGAME = new Comparator()
14 | {
15 | @Override
16 | public int compare(CashGameBO a, CashGameBO b)
17 | {
18 | return a.getDate().compareTo(b.getDate());
19 | }
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/MemberBOComparators.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import java.util.Comparator;
4 |
5 | import de.hatoka.common.capi.math.Comparators;
6 |
7 | public final class MemberBOComparators
8 | {
9 | private MemberBOComparators()
10 | {
11 | }
12 |
13 | public static final Comparator BY_NAME = (o1, o2) -> {
14 | if (o1 == null || o2 == null)
15 | {
16 | return Comparators.NULL.compare(o1, o2);
17 | }
18 | return Comparators.STRING.compare(o1.getPlayer().get().getName(), o2.getPlayer().get().getName());
19 | };
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/main/resources/logback_json.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | %n
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/PauseBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.tournament.capi.business.PauseBO;
7 | import de.hatoka.tournament.internal.persistence.BlindLevelPO;
8 |
9 | @Component
10 | public class PauseBOFactoryImpl implements PauseBOFactory
11 | {
12 | @Lookup
13 | @Override
14 | public PauseBO get(BlindLevelPO po, ITournamentBO tournament)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/TournamentBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.tournament.capi.business.TournamentBO;
7 | import de.hatoka.tournament.internal.persistence.TournamentPO;
8 |
9 | @Component
10 | public class TournamentBOFactoryImpl implements TournamentBOFactory
11 | {
12 | @Lookup
13 | @Override
14 | public TournamentBO get(TournamentPO po)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/capi/UserConfiguration.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.capi;
2 |
3 | import org.springframework.boot.autoconfigure.domain.EntityScan;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
7 |
8 | @Configuration
9 | @EntityScan(basePackages = { "de.hatoka.user.internal.persistence" })
10 | @EnableJpaRepositories(basePackages = { "de.hatoka.user.internal.persistence" })
11 | @ComponentScan(basePackages = { "de.hatoka.user.internal" })
12 | public class UserConfiguration
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/GroupConfiguration.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi;
2 |
3 | import org.springframework.boot.autoconfigure.domain.EntityScan;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
7 |
8 | @Configuration
9 | @EntityScan(basePackages = { "de.hatoka.group.internal.persistence" })
10 | @EnableJpaRepositories(basePackages = { "de.hatoka.group.internal.persistence" })
11 | @ComponentScan(basePackages = { "de.hatoka.group.internal" })
12 | public class GroupConfiguration
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/ITournamentBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.tournament.capi.business.TournamentBO;
4 |
5 | public interface ITournamentBO extends TournamentBO
6 | {
7 | void defineBlindLevelStartTimes();
8 |
9 | /**
10 | * starts the pause
11 | */
12 | void start(IPauseBO pause);
13 |
14 | Integer getCurrentRound();
15 |
16 | /**
17 | * starts the blind level
18 | */
19 | void start(IBlindLevelBO blindLevel);
20 |
21 | /**
22 | * inform tournament about deletion of rank
23 | */
24 | void removeRank(IRankBO rank);
25 | }
26 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/TournamentBOComparators.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import java.util.Comparator;
4 |
5 | import de.hatoka.tournament.capi.business.TournamentBO;
6 |
7 | public final class TournamentBOComparators
8 | {
9 | private TournamentBOComparators()
10 | {
11 | }
12 |
13 | public static final Comparator BY_STARTTIME = new Comparator()
14 | {
15 | @Override
16 | public int compare(TournamentBO a, TournamentBO b)
17 | {
18 | return a.getStartTime().compareTo(b.getStartTime());
19 | }
20 | };
21 | }
22 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/PlayerConfiguration.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi;
2 |
3 | import org.springframework.boot.autoconfigure.domain.EntityScan;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
7 |
8 | @Configuration
9 | @EntityScan(basePackages = { "de.hatoka.player.internal.persistence" })
10 | @EnableJpaRepositories(basePackages = { "de.hatoka.player.internal.persistence" })
11 | @ComponentScan(basePackages = { "de.hatoka.player.internal" })
12 | public class PlayerConfiguration
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/BlindLevelBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.tournament.capi.business.BlindLevelBO;
7 | import de.hatoka.tournament.internal.persistence.BlindLevelPO;
8 |
9 | @Component
10 | public class BlindLevelBOFactoryImpl implements BlindLevelBOFactory
11 | {
12 | @Lookup
13 | @Override
14 | public BlindLevelBO get(BlindLevelPO po, ITournamentBO tournament)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/remote/model/CashGameDataRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.remote.model;
2 |
3 | import java.util.Date;
4 |
5 | import de.hatoka.common.capi.math.Money;
6 |
7 | public class CashGameDataRO
8 | {
9 | private Date date;
10 | private Money buyIn;
11 |
12 | public Money getBuyIn()
13 | {
14 | return buyIn;
15 | }
16 |
17 | public Date getDate()
18 | {
19 | return date;
20 | }
21 |
22 | public void setBuyIn(Money buyIn)
23 | {
24 | this.buyIn = buyIn;
25 | }
26 |
27 | public void setDate(Date date)
28 | {
29 | this.date = date;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/de.hatoka.user/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation project(':de.hatoka.common')
3 |
4 | implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
5 | implementation 'org.springframework.boot:spring-boot-starter-web'
6 | implementation 'org.springframework.boot:spring-boot-starter-security'
7 |
8 | implementation 'javax.validation:validation-api'
9 |
10 | //Test
11 | testImplementation 'com.jayway.jsonpath:json-path'
12 | testImplementation group: 'org.skyscreamer', name: 'jsonassert'
13 | testImplementation 'org.springframework.boot:spring-boot-starter-test'
14 |
15 | //Database
16 | testRuntimeOnly 'com.h2database:h2'
17 | }
18 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/model/CashGameDataRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.model;
2 |
3 | import java.util.Date;
4 |
5 | import de.hatoka.common.capi.math.Money;
6 |
7 | public class CashGameDataRO
8 | {
9 | private Date date;
10 | private Money buyIn;
11 |
12 | public Money getBuyIn()
13 | {
14 | return buyIn;
15 | }
16 |
17 | public Date getDate()
18 | {
19 | return date;
20 | }
21 |
22 | public void setBuyIn(Money buyIn)
23 | {
24 | this.buyIn = buyIn;
25 | }
26 |
27 | public void setDate(Date date)
28 | {
29 | this.date = date;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/capi/CashGameConfiguration.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.capi;
2 |
3 | import org.springframework.boot.autoconfigure.domain.EntityScan;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
7 |
8 | @Configuration
9 | @EntityScan(basePackages = { "de.hatoka.cashgame.internal.persistence" })
10 | @EnableJpaRepositories(basePackages = { "de.hatoka.cashgame.internal.persistence" })
11 | @ComponentScan(basePackages = { "de.hatoka.cashgame.internal" })
12 | public class CashGameConfiguration
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/test/java/de/hatoka/common/capi/locale/DateTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.locale;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import java.text.SimpleDateFormat;
6 | import java.util.Date;
7 |
8 | import org.junit.jupiter.api.Test;
9 |
10 | public class DateTest
11 | {
12 | private static final long DATE_LONG = 1353829555000L;
13 |
14 | @Test
15 | public void testDateFormat() throws Exception
16 | {
17 | Date date = new SimpleDateFormat(LocalizationConstants.XML_DATEFORMAT_SECONDS).parse("2012-11-25T07:45:55Z");
18 | assertEquals(DATE_LONG, date.getTime(), "same date after toString and parse");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/webapp/META-INF/context.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/remote/model/CashGameInfoRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.remote.model;
2 |
3 | import de.hatoka.common.capi.math.Money;
4 |
5 | public class CashGameInfoRO
6 | {
7 | private Money average;
8 | private Money sumInPlay;
9 |
10 | public Money getAverage()
11 | {
12 | return average;
13 | }
14 |
15 | public Money getSumInPlay()
16 | {
17 | return sumInPlay;
18 | }
19 |
20 | public void setAverage(Money average)
21 | {
22 | this.average = average;
23 | }
24 |
25 | public void setSumInPlay(Money sumInPlay)
26 | {
27 | this.sumInPlay = sumInPlay;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/remote/PlayerDataRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.remote;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class PlayerDataRO
6 | {
7 | @JsonProperty("name")
8 | private String name;
9 | @JsonProperty("eMail")
10 | private String eMail;
11 |
12 | public String getName()
13 | {
14 | return name;
15 | }
16 |
17 | public void setName(String name)
18 | {
19 | this.name = name;
20 | }
21 |
22 | public String geteMail()
23 | {
24 | return eMail;
25 | }
26 |
27 | public void seteMail(String eMail)
28 | {
29 | this.eMail = eMail;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/business/CompetitorBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.cashgame.capi.business.CashGameBO;
7 | import de.hatoka.cashgame.internal.persistence.CashGameCompetitorPO;
8 |
9 | @Component("CashGameCompetitorBOFactory")
10 | public class CompetitorBOFactoryImpl implements CompetitorBOFactory
11 | {
12 | @Override
13 | @Lookup
14 | public ICompetitorBO get(CashGameCompetitorPO po, CashGameBO cashGame)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/business/GroupAdminBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.group.capi.business.GroupAdminBO;
7 | import de.hatoka.group.capi.business.GroupBO;
8 | import de.hatoka.group.internal.persistence.GroupAdminPO;
9 |
10 | @Component
11 | public class GroupAdminBOFactoryImpl implements GroupAdminBOFactory
12 | {
13 | @Lookup
14 | @Override
15 | public GroupAdminBO get(GroupBO groupBO, GroupAdminPO adminPO)
16 | {
17 | // done by spring framework
18 | return null;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/model/CashGameInfoRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.model;
2 |
3 | import de.hatoka.common.capi.math.Money;
4 |
5 | public class CashGameInfoRO
6 | {
7 | private Money average;
8 | private Money sumInPlay;
9 |
10 | public Money getAverage()
11 | {
12 | return average;
13 | }
14 |
15 | public Money getSumInPlay()
16 | {
17 | return sumInPlay;
18 | }
19 |
20 | public void setAverage(Money average)
21 | {
22 | this.average = average;
23 | }
24 |
25 | public void setSumInPlay(Money sumInPlay)
26 | {
27 | this.sumInPlay = sumInPlay;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/CompetitorBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.tournament.capi.business.TournamentBO;
7 | import de.hatoka.tournament.internal.persistence.CompetitorPO;
8 |
9 | @Component("TournamentCompetitorBOFactory")
10 | public class CompetitorBOFactoryImpl implements CompetitorBOFactory
11 | {
12 | @Override
13 | @Lookup
14 | public ICompetitorBO get(CompetitorPO po, TournamentBO tournament)
15 | {
16 | // done by @Lookup
17 | return null;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/business/GroupMemberBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.business;
2 |
3 | import org.springframework.beans.factory.annotation.Lookup;
4 | import org.springframework.stereotype.Component;
5 |
6 | import de.hatoka.group.capi.business.GroupBO;
7 | import de.hatoka.group.capi.business.GroupMemberBO;
8 | import de.hatoka.group.internal.persistence.GroupMemberPO;
9 |
10 | @Component
11 | public class GroupMemberBOFactoryImpl implements GroupMemberBOFactory
12 | {
13 | @Lookup
14 | @Override
15 | public GroupMemberBO get(GroupBO groupBO, GroupMemberPO memberPO)
16 | {
17 | // done by spring framework
18 | return null;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/TournamentConfiguration.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi;
2 |
3 | import org.springframework.boot.autoconfigure.domain.EntityScan;
4 | import org.springframework.context.annotation.ComponentScan;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
7 |
8 | @Configuration
9 | @EntityScan(basePackages = { "de.hatoka.tournament.internal.persistence" })
10 | @EnableJpaRepositories(basePackages = { "de.hatoka.tournament.internal.persistence" })
11 | @ComponentScan(basePackages = { "de.hatoka.tournament.internal", "de.hatoka.common" })
12 | public class TournamentConfiguration
13 | {
14 | }
15 |
--------------------------------------------------------------------------------
/de.hatoka.player/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation project(':de.hatoka.common')
3 | implementation project(':de.hatoka.user')
4 |
5 | implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
6 | implementation 'org.springframework.boot:spring-boot-starter-web'
7 | implementation 'org.springframework.boot:spring-boot-starter-security'
8 |
9 | implementation 'javax.validation:validation-api'
10 |
11 | //Test
12 | testImplementation 'com.jayway.jsonpath:json-path'
13 | testImplementation group: 'org.skyscreamer', name: 'jsonassert'
14 | testImplementation 'org.springframework.boot:spring-boot-starter-test'
15 |
16 | //Database
17 | testRuntimeOnly 'com.h2database:h2'
18 | }
19 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/remote/HistoryEntryBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.remote;
2 |
3 | import org.springframework.stereotype.Component;
4 |
5 | import de.hatoka.player.capi.business.HistoryEntryBO;
6 | import de.hatoka.player.capi.remote.HistoryEntryRO;
7 |
8 | @Component
9 | public class HistoryEntryBO2RO
10 | {
11 | public HistoryEntryRO apply(HistoryEntryBO historyBO)
12 | {
13 | HistoryEntryRO result = new HistoryEntryRO();
14 | result.setPlayerName(historyBO.getPlayer().getName());
15 | result.setType(historyBO.getType());
16 | result.setDate(historyBO.getDate());
17 | result.setAmount(historyBO.getAmount());
18 | return result;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/math/BigDecimalConstants.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.math;
2 |
3 | import java.math.BigDecimal;
4 |
5 | public final class BigDecimalConstants
6 | {
7 | public static final BigDecimal MILLI = new BigDecimal("0.001");
8 | public static final BigDecimal CENTI = MILLI.multiply(BigDecimal.TEN);
9 | public static final BigDecimal DECI = CENTI.multiply(BigDecimal.TEN);
10 | public static final BigDecimal HUNDRED = BigDecimal.TEN.multiply(BigDecimal.TEN);
11 | public static final BigDecimal THOUSAND = HUNDRED.multiply(BigDecimal.TEN);
12 | public static final BigDecimal MILLION = THOUSAND.multiply(THOUSAND);
13 |
14 | private BigDecimalConstants()
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/de.hatoka.group/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation project(':de.hatoka.common')
3 | implementation project(':de.hatoka.user')
4 | implementation project(':de.hatoka.player')
5 |
6 | implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
7 | implementation 'org.springframework.boot:spring-boot-starter-web'
8 | implementation 'org.springframework.boot:spring-boot-starter-security'
9 |
10 | implementation 'javax.validation:validation-api'
11 |
12 | //Test
13 | testImplementation 'com.jayway.jsonpath:json-path'
14 | testImplementation group: 'org.skyscreamer', name: 'jsonassert'
15 | testImplementation 'org.springframework.boot:spring-boot-starter-test'
16 |
17 | //Database
18 | testRuntimeOnly 'com.h2database:h2'
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/remote/GroupInfoRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.remote;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class GroupInfoRO
6 | {
7 | @JsonProperty("countMember")
8 | private int countMember = 0;
9 | @JsonProperty("countAdmin")
10 | private int countAdmin = 0;
11 |
12 | public int getCountMember()
13 | {
14 | return countMember;
15 | }
16 |
17 | public void setCountMember(int countMember)
18 | {
19 | this.countMember = countMember;
20 | }
21 |
22 | public int getCountAdmin()
23 | {
24 | return countAdmin;
25 | }
26 |
27 | public void setCountAdmin(int countAdmin)
28 | {
29 | this.countAdmin = countAdmin;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/mapper/TableBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.mapper;
2 |
3 | import java.util.stream.Collectors;
4 |
5 | import org.springframework.stereotype.Component;
6 |
7 | import de.hatoka.tournament.capi.business.TableBO;
8 | import de.hatoka.tournament.internal.remote.model.TableRO;
9 |
10 | @Component
11 | public class TableBO2RO
12 | {
13 | private final CompetitorBO2RO bo2ro = new CompetitorBO2RO();
14 |
15 | public TableRO apply(TableBO table)
16 | {
17 | TableRO result = new TableRO();
18 | result.setNumber(table.getTableNo());
19 | result.setCompetitors(table.getCompetitors().stream().map(bo2ro).collect(Collectors.toList()));
20 | return result;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/resources/de/hatoka/user/internal/templates/mail/signup_en.properties:
--------------------------------------------------------------------------------
1 | login.head.title=Login Form
2 | login.info.pleaseLogin=Please login:
3 | login.warn.verifyCredentials=Please verify your credentials.
4 | login.info.signUp=Sign up:
5 | login.info.successfullyRegistered=Successfully registered. We send an email to ''{0}''. Please follow the instruction.
6 | signup.warn.emailExists=The entered email address exists. Please login or use the password forgotten link.
7 | placeholder.login=Email
8 | placeholder.email=Email
9 | placeholder.password=Password
10 | placeholder.newPassword=New password
11 | placeholder.name=Your name
12 | button.login=Login
13 | button.signUp=Sign Up
14 | mail.verifyEmail.title=Email Verification
15 | mail.verifyEmail.clickLink=Please click the following link:
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/mapper/RankBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.mapper;
2 |
3 | import org.springframework.stereotype.Component;
4 |
5 | import de.hatoka.tournament.capi.business.RankBO;
6 | import de.hatoka.tournament.internal.remote.model.RankRO;
7 |
8 | @Component
9 | public class RankBO2RO
10 | {
11 | public RankRO apply(RankBO rank)
12 | {
13 | RankRO result = new RankRO();
14 | result.setFirstPosition(rank.getFirstPosition());
15 | result.setLastPosition(rank.getLastPosition());
16 | result.setPercentage(rank.getPercentage());
17 | result.setAmountPerPlayer(rank.getAmountPerPlayer());
18 | result.setAmount(rank.getAmount());
19 | return result;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/remote/model/TableRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.remote.model;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | public class TableRO
7 | {
8 | private int number;
9 | private List competitors = new ArrayList<>();
10 |
11 | public TableRO()
12 | {
13 | }
14 |
15 | public int getNumber()
16 | {
17 | return number;
18 | }
19 |
20 | public void setNumber(int number)
21 | {
22 | this.number = number;
23 | }
24 |
25 | public List getCompetitors()
26 | {
27 | return competitors;
28 | }
29 |
30 | public void setCompetitors(List competitors)
31 | {
32 | this.competitors = competitors;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/model/TableRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.model;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | public class TableRO
7 | {
8 | private int number;
9 | private List competitors = new ArrayList<>();
10 |
11 | public TableRO()
12 | {
13 | }
14 |
15 | public int getNumber()
16 | {
17 | return number;
18 | }
19 |
20 | public void setNumber(int number)
21 | {
22 | this.number = number;
23 | }
24 |
25 | public List getCompetitors()
26 | {
27 | return competitors;
28 | }
29 |
30 | public void setCompetitors(List competitors)
31 | {
32 | this.competitors = competitors;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/java/tests/de/hatoka/player/PlayerTestConfiguration.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.player;
2 |
3 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4 | import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.context.annotation.PropertySource;
7 |
8 | import de.hatoka.common.capi.CommonConfiguration;
9 | import de.hatoka.player.capi.PlayerConfiguration;
10 | import de.hatoka.user.capi.UserConfiguration;
11 |
12 | @Configuration
13 | @PropertySource("classpath:application-test.properties")
14 | @EnableAutoConfiguration
15 | @ImportAutoConfiguration({ PlayerConfiguration.class, UserConfiguration.class, CommonConfiguration.class })
16 | public class PlayerTestConfiguration
17 | {
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # ide backups
4 | *~
5 | *.bak
6 | **/.env
7 |
8 | # compiled output
9 | /dist
10 | /tmp
11 | /out-tsc
12 | /docs/build
13 | /.gradle
14 | **/build/*
15 |
16 | # dependencies
17 | /node_modules
18 | /.scannerwork
19 |
20 | # IDEs and editors
21 | /.idea
22 | .project
23 | .classpath
24 | .c9/
25 | *.launch
26 | .settings/
27 | *.sublime-workspace
28 |
29 | # IDE - VSCode
30 | .vscode/*
31 | !.vscode/settings.json
32 | !.vscode/tasks.json
33 | !.vscode/launch.json
34 | !.vscode/extensions.json
35 |
36 | # misc
37 | /.sass-cache
38 | /connect.lock
39 | /coverage
40 | /libpeerconnection.log
41 | npm-debug.log
42 | testem.log
43 | /typings
44 |
45 | # e2e
46 | /e2e/*.js
47 | /e2e/*.map
48 |
49 | # System Files
50 | .DS_Store
51 | Thumbs.db
52 | **/bin
53 | .envrc
--------------------------------------------------------------------------------
/de.hatoka.cashgame/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation project(':de.hatoka.common')
3 | implementation project(':de.hatoka.user')
4 | implementation project(':de.hatoka.player')
5 | implementation project(':de.hatoka.group')
6 |
7 | implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
8 | implementation 'org.springframework.boot:spring-boot-starter-web'
9 | implementation 'org.springframework.boot:spring-boot-starter-security'
10 |
11 | implementation 'javax.validation:validation-api'
12 |
13 | //Test
14 | testImplementation 'com.jayway.jsonpath:json-path'
15 | testImplementation group: 'org.skyscreamer', name: 'jsonassert'
16 | testImplementation 'org.springframework.boot:spring-boot-starter-test'
17 |
18 | //Database
19 | testRuntimeOnly 'com.h2database:h2'
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation project(':de.hatoka.common')
3 | implementation project(':de.hatoka.user')
4 | implementation project(':de.hatoka.player')
5 | implementation project(':de.hatoka.group')
6 |
7 | implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
8 | implementation 'org.springframework.boot:spring-boot-starter-web'
9 | implementation 'org.springframework.boot:spring-boot-starter-security'
10 |
11 | implementation 'javax.validation:validation-api'
12 |
13 | //Test
14 | testImplementation 'com.jayway.jsonpath:json-path'
15 | testImplementation group: 'org.skyscreamer', name: 'jsonassert'
16 | testImplementation 'org.springframework.boot:spring-boot-starter-test'
17 |
18 | //Database
19 | testRuntimeOnly 'com.h2database:h2'
20 | }
21 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/remote/model/CashGameRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.remote.model;
2 |
3 | public class CashGameRO
4 | {
5 | private String ref;
6 | private CashGameDataRO data;
7 | private CashGameInfoRO info;
8 |
9 | public String getRef()
10 | {
11 | return ref;
12 | }
13 |
14 | public void setRef(String ref)
15 | {
16 | this.ref = ref;
17 | }
18 |
19 | public CashGameDataRO getData()
20 | {
21 | return data;
22 | }
23 |
24 | public void setData(CashGameDataRO data)
25 | {
26 | this.data = data;
27 | }
28 |
29 | public CashGameInfoRO getInfo()
30 | {
31 | return info;
32 | }
33 |
34 | public void setInfo(CashGameInfoRO info)
35 | {
36 | this.info = info;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
10 |
11 | %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC} [%thread] %-5level %logger{36} %user%request - %msg%n
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/model/CashGameRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.model;
2 |
3 | public class CashGameRO
4 | {
5 | private String ref;
6 | private CashGameDataRO data;
7 | private CashGameInfoRO info;
8 |
9 | public String getRef()
10 | {
11 | return ref;
12 | }
13 |
14 | public void setRef(String ref)
15 | {
16 | this.ref = ref;
17 | }
18 |
19 | public CashGameDataRO getData()
20 | {
21 | return data;
22 | }
23 |
24 | public void setData(CashGameDataRO data)
25 | {
26 | this.data = data;
27 | }
28 |
29 | public CashGameInfoRO getInfo()
30 | {
31 | return info;
32 | }
33 |
34 | public void setInfo(CashGameInfoRO info)
35 | {
36 | this.info = info;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
10 |
11 | %d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC} [%thread] %-5level %logger{36} %user%request - %msg%n
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/resources/de/hatoka/user/internal/templates/app/login_en.properties:
--------------------------------------------------------------------------------
1 | login.head.title=Login Form
2 |
3 | login.info.pleaseLogin=Please login:
4 | login.info.signUp=Please sign up:
5 | login.info.successfullyRegistered=Successfully registered. We send an email to ''{0}''. Please follow the instruction.
6 |
7 | login.warn.verifyCredentials=Please verify your credentials.
8 | login.warn.fillMandatoryFields=Please fill all mandatory fields.
9 |
10 | signup.warn.emailExists=The entered email address exists. Please login or use the password forgotten link.
11 | signup.mail.subject=Account email verification.
12 | signin.success=Sign in successfully finished.
13 |
14 | placeholder.email=Email
15 | placeholder.password=Password
16 | placeholder.newPassword=New password
17 | placeholder.name=Your name
18 |
19 | button.login=Login
20 | button.signUp=Sign Up
21 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/java/tests/de/hatoka/tournament/TournamentTestApplication.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.tournament;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.builder.SpringApplicationBuilder;
6 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
7 |
8 | @SpringBootApplication
9 | public class TournamentTestApplication extends SpringBootServletInitializer
10 | {
11 | @Override
12 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
13 | {
14 | return application.sources(TournamentTestApplication.class);
15 | }
16 |
17 | public static void main(String[] args)
18 | {
19 | SpringApplication.run(TournamentTestApplication.class, args);
20 | }
21 | }
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/business/HistoryEntryBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.business;
2 |
3 | import java.util.Date;
4 |
5 | import de.hatoka.common.capi.math.Money;
6 | import de.hatoka.player.capi.types.HistoryEntryType;
7 |
8 | /**
9 | * A player can attend at multiple tournaments as competitor
10 | */
11 | public interface HistoryEntryBO
12 | {
13 | /**
14 | *
15 | * @return date of history entry
16 | */
17 | Date getDate();
18 |
19 | /**
20 | * @return type of entry
21 | */
22 | HistoryEntryType getType();
23 |
24 | /**
25 | * @return player who does the action
26 | */
27 | PlayerBO getPlayer();
28 |
29 | /**
30 | * @return reference to the game
31 | */
32 | String getGameRef();
33 | /**
34 | * @return amount
35 | */
36 | Money getAmount();
37 | }
38 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/player_list.result.xml:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/player_list.result.xml:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/test/java/tests/de/hatoka/group/GroupTestConfiguration.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.group;
2 |
3 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4 | import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.context.annotation.PropertySource;
7 |
8 | import de.hatoka.common.capi.CommonConfiguration;
9 | import de.hatoka.group.capi.GroupConfiguration;
10 | import de.hatoka.player.capi.PlayerConfiguration;
11 | import de.hatoka.user.capi.UserConfiguration;
12 |
13 | @Configuration
14 | @PropertySource("classpath:application-test.properties")
15 | @EnableAutoConfiguration
16 | @ImportAutoConfiguration({ GroupConfiguration.class, PlayerConfiguration.class, UserConfiguration.class, CommonConfiguration.class })
17 | public class GroupTestConfiguration
18 | {
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/player_list.result.xml:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/java/tests/de/hatoka/cashgame/CashGameTestConfiguration.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.cashgame;
2 |
3 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4 | import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.context.annotation.PropertySource;
7 |
8 | import de.hatoka.cashgame.capi.CashGameConfiguration;
9 | import de.hatoka.common.capi.CommonConfiguration;
10 | import de.hatoka.player.capi.PlayerConfiguration;
11 | import de.hatoka.user.capi.UserConfiguration;
12 |
13 | @Configuration
14 | @PropertySource("classpath:application-test.properties")
15 | @EnableAutoConfiguration
16 | @ImportAutoConfiguration({ CashGameConfiguration.class, PlayerConfiguration.class, UserConfiguration.class, CommonConfiguration.class })
17 | public class CashGameTestConfiguration
18 | {
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/test/java/de/hatoka/common/capi/encoding/StringSerializerTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.encoding;
2 |
3 |
4 |
5 | import static org.junit.jupiter.api.Assertions.assertEquals;
6 |
7 | import java.io.IOException;
8 |
9 | import org.junit.jupiter.api.Test;
10 |
11 | public class StringSerializerTest
12 | {
13 | private static final String TEST_STRING_1 = "simple";
14 |
15 | StringSerializer UNDER_TEST = new StringSerializer(String.class);
16 |
17 | @Test
18 | public void testSimpleText() throws IOException
19 | {
20 | String serial = UNDER_TEST.serialize(TEST_STRING_1);
21 | String result = UNDER_TEST.deserialize(serial);
22 | // first requirement restored object must be equal
23 | assertEquals(TEST_STRING_1, result);
24 | // a string should not be converted
25 | assertEquals(TEST_STRING_1, serial);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_list.result.xml:
--------------------------------------------------------------------------------
1 |
36 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_list.result.xml:
--------------------------------------------------------------------------------
1 |
36 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/java/tests/de/hatoka/tournament/TournamentTestConfiguration.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.tournament;
2 |
3 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
4 | import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.context.annotation.PropertySource;
7 |
8 | import de.hatoka.common.capi.CommonConfiguration;
9 | import de.hatoka.player.capi.PlayerConfiguration;
10 | import de.hatoka.tournament.capi.TournamentConfiguration;
11 | import de.hatoka.user.capi.UserConfiguration;
12 |
13 | @Configuration
14 | @PropertySource("classpath:application-test.properties")
15 | @EnableAutoConfiguration
16 | @ImportAutoConfiguration({ TournamentConfiguration.class, PlayerConfiguration.class, UserConfiguration.class, CommonConfiguration.class })
17 | public class TournamentTestConfiguration
18 | {
19 | }
20 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_list.result.xml:
--------------------------------------------------------------------------------
1 |
36 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/capi/business/UserBORepository.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.capi.business;
2 |
3 | import java.util.List;
4 | import java.util.Optional;
5 |
6 | public interface UserBORepository
7 | {
8 | /**
9 | * Creates an user
10 | *
11 | * @param externalRef
12 | * (identifier declared by authentication provider)
13 | * @return user
14 | */
15 | UserBO createUser(UserRef externalRef);
16 |
17 | /**
18 | * Retrieves a user via identifier
19 | *
20 | * @param externalRef
21 | * (identifier declared by authentication provider)
22 | * @return
23 | */
24 | Optional findUser(UserRef externalRef);
25 |
26 | List getAllUsers();
27 |
28 | /**
29 | * Removes all users of this repository
30 | */
31 | default void clear()
32 | {
33 | getAllUsers().forEach(UserBO::remove);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/business/HistoryBORepository.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.business;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 |
6 | import de.hatoka.common.capi.math.Money;
7 | import de.hatoka.player.capi.types.HistoryEntryType;
8 |
9 | public interface HistoryBORepository
10 | {
11 | /**
12 | * Creates new entry for player
13 | */
14 | HistoryEntryBO createEntry(Date date, PlayerRef playerRef, String gameRef, HistoryEntryType type, Money amount);
15 |
16 | /**
17 | * @param playerRef player reference
18 | * @return list of entries for known player by user
19 | */
20 | List getEntries(PlayerRef playerRef);
21 |
22 | /**
23 | * @param gameRef global game reference
24 | * @return list of entries by user
25 | */
26 | List getEntries(String gameRef);
27 |
28 | void deleteEntries(String gameRef);
29 | }
30 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_players.result.xml:
--------------------------------------------------------------------------------
1 |
39 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_players.result.xml:
--------------------------------------------------------------------------------
1 |
39 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_players.result.xml:
--------------------------------------------------------------------------------
1 |
39 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/rest/ErrorROFactory.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.rest;
2 |
3 | import java.util.Objects;
4 | import java.util.Set;
5 |
6 | import org.springframework.http.HttpStatus;
7 | import org.springframework.http.ResponseEntity;
8 |
9 | public final class ErrorROFactory
10 | {
11 | public static ResponseEntity createErrorResponseEntity(HttpStatus httpStatus, String message,
12 | Set details)
13 | {
14 | ErrorRO errorRO = new ErrorRO(httpStatus.value(), message);
15 | if (Objects.nonNull(details))
16 | {
17 | errorRO.setDetails(details);
18 | }
19 | return new ResponseEntity<>(errorRO, httpStatus);
20 | }
21 |
22 | public static ResponseEntity createErrorResponseEntity(HttpStatus httpStatus, String message)
23 | {
24 | return createErrorResponseEntity(httpStatus, message, null);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/main/java/de/hatoka/offlinepoker/logging/UserConverter.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.offlinepoker.logging;
2 |
3 | import ch.qos.logback.classic.pattern.ClassicConverter;
4 | import ch.qos.logback.classic.spi.ILoggingEvent;
5 |
6 | public class UserConverter extends ClassicConverter
7 | {
8 |
9 | @Override
10 | public String convert(ILoggingEvent event)
11 | {
12 | String userInformation = "";
13 | try
14 | {
15 | userInformation = extractUserInformation(userInformation);
16 | }
17 | catch(Exception e)
18 | {
19 | // exception not handled to avoid system failures because of logging
20 | }
21 | return userInformation;
22 | }
23 |
24 | private String extractUserInformation(String userInformation)
25 | {
26 | // userInformation = "[" + auth.getName() + " " + userEmail + "]";
27 | return userInformation;
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # https://help.github.com/articles/dealing-with-line-endings/
2 | # Set the default behavior, in case people don't have core.autocrlf set.
3 | * text=auto
4 |
5 | # Explicitly declare text files you want to always be normalized and converted
6 | # to native line endings on checkout.
7 | *.css text
8 | *.df text
9 | *.htm text
10 | *.html text
11 | *.java text
12 | *.js text
13 | *.json text
14 | *.jsp text
15 | *.jspf text
16 | *.jspx text
17 | *.properties text
18 | *.sh text
19 | *.tld text
20 | *.txt text
21 | *.tag text
22 | *.tagx text
23 | *.xml text
24 | *.svg text
25 |
26 | # always linux
27 | gradlew text eol=lf
28 |
29 | # always windows
30 | *.bat text eol=crlf
31 |
32 | # Denote all files that are truly binary and should not be modified.
33 |
34 | *.gif binary
35 | *.ico binary
36 | *.jpg binary
37 | *.jpeg binary
38 | *.png binary
39 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/TournamentTools.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import org.springframework.stereotype.Component;
4 |
5 | @Component
6 | public class TournamentTools
7 | {
8 | public int getBigBlind(int smallBlind)
9 | {
10 | return smallBlind * 2;
11 | }
12 |
13 | public int getNextSmallBlind(int maxSmallBlind)
14 | {
15 | if (maxSmallBlind == 0)
16 | {
17 | return 100;
18 | }
19 | int result = maxSmallBlind;
20 | int exp = 0;
21 | while(result % 10 == 0)
22 | {
23 | exp++;
24 | result /= 10;
25 | }
26 | if (result == 2)
27 | {
28 | result = 5;
29 | }
30 | else
31 | {
32 | result *= 2;
33 | }
34 | while(exp > 0)
35 | {
36 | exp--;
37 | result *= 10;
38 | }
39 | return result;
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # Default Configurations
2 | #
3 | ## Server ##
4 | #
5 | server.port=8090
6 | spring.main.allow-bean-definition-overriding=true
7 | spring.main.banner-mode=off
8 | #
9 | ## Actuator ##
10 | #
11 | management.server.port=9090
12 | management.endpoints.web.cors.allowed-origins=*
13 | management.endpoints.web.cors.allowed-methods=GET
14 |
15 | management.endpoints.web.exposure.include=info,health,metrics,prometheus,openapi,swaggerui
16 | management.endpoint.info.enabled=true
17 | management.endpoint.health.enabled=true
18 | management.endpoint.metrics.enabled=true
19 | management.endpoint.prometheus.enabled=true
20 | #management.endpoint.health.show-details=when-authorized
21 | management.endpoint.health.show-details=always
22 |
23 | management.metrics.export.prometheus.enabled=true
24 | management.health.diskSpace.enabled=false
25 |
26 | # /swagger-ui.html
27 | springdoc.packagesToScan=de.hatoka
28 | springdoc.use-management-port=true
29 | springdoc.show-actuator=true
30 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
8 |
9 |
10 |
11 | build/logs/error.log
12 |
13 | WARN
14 |
15 |
16 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
8 |
9 |
10 |
11 | build/logs/error.log
12 |
13 | WARN
14 |
15 |
16 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
8 |
9 |
10 |
11 | build/logs/error.log
12 |
13 | WARN
14 |
15 |
16 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/mapper/TournamentBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.mapper;
2 |
3 | import org.springframework.stereotype.Component;
4 |
5 | import de.hatoka.tournament.capi.business.TournamentBO;
6 | import de.hatoka.tournament.internal.remote.model.TournamentRO;
7 |
8 | @Component
9 | public class TournamentBO2RO
10 | {
11 | public TournamentRO apply(TournamentBO tournamentBO)
12 | {
13 | TournamentRO result = new TournamentRO();
14 | result.setBuyIn(tournamentBO.getBuyIn());
15 | result.setSumInPlay(tournamentBO.getSumInplay());
16 | result.setCompetitorsSize(tournamentBO.getCompetitors().size());
17 | result.setName(tournamentBO.getName());
18 | result.setDate(tournamentBO.getStartTime());
19 | result.setInitialStack(tournamentBO.getInitialStacksize());
20 | result.setLargestTable(tournamentBO.getMaximumNumberOfPlayersPerTable());
21 | result.setReBuy(tournamentBO.getReBuy());
22 | return result;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/math/UnitScale.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.math;
2 |
3 | import java.math.BigDecimal;
4 |
5 | /**
6 | * Represents scale for unit of measurement. E.g. kilo (without the gram)
7 | */
8 | public enum UnitScale
9 | {
10 | ONE("", BigDecimal.ONE),
11 | MILLI("m", BigDecimalConstants.MILLI),
12 | CENTI("c", BigDecimalConstants.CENTI),
13 | KILO("k", BigDecimalConstants.THOUSAND),
14 | MEGA("M", BigDecimalConstants.MILLION);
15 |
16 | private final BigDecimal baseValue;
17 | private final String abbreviation;
18 |
19 | /**
20 | *
21 | * @param abbreviation
22 | * @param baseValue
23 | */
24 | private UnitScale(String abbreviation, BigDecimal baseValue)
25 | {
26 | this.baseValue = baseValue;
27 | this.abbreviation = abbreviation;
28 | }
29 |
30 | public BigDecimal getBaseValue()
31 | {
32 | return baseValue;
33 | }
34 |
35 | @Override
36 | public String toString()
37 | {
38 | return abbreviation;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/RankBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 | import java.math.BigDecimal;
4 |
5 | import de.hatoka.common.capi.math.Money;
6 |
7 | public interface RankBO
8 | {
9 | void remove();
10 |
11 | /**
12 | * @return first player position for the rank (e.g. 6)
13 | */
14 | Integer getFirstPosition();
15 |
16 | /**
17 | * @return last player position for the rank (e.g. 10)
18 | */
19 | Integer getLastPosition();
20 |
21 | /**
22 | * @return percentage of whole price (0.5 for 50%) for the rank (e.g. 20% for the rank)
23 | */
24 | BigDecimal getPercentage();
25 |
26 | /**
27 | * @return amount per players will get same price (e.g. 10 Euro in case place 6 to 10 get the same price and 50 Euro for the rank)
28 | */
29 | Money getAmountPerPlayer();
30 |
31 | /**
32 | * @return calculated or fix amount for the rank (e.g. 50 Euro for place 6 to 10) or null in case not calculated yet
33 | */
34 | Money getAmount();
35 | }
36 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/webapp/WEB-INF/resources/css/login.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 40px;
3 | padding-bottom: 40px;
4 | background-color: #eee;
5 | }
6 |
7 | .form-signin {
8 | max-width: 330px;
9 | padding: 15px;
10 | margin: 0 auto;
11 | }
12 |
13 | .form-signin
14 | {
15 | margin-bottom: 10px;
16 | }
17 | .form-signin .form-control {
18 | position: relative;
19 | height: auto;
20 | -webkit-box-sizing: border-box;
21 | -moz-box-sizing: border-box;
22 | box-sizing: border-box;
23 | padding: 10px;
24 | font-size: 16px;
25 | }
26 | .form-signin .form-control:focus {
27 | z-index: 2;
28 | }
29 | .form-signin .first {
30 | margin-bottom: -1px;
31 | border-bottom-right-radius: 0;
32 | border-bottom-left-radius: 0;
33 | }
34 | .form-signin .middle {
35 | margin-bottom: -1px;
36 | border-top-left-radius: 0;
37 | border-top-right-radius: 0;
38 | border-bottom-right-radius: 0;
39 | border-bottom-left-radius: 0;
40 | }
41 | .form-signin .last {
42 | margin-bottom: 10px;
43 | border-top-left-radius: 0;
44 | border-top-right-radius: 0;
45 | }
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/remote/mapper/CompetitorBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.remote.mapper;
2 |
3 | import java.util.function.Function;
4 |
5 | import org.springframework.stereotype.Component;
6 |
7 | import de.hatoka.cashgame.capi.business.CompetitorBO;
8 | import de.hatoka.cashgame.internal.remote.model.CompetitorRO;
9 |
10 | @Component("CashGameCompetitorBO2RO")
11 | public class CompetitorBO2RO implements Function
12 | {
13 | public CompetitorRO apply(CompetitorBO competitor)
14 | {
15 | CompetitorRO result = new CompetitorRO();
16 | result.setInPlay(competitor.getInPlay());
17 | result.setResult(competitor.getResult());
18 | result.setPosition(competitor.getPosition());
19 | result.setPlayerRef(competitor.getPlayer().getRef().toString());
20 | result.setPlayerName(competitor.getPlayer().getName());
21 | result.setActive(competitor.isActive());
22 | result.setStatus(competitor.getState());
23 | return result;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/ICompetitorBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import de.hatoka.common.capi.math.Money;
4 | import de.hatoka.tournament.capi.business.CompetitorBO;
5 |
6 | /**
7 | * This interface is used by game game implementation to set internal data of a competitor
8 | */
9 | public interface ICompetitorBO extends CompetitorBO
10 | {
11 | void setInactive();
12 |
13 | /**
14 | * Defines the position of the player. The position is independent from
15 | * "inPlayStatus"
16 | *
17 | * @param position
18 | */
19 | void setPosition(Integer position);
20 |
21 | /**
22 | * player is placed at table number.
23 | *
24 | * @param tableNumber
25 | * @param position at table (0 is dealer)
26 | */
27 | void takeSeat(int tableNo, int seatNo);
28 |
29 | /**
30 | * Player is out on position and gets some money, hopefully.
31 | * @param result
32 | * @param position
33 | */
34 | void seatOpen(Money result, Integer position);
35 | }
36 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/persistence/PricePO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.persistence;
2 |
3 | import java.io.Serializable;
4 |
5 | import jakarta.persistence.Embeddable;
6 | import javax.validation.constraints.NotNull;
7 |
8 | @Embeddable
9 | public class PricePO implements Serializable
10 | {
11 | private static final long serialVersionUID = 1L;
12 | @NotNull
13 | private MoneyPO amount;
14 | @NotNull
15 | private QuantityPO quantity;
16 |
17 | public PricePO()
18 | {
19 | }
20 |
21 | public PricePO(MoneyPO amount, QuantityPO quantity)
22 | {
23 | this.amount = amount;
24 | this.quantity = quantity;
25 | }
26 |
27 | public MoneyPO getAmount()
28 | {
29 | return amount;
30 | }
31 |
32 | public QuantityPO getQuantity()
33 | {
34 | return quantity;
35 | }
36 |
37 | public void setAmount(MoneyPO amount)
38 | {
39 | this.amount = amount;
40 | }
41 |
42 | public void setQuantity(QuantityPO quantity)
43 | {
44 | this.quantity = quantity;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/remote/GroupDataRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.remote;
2 |
3 | import java.util.Collections;
4 | import java.util.List;
5 |
6 | import com.fasterxml.jackson.annotation.JsonProperty;
7 |
8 | public class GroupDataRO
9 | {
10 | @JsonProperty("name")
11 | private String name;
12 | @JsonProperty("admins")
13 | private List admins = Collections.emptyList();
14 | @JsonProperty("members")
15 | private List members = Collections.emptyList();
16 |
17 | public String getName()
18 | {
19 | return name;
20 | }
21 |
22 | public void setName(String name)
23 | {
24 | this.name = name;
25 | }
26 |
27 | public List getAdmins()
28 | {
29 | return admins;
30 | }
31 |
32 | public void setAdmins(List admins)
33 | {
34 | this.admins = admins;
35 | }
36 |
37 | public List getMembers()
38 | {
39 | return members;
40 | }
41 |
42 | public void setMembers(List members)
43 | {
44 | this.members = members;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/resources/de/hatoka/user/internal/templates/mail/signUpVerifyEmail.html.xslt:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "gradle" # See documentation for possible values
9 | target-branch: "master"
10 | open-pull-requests-limit: 2 # Allow up globally to 2 simultaneously open pull requests for dependencies
11 | directory: "/" # Location of package manifests
12 | commit-message:
13 | prefix: "Dependabot"
14 | pull-request-branch-name:
15 | separator: "/"
16 | labels:
17 | - "dependencies"
18 | schedule:
19 | interval: "weekly"
20 | # ignore:
21 | # Ignore all major updates for now until additional version ignores are working
22 | # Security updates are not affected by this ignore filter and still will be updated
23 | # - dependency-name: "*"
24 | # update-types: [ "version-update:semver-major" ]
25 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/TournamentRoundBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 | import java.util.Date;
4 |
5 | public interface TournamentRoundBO
6 | {
7 | /**
8 | * @return position of round (blind level or pause)
9 | */
10 | Integer getPosition();
11 |
12 | /**
13 | * @return duration of round
14 | */
15 | Integer getDuration();
16 |
17 | boolean isRebuyAllowed();
18 |
19 | void allowRebuy(boolean allow);
20 |
21 | /**
22 | * @return BlindLevel in case it's a blind level and not a pause
23 | */
24 | BlindLevelBO getBlindLevel();
25 |
26 | /**
27 | * starts the round, deactivates the current round of the tournament and set the start date of round to current date
28 | */
29 | void start();
30 |
31 | /**
32 | * @return the start date (time) of the round
33 | */
34 | Date getStartTime();
35 |
36 | /**
37 | * @return the start date (time) of the round
38 | */
39 | Date getEndTime();
40 |
41 | /**
42 | * @return true in case this round is active
43 | */
44 | boolean isActive();
45 | }
46 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/business/PlayerBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.business;
2 |
3 | import java.util.Date;
4 |
5 | /**
6 | * A player can attend at multiple tournaments as competitor. A player is a real
7 | * person and can be an user, but doesn't need to be. Players can be registered in context of
8 | * an user (known player), a tournament (competitor) or cash game (visitor)
9 | */
10 | public interface PlayerBO
11 | {
12 | /**
13 | * @return unique identifier of player in specific context.
14 | */
15 | PlayerRef getRef();
16 |
17 | /**
18 | * @return name of player (display)
19 | */
20 | String getName();
21 |
22 | /**
23 | * @param name of player (display)
24 | */
25 | void setName(String name);
26 |
27 | /**
28 | * @return email address used to find players of an user.
29 | */
30 | String getEMail();
31 |
32 | /**
33 | * Sets email address of a player
34 | */
35 | void setEMail(String email);
36 |
37 | /**
38 | * Removes player from user/account
39 | */
40 | void remove();
41 |
42 | Date getFirstDate();
43 | }
44 |
--------------------------------------------------------------------------------
/.github/workflows/gradle.yml:
--------------------------------------------------------------------------------
1 | # This workflow uses actions that are not certified by GitHub.
2 | # They are provided by a third-party and are governed by
3 | # separate terms of service, privacy policy, and support
4 | # documentation.
5 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7 |
8 | name: Java CI with Gradle
9 |
10 | on:
11 | push:
12 | branches:
13 | - 'feature/build/*'
14 | - 'feature/service/*'
15 | - 'master'
16 | pull_request:
17 | branches: [ "master" ]
18 |
19 | permissions:
20 | contents: read
21 |
22 | jobs:
23 | build:
24 |
25 | runs-on: ubuntu-latest
26 |
27 | steps:
28 | - uses: actions/checkout@v3
29 | - name: Set up JDK 17
30 | uses: actions/setup-java@v3
31 | with:
32 | java-version: '17'
33 | distribution: 'temurin'
34 | - name: Build with Gradle
35 | uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
36 | with:
37 | arguments: build
38 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/business/PlayerBOFactoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.business;
2 |
3 | import java.util.Optional;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.beans.factory.annotation.Lookup;
7 | import org.springframework.stereotype.Component;
8 |
9 | import de.hatoka.player.capi.business.PlayerBO;
10 | import de.hatoka.player.capi.business.PlayerRef;
11 | import de.hatoka.player.internal.persistence.PlayerDao;
12 | import de.hatoka.player.internal.persistence.PlayerPO;
13 |
14 | @Component
15 | public class PlayerBOFactoryImpl implements PlayerBOFactory
16 | {
17 | @Autowired
18 | private PlayerDao playerDao;
19 |
20 | @Lookup
21 | @Override
22 | public PlayerBO get(PlayerPO po)
23 | {
24 | // done by @Lookup
25 | return null;
26 | }
27 |
28 | @Override
29 | public Optional get(String ref)
30 | {
31 | PlayerRef playerRef = PlayerRef.valueOf(ref);
32 | return playerDao.findByContextRefAndPlayerRef(playerRef.getUserRef().getGlobalRef(), playerRef.getLocalRef()).map(this::get);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/mapper/CompetitorBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.mapper;
2 |
3 | import java.util.function.Function;
4 |
5 | import org.springframework.stereotype.Component;
6 |
7 | import de.hatoka.tournament.capi.business.CompetitorBO;
8 | import de.hatoka.tournament.internal.remote.model.CompetitorRO;
9 |
10 | @Component("TournamentCompetitorBO2RO")
11 | public class CompetitorBO2RO implements Function
12 | {
13 | public CompetitorRO apply(CompetitorBO competitor)
14 | {
15 | CompetitorRO result = new CompetitorRO();
16 | result.setInPlay(competitor.getInPlay());
17 | result.setResult(competitor.getResult());
18 | result.setPosition(competitor.getPosition());
19 | result.setPlayerRef(competitor.getPlayer().getRef().toString());
20 | result.setPlayerName(competitor.getPlayer().getName());
21 | result.setActive(competitor.isActive());
22 | result.setTableNo(competitor.getTableNo() + 1);
23 | result.setSeatNo(competitor.getSeatNo()+ 1);
24 | result.setStatus(competitor.getState());
25 | return result;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/remote/GroupRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.remote;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class GroupRO
6 | {
7 | @JsonProperty("refLocal")
8 | private String refLocal;
9 | @JsonProperty("refGlobal")
10 | private String refGlobal;
11 | private GroupDataRO data;
12 | private GroupInfoRO info;
13 |
14 | public String getRefLocal()
15 | {
16 | return refLocal;
17 | }
18 |
19 | public void setRefLocal(String refLocal)
20 | {
21 | this.refLocal = refLocal;
22 | }
23 |
24 | public String getRefGlobal()
25 | {
26 | return refGlobal;
27 | }
28 |
29 | public void setRefGlobal(String refGlobal)
30 | {
31 | this.refGlobal = refGlobal;
32 | }
33 |
34 | public GroupDataRO getData()
35 | {
36 | return data;
37 | }
38 |
39 | public void setData(GroupDataRO data)
40 | {
41 | this.data = data;
42 | }
43 |
44 | public GroupInfoRO getInfo()
45 | {
46 | return info;
47 | }
48 |
49 | public void setInfo(GroupInfoRO info)
50 | {
51 | this.info = info;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/test/java/de/hatoka/common/capi/math/ComparatorsTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.math;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 | import java.util.stream.Collectors;
8 |
9 | import org.junit.jupiter.api.Test;
10 |
11 | public class ComparatorsTest
12 | {
13 | private static final List STRING_START = Arrays.asList("A", null, "D", "B");
14 | private static final List STRING_EXPECTED = Arrays.asList(null, "A", "B", "D");
15 | private static final List BOOLEAN_START = Arrays.asList(true, null, false);
16 | private static final List BOOLEAN_EXPECTED = Arrays.asList(null, false, true);
17 |
18 | @Test
19 | public void testStringSorting()
20 | {
21 | assertEquals(STRING_EXPECTED,
22 | STRING_START.stream().sorted(Comparators.STRING).collect(Collectors.toList()), "null sorting");
23 | }
24 |
25 | @Test
26 | public void testBooleanSorting()
27 | {
28 | assertEquals(BOOLEAN_EXPECTED,
29 | BOOLEAN_START.stream().sorted(Comparators.BOOLEAN).collect(Collectors.toList()), "money sorting");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_bigscreen.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Current Time
6 | 6:35 PM |
7 |
8 | Current Level
9 | 07:00 |
10 |
11 | Players left
12 | 15
13 | /
14 | 20 |
15 |
16 |
17 |
18 | Next Pause
19 | 7:15 PM |
20 |
21 | Stack Average
22 | 2500 |
23 |
24 |
25 |
26 | Small Blind
27 | 200 |
28 |
29 | Big Blind
30 | 400 |
31 |
32 | Ante
33 | 0 |
34 |
35 |
36 | |
37 | (Next Level
38 | 250
39 | /
40 | 500
41 | /
42 | 0
43 | )
44 | |
45 |
46 |
47 |
50 |
51 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_bigscreen.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Current Time
6 | 6:35 PM |
7 |
8 | Current Level
9 | 07:00 |
10 |
11 | Players left
12 | 15
13 | /
14 | 20 |
15 |
16 |
17 |
18 | Next Pause
19 | 7:15 PM |
20 |
21 | Stack Average
22 | 2500 |
23 |
24 |
25 |
26 | Small Blind
27 | 200 |
28 |
29 | Big Blind
30 | 400 |
31 |
32 | Ante
33 | 0 |
34 |
35 |
36 | |
37 | (Next Level
38 | 250
39 | /
40 | 500
41 | /
42 | 0
43 | )
44 | |
45 |
46 |
47 |
50 |
51 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_bigscreen.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Current Time
6 | 6:35 PM |
7 |
8 | Current Level
9 | 07:00 |
10 |
11 | Players left
12 | 15
13 | /
14 | 20 |
15 |
16 |
17 |
18 | Next Pause
19 | 7:15 PM |
20 |
21 | Stack Average
22 | 2500 |
23 |
24 |
25 |
26 | Small Blind
27 | 200 |
28 |
29 | Big Blind
30 | 400 |
31 |
32 | Ante
33 | 0 |
34 |
35 |
36 | |
37 | (Next Level
38 | 250
39 | /
40 | 500
41 | /
42 | 0
43 | )
44 | |
45 |
46 |
47 |
50 |
51 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/encoding/StringSerializer.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.encoding;
2 |
3 | import java.io.IOException;
4 | import java.io.Serializable;
5 | import java.util.Base64;
6 | import java.util.Base64.Decoder;
7 | import java.util.Base64.Encoder;
8 |
9 | public class StringSerializer
10 | {
11 | private ObjectSerializer delegate = new ObjectSerializer<>();
12 | private final boolean isString;
13 | private Encoder encoder = Base64.getEncoder();
14 | private Decoder decoder = Base64.getDecoder();
15 |
16 | public StringSerializer(Class toSerialize)
17 | {
18 | isString = toSerialize == String.class;
19 | }
20 |
21 | @SuppressWarnings("unchecked")
22 | public T deserialize(String serial) throws IOException
23 | {
24 | if (isString)
25 | {
26 | return (T)serial;
27 | }
28 | return delegate.convert(decoder.decode(serial.getBytes()));
29 | }
30 |
31 | public String serialize(T object) throws IOException
32 | {
33 | if (isString)
34 | {
35 | return (String)object;
36 | }
37 | return new String(encoder.encode(delegate.convert(object)));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/capi/business/UserBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.capi.business;
2 |
3 | import java.util.Locale;
4 | import java.util.TimeZone;
5 |
6 | public interface UserBO
7 | {
8 | /**
9 | * @return the identifier of the user
10 | */
11 | UserRef getRef();
12 |
13 | /**
14 | * @return default nickname for players
15 | */
16 | String getNickName();
17 |
18 | /**
19 | * set default nickname for user
20 | *
21 | * @param nickName
22 | */
23 | void setNickName(String nickName);
24 |
25 | /**
26 | * @return true if user can login
27 | */
28 | boolean isActive();
29 |
30 | /**
31 | * @return user preferred locale
32 | */
33 | Locale getLocale();
34 |
35 | /**
36 | * Set user preferred locale.
37 | *
38 | * @param locale
39 | */
40 | void setLocale(Locale locale);
41 |
42 | /**
43 | * @return user preferred time zone
44 | */
45 | TimeZone getTimeZone();
46 |
47 | /**
48 | * Set user preferred time zone.
49 | *
50 | * @param timezone
51 | */
52 | void setTimeZone(TimeZone timezone);
53 |
54 | /**
55 | * Removes this user
56 | */
57 | void remove();
58 | }
59 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/GroupBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import java.util.Collection;
4 |
5 | import de.hatoka.player.capi.business.PlayerBO;
6 | import de.hatoka.user.capi.business.UserBO;
7 |
8 | public interface GroupBO
9 | {
10 | /**
11 | * @return name of group
12 | */
13 | String getName();
14 |
15 | /**
16 | * Create member for given player
17 | * @param playerRef
18 | * @param name
19 | * of member in side of the group
20 | * @return created member
21 | */
22 | GroupMemberBO createMember(PlayerBO player);
23 |
24 | /**
25 | * Creates a group admin (must be a user)
26 | * @param userRef
27 | * @return created admin user
28 | */
29 | GroupAdminBO createAdmin(UserBO user);
30 |
31 | /**
32 | * @return members of the group (players)
33 | */
34 | Collection getMembers();
35 |
36 | /**
37 | * @return admins of the group (users)
38 | */
39 | Collection getAdmins();
40 |
41 | /**
42 | * @return reference to the group
43 | */
44 | GroupRef getRef();
45 |
46 | /**
47 | * Removes that group
48 | */
49 | void remove();
50 | }
51 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/internal/remote/PlayerBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.internal.remote;
2 |
3 | import java.util.List;
4 | import java.util.stream.Collectors;
5 |
6 | import org.springframework.stereotype.Component;
7 |
8 | import de.hatoka.player.capi.business.PlayerBO;
9 | import de.hatoka.player.capi.remote.PlayerDataRO;
10 | import de.hatoka.player.capi.remote.PlayerInfoRO;
11 | import de.hatoka.player.capi.remote.PlayerRO;
12 |
13 | @Component
14 | public class PlayerBO2RO
15 | {
16 | public PlayerRO apply(PlayerBO player)
17 | {
18 | PlayerDataRO data = new PlayerDataRO();
19 | data.setName(player.getName());
20 | data.seteMail(player.getEMail());
21 | PlayerInfoRO info = new PlayerInfoRO();
22 | info.setFirstDate(player.getFirstDate());
23 | PlayerRO result = new PlayerRO();
24 | result.setRefGlobal(player.getRef().getGlobalRef());
25 | result.setRefLocal(player.getRef().getLocalRef());
26 | result.setData(data);
27 | result.setInfo(info);
28 | return result;
29 | }
30 |
31 | public List apply(List players)
32 | {
33 | return players.stream().map(this::apply).collect(Collectors.toList());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/CompetitorComparators.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 | import java.util.Comparator;
4 |
5 | import de.hatoka.common.capi.math.Comparators;
6 |
7 | public final class CompetitorComparators
8 | {
9 | private CompetitorComparators()
10 | {
11 | }
12 |
13 | public static final Comparator RESULT = new Comparator()
14 | {
15 | @Override
16 | public int compare(CompetitorBO o1, CompetitorBO o2)
17 | {
18 | if (o1 == null || o2 == null)
19 | {
20 | return Comparators.NULL.compare(o1, o2);
21 | }
22 | return Comparators.MONEY.compare(o1.getResult(), o2.getResult());
23 | }
24 | };
25 |
26 | public static final Comparator NAME = new Comparator()
27 | {
28 | @Override
29 | public int compare(CompetitorBO o1, CompetitorBO o2)
30 | {
31 | if (o1 == null || o2 == null)
32 | {
33 | return Comparators.NULL.compare(o1, o2);
34 | }
35 | return Comparators.STRING.compare(o1.getPlayer().getName(), o2.getPlayer().getName());
36 | }
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/rest/RestControllerException.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.rest;
2 |
3 | import org.springframework.http.HttpStatus;
4 |
5 | public class RestControllerException extends RuntimeException
6 | {
7 |
8 | private static final long serialVersionUID = -7724289129556554634L;
9 |
10 | private final HttpStatus httpStatus;
11 | private final String logMessage;
12 |
13 | public RestControllerException(HttpStatus httpStatus, String message, Throwable t)
14 | {
15 | super(message, t);
16 | this.httpStatus = httpStatus;
17 | this.logMessage = message;
18 | }
19 |
20 | public RestControllerException(HttpStatus httpStatus, String message)
21 | {
22 | super(message);
23 | this.httpStatus = httpStatus;
24 | this.logMessage = message;
25 | }
26 |
27 | public RestControllerException(HttpStatus httpStatus, String message, String logMessage)
28 | {
29 | super(message);
30 | this.httpStatus = httpStatus;
31 | this.logMessage = logMessage;
32 | }
33 |
34 | public HttpStatus getHttpStatus()
35 | {
36 | return httpStatus;
37 | }
38 |
39 | public String getLogMessage()
40 | {
41 | return logMessage;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/remote/HistoryEntryRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.remote;
2 |
3 | import java.util.Date;
4 |
5 | import de.hatoka.common.capi.math.Money;
6 | import de.hatoka.player.capi.types.HistoryEntryType;
7 |
8 | public class HistoryEntryRO
9 | {
10 | private String playerName;
11 | private HistoryEntryType entryType;
12 | private Date date;
13 | private Money amount;
14 |
15 | public HistoryEntryRO()
16 | {
17 | }
18 |
19 | public String getPlayerName()
20 | {
21 | return playerName;
22 | }
23 |
24 | public void setPlayerName(String playerName)
25 | {
26 | this.playerName = playerName;
27 | }
28 |
29 | public Date getDate()
30 | {
31 | return date;
32 | }
33 |
34 | public void setDate(Date date)
35 | {
36 | this.date = date;
37 | }
38 |
39 | public Money getAmount()
40 | {
41 | return amount;
42 | }
43 |
44 | public void setAmount(Money amount)
45 | {
46 | this.amount = amount;
47 | }
48 |
49 | public HistoryEntryType getType()
50 | {
51 | return entryType;
52 | }
53 |
54 | public void setType(HistoryEntryType entry)
55 | {
56 | this.entryType = entry;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/rest/ErrorRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.rest;
2 |
3 | import java.util.Set;
4 |
5 | import com.fasterxml.jackson.annotation.JsonTypeInfo;
6 | import com.fasterxml.jackson.annotation.JsonTypeName;
7 |
8 | @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)
9 | @JsonTypeName("error")
10 | public class ErrorRO
11 | {
12 | private final int code;
13 | private final String message;
14 | private Set details;
15 |
16 | public ErrorRO(int httpStatus, String errorCode)
17 | {
18 | this.code = httpStatus;
19 | this.message = errorCode;
20 | }
21 |
22 | /**
23 | * Only used by JSON mapper
24 | */
25 | public ErrorRO()
26 | {
27 | this(0, null);
28 | }
29 |
30 | public int getCode()
31 | {
32 | return code;
33 | }
34 |
35 | public String getMessage()
36 | {
37 | return message;
38 | }
39 |
40 | public void addDetail(String detail)
41 | {
42 | this.details.add(detail);
43 | }
44 |
45 | public Set getDetails()
46 | {
47 | return details;
48 | }
49 |
50 | public void setDetails(Set details)
51 | {
52 | this.details = details;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/remote/PlayerRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.remote;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 |
5 | public class PlayerRO
6 | {
7 | @JsonProperty("refLocal")
8 | private String refLocal;
9 | @JsonProperty("refGlobal")
10 | private String refGlobal;
11 | private PlayerDataRO data;
12 | private PlayerInfoRO info;
13 |
14 | public PlayerRO()
15 | {
16 | }
17 |
18 |
19 | public PlayerDataRO getData()
20 | {
21 | return data;
22 | }
23 |
24 | public void setData(PlayerDataRO data)
25 | {
26 | this.data = data;
27 | }
28 |
29 | public PlayerInfoRO getInfo()
30 | {
31 | return info;
32 | }
33 |
34 | public void setInfo(PlayerInfoRO info)
35 | {
36 | this.info = info;
37 | }
38 |
39 |
40 | public String getRefLocal()
41 | {
42 | return refLocal;
43 | }
44 |
45 |
46 | public void setRefLocal(String refLocal)
47 | {
48 | this.refLocal = refLocal;
49 | }
50 |
51 |
52 | public String getRefGlobal()
53 | {
54 | return refGlobal;
55 | }
56 |
57 |
58 | public void setRefGlobal(String refGlobal)
59 | {
60 | this.refGlobal = refGlobal;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/test/java/de/hatoka/group/internal/persistence/GroupDaoTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.persistence;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import java.util.Optional;
6 |
7 | import org.junit.jupiter.api.Test;
8 | import org.junit.jupiter.api.extension.ExtendWith;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.test.context.ContextConfiguration;
11 | import org.springframework.test.context.junit.jupiter.SpringExtension;
12 |
13 | import tests.de.hatoka.group.GroupTestConfiguration;
14 |
15 | @ExtendWith(SpringExtension.class)
16 | @ContextConfiguration(classes = { GroupTestConfiguration.class })
17 | public class GroupDaoTest
18 | {
19 | private static final String GROUP_REF = "group:testCrud";
20 |
21 | @Autowired
22 | private GroupDao dao;
23 |
24 | @Test
25 | public void testFindByOwnerRefAndName()
26 | {
27 | GroupPO groupPO = new GroupPO();
28 | groupPO.setGlobalGroupRef(GROUP_REF);
29 | groupPO.setName("testCrud");
30 | dao.save(groupPO);
31 | Optional storedGroupPO = dao.findByGlobalGroupRef(GROUP_REF);
32 | assertEquals(groupPO, storedGroupPO.get(), "loaded group");
33 | dao.delete(groupPO);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/remote/mapper/CashGameBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.remote.mapper;
2 |
3 | import java.util.List;
4 | import java.util.stream.Collectors;
5 |
6 | import org.springframework.stereotype.Component;
7 |
8 | import de.hatoka.cashgame.capi.business.CashGameBO;
9 | import de.hatoka.cashgame.internal.remote.model.CashGameDataRO;
10 | import de.hatoka.cashgame.internal.remote.model.CashGameInfoRO;
11 | import de.hatoka.cashgame.internal.remote.model.CashGameRO;
12 |
13 | @Component
14 | public class CashGameBO2RO
15 | {
16 | public CashGameRO apply(CashGameBO cashGameBO)
17 | {
18 | CashGameRO result = new CashGameRO();
19 | CashGameDataRO data = new CashGameDataRO();
20 | data.setBuyIn(cashGameBO.getBuyIn());
21 | data.setDate(cashGameBO.getDate());
22 | CashGameInfoRO info = new CashGameInfoRO();
23 | info.setSumInPlay(cashGameBO.getSumInplay());
24 | result.setData(data);
25 | result.setInfo(info);
26 | result.setRef(cashGameBO.getRef().getGlobalRef());
27 | return result;
28 | }
29 |
30 | public List apply(List cashGames)
31 | {
32 | return cashGames.stream().map(this::apply).collect(Collectors.toList());
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/remote/PlayerInfoRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.remote;
2 |
3 | import java.util.Date;
4 |
5 | import com.fasterxml.jackson.annotation.JsonProperty;
6 |
7 | import de.hatoka.common.capi.math.Money;
8 |
9 | public class PlayerInfoRO
10 | {
11 | @JsonProperty("firstDate")
12 | private Date firstDate;
13 | @JsonProperty("lastWeek")
14 | private Money lastWeek;
15 | @JsonProperty("lastMonth")
16 | private Money lastMonth;
17 | @JsonProperty("lastYear")
18 | private Money lastYear;
19 |
20 | public Date getFirstDate()
21 | {
22 | return firstDate;
23 | }
24 | public void setFirstDate(Date firstDate)
25 | {
26 | this.firstDate = firstDate;
27 | }
28 | public Money getLastWeek()
29 | {
30 | return lastWeek;
31 | }
32 | public void setLastWeek(Money lastWeek)
33 | {
34 | this.lastWeek = lastWeek;
35 | }
36 | public Money getLastMonth()
37 | {
38 | return lastMonth;
39 | }
40 | public void setLastMonth(Money lastMonth)
41 | {
42 | this.lastMonth = lastMonth;
43 | }
44 | public Money getLastYear()
45 | {
46 | return lastYear;
47 | }
48 | public void setLastYear(Money lastYear)
49 | {
50 | this.lastYear = lastYear;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/RankPOComparators.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import java.util.Comparator;
4 |
5 | import de.hatoka.common.capi.math.Comparators;
6 | import de.hatoka.tournament.internal.persistence.RankPO;
7 |
8 | public final class RankPOComparators
9 | {
10 | private RankPOComparators()
11 | {
12 | }
13 |
14 | public static final Comparator DEFAULT = new Comparator()
15 | {
16 | @Override
17 | public int compare(RankPO o1, RankPO o2)
18 | {
19 | // position
20 | return POSITION.compare(o1, o2);
21 | }
22 | };
23 |
24 | public static final Comparator POSITION = new Comparator()
25 | {
26 | @Override
27 | public int compare(RankPO o1, RankPO o2)
28 | {
29 | if (o1 == null || o2 == null)
30 | {
31 | return Comparators.NULL.compare(o1, o2);
32 | }
33 | int result = Comparators.INTEGER.compare(o1.getFirstPosition(), o2.getFirstPosition());
34 | if (result == 0)
35 | {
36 | result = Comparators.INTEGER.compare(o1.getLastPosition(), o2.getLastPosition());
37 | }
38 | return result;
39 | }
40 | };
41 | }
42 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/java/de/hatoka/tournament/internal/business/TournamentToolsTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import org.junit.jupiter.api.Test;
6 | import org.junit.jupiter.api.extension.ExtendWith;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.test.context.ContextConfiguration;
9 | import org.springframework.test.context.junit.jupiter.SpringExtension;
10 |
11 | import tests.de.hatoka.tournament.TournamentTestConfiguration;
12 |
13 | @ExtendWith(SpringExtension.class)
14 | @ContextConfiguration(classes = { TournamentTestConfiguration.class })
15 | public class TournamentToolsTest
16 | {
17 | @Autowired
18 | private TournamentTools underTest;
19 |
20 | @Test
21 | public void testNextSmallBlind()
22 | {
23 | assertEquals(20, underTest.getNextSmallBlind(10));
24 | assertEquals(200, underTest.getNextSmallBlind(100));
25 | assertEquals(500, underTest.getNextSmallBlind(200));
26 | assertEquals(1000, underTest.getNextSmallBlind(500));
27 | assertEquals(2000, underTest.getNextSmallBlind(1000));
28 | }
29 |
30 | @Test
31 | public void testNextBigBlind()
32 | {
33 | assertEquals(20, underTest.getBigBlind(10));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/main/java/de/hatoka/player/capi/business/PlayerBORepository.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.business;
2 |
3 | import java.util.Collection;
4 | import java.util.List;
5 | import java.util.Optional;
6 |
7 | import de.hatoka.user.capi.business.UserRef;
8 |
9 | public interface PlayerBORepository
10 | {
11 | /**
12 | * Creates a player in context of a user.
13 | * @param userRef user reference
14 | * @param playerRef player reference for user
15 | * @param name nick name of player
16 | * @return created player
17 | */
18 | PlayerBO createPlayer(PlayerRef playerRef, String name);
19 |
20 | /**
21 | * Find a player in context of a user.
22 | * @param userRef user reference
23 | * @param playerRef player reference for user
24 | * @return player
25 | */
26 | Optional findPlayer(PlayerRef playerRef);
27 |
28 | /**
29 | * @param userRef user reference
30 | * @return list of players known by user
31 | */
32 | List getPlayers(UserRef userRef);
33 |
34 | /**
35 | * Removes all users of this repository
36 | */
37 | default void clear()
38 | {
39 | getAllPlayers().forEach(PlayerBO::remove);
40 | }
41 |
42 | /**
43 | * @return all registered players
44 | */
45 | Collection getAllPlayers();
46 | }
47 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/java/tests/de/hatoka/player/PlayerTestApplication.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.player;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.builder.SpringApplicationBuilder;
6 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
9 | import org.springframework.security.web.SecurityFilterChain;
10 |
11 | @SpringBootApplication
12 | public class PlayerTestApplication extends SpringBootServletInitializer
13 | {
14 | @Override
15 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
16 | {
17 | return application.sources(PlayerTestApplication.class);
18 | }
19 |
20 | public static void main(String[] args)
21 | {
22 | SpringApplication.run(PlayerTestApplication.class, args);
23 | }
24 | @Bean
25 | public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
26 | http.anonymous();
27 | // https://docs.spring.io/spring-security/site/docs/5.0.x/reference/html/csrf.html
28 | http.csrf().disable(); // REST requests doesn't use CSRF
29 | return http.build();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/mapper/BlindLevelBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.mapper;
2 |
3 | import java.util.function.Function;
4 |
5 | import org.springframework.stereotype.Component;
6 |
7 | import de.hatoka.tournament.capi.business.BlindLevelBO;
8 | import de.hatoka.tournament.capi.business.TournamentRoundBO;
9 | import de.hatoka.tournament.internal.remote.model.BlindLevelRO;
10 |
11 | @Component
12 | public class BlindLevelBO2RO implements Function
13 | {
14 | public BlindLevelRO apply(TournamentRoundBO round)
15 | {
16 | BlindLevelRO result = new BlindLevelRO();
17 | result.setPosition(round.getPosition());
18 | result.setDuration(round.getDuration());
19 | result.setEstStartDateTime(round.getStartTime());
20 | result.setActive(round.isActive());
21 | result.setRebuy(round.isRebuyAllowed());
22 |
23 | BlindLevelBO blindLevelBO = round.getBlindLevel();
24 | if (blindLevelBO == null)
25 | {
26 | result.setPause(true);
27 | }
28 | else
29 | {
30 | result.setSmallBlind(blindLevelBO.getSmallBlind());
31 | result.setBigBlind(blindLevelBO.getBigBlind());
32 | result.setAnte(blindLevelBO.getAnte());
33 | }
34 | return result;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/java/tests/de/hatoka/cashgame/CashGameTestApplication.java:
--------------------------------------------------------------------------------
1 | package tests.de.hatoka.cashgame;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.builder.SpringApplicationBuilder;
6 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
7 | import org.springframework.context.annotation.Bean;
8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
9 | import org.springframework.security.web.SecurityFilterChain;
10 |
11 | @SpringBootApplication
12 | public class CashGameTestApplication extends SpringBootServletInitializer
13 | {
14 | @Override
15 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
16 | {
17 | return application.sources(CashGameTestApplication.class);
18 | }
19 |
20 | public static void main(String[] args)
21 | {
22 | SpringApplication.run(CashGameTestApplication.class, args);
23 | }
24 |
25 | @Bean
26 | public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
27 | http.anonymous();
28 | // https://docs.spring.io/spring-security/site/docs/5.0.x/reference/html/csrf.html
29 | http.csrf().disable(); // REST requests doesn't use CSRF
30 | return http.build();
31 | }
32 | }
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/cashgame_players.result.xml:
--------------------------------------------------------------------------------
1 |
43 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/persistence/QuantityPO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.persistence;
2 |
3 | import java.io.Serializable;
4 | import java.math.BigDecimal;
5 |
6 | import jakarta.persistence.Embeddable;
7 | import javax.validation.constraints.NotNull;
8 |
9 | @Embeddable
10 | public class QuantityPO implements Serializable
11 | {
12 | private static final long serialVersionUID = 1L;
13 | @NotNull
14 | private String unit;
15 | @NotNull
16 | private BigDecimal amount;
17 | @NotNull
18 | private String unitScale;
19 |
20 | public QuantityPO()
21 | {
22 | }
23 |
24 | public QuantityPO(BigDecimal amount, String unit, String unitScale)
25 | {
26 | this.unit = unit;
27 | this.amount = amount;
28 | this.unitScale = unitScale;
29 | }
30 |
31 | public BigDecimal getAmount()
32 | {
33 | return amount;
34 | }
35 |
36 | public String getUnit()
37 | {
38 | return unit;
39 | }
40 |
41 | public String getUnitScale()
42 | {
43 | return unitScale;
44 | }
45 |
46 | public void setAmount(BigDecimal amount)
47 | {
48 | this.amount = amount;
49 | }
50 |
51 | public void setUnit(String unit)
52 | {
53 | this.unit = unit;
54 | }
55 |
56 | public void setUnitScale(String unitScale)
57 | {
58 | this.unitScale = unitScale;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/cashgame_players.result.xml:
--------------------------------------------------------------------------------
1 |
43 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/cashgame_players.result.xml:
--------------------------------------------------------------------------------
1 |
43 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/business/tournament_export.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/GroupBORepository.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import java.util.List;
4 | import java.util.Optional;
5 |
6 | import de.hatoka.player.capi.business.PlayerRef;
7 | import de.hatoka.user.capi.business.UserRef;
8 |
9 | public interface GroupBORepository
10 | {
11 | /**
12 | * Creates a new group
13 | *
14 | * @param groupRef
15 | * @param groupName
16 | * of group
17 | * @param initial owner and member
18 | * @param ownerMemberName
19 | * name of owner in the group
20 | * @return created group
21 | */
22 | GroupBO createGroup(GroupRef groupRef, String name);
23 |
24 | /**
25 | * Creates a new group
26 | *
27 | * @param name of group
28 | * @return created group
29 | */
30 | Optional findGroup(GroupRef groupRef);
31 |
32 | /**
33 | * @return list of all groups
34 | */
35 | List getAllGroups();
36 |
37 | /**
38 | * @return list of related groups (admin)
39 | */
40 | List getGroups(UserRef userRef);
41 |
42 | /**
43 | * @return list of related groups (player)
44 | */
45 | List getGroups(PlayerRef memberRef);
46 |
47 | /**
48 | * Removes all groups of this repository
49 | */
50 | default void clear()
51 | {
52 | getAllGroups().forEach(GroupBO::remove);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/business/tournament_export.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/java/de/hatoka/common/capi/encoding/ObjectSerializer.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.encoding;
2 |
3 | import java.io.ByteArrayInputStream;
4 | import java.io.ByteArrayOutputStream;
5 | import java.io.IOException;
6 | import java.io.ObjectInput;
7 | import java.io.ObjectInputStream;
8 | import java.io.ObjectOutput;
9 | import java.io.ObjectOutputStream;
10 | import java.io.Serializable;
11 |
12 | public class ObjectSerializer
13 | {
14 | public T convert(byte[] yourBytes) throws IOException
15 | {
16 | try (ByteArrayInputStream bis = new ByteArrayInputStream(yourBytes))
17 | {
18 | try (ObjectInput in = new ObjectInputStream(bis))
19 | {
20 | @SuppressWarnings("unchecked")
21 | T object = (T)in.readObject();
22 | return object;
23 | }
24 | catch(ClassNotFoundException e)
25 | {
26 | throw new IOException("Class for serialized object not found", e);
27 | }
28 | }
29 | }
30 |
31 | public byte[] convert(T object) throws IOException
32 | {
33 | try (ByteArrayOutputStream bos = new ByteArrayOutputStream())
34 | {
35 | try (ObjectOutput out = new ObjectOutputStream(bos))
36 | {
37 | out.writeObject(object);
38 | return bos.toByteArray();
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/test/java/de/hatoka/common/capi/rest/MoneyDeserializerTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.rest;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | import com.fasterxml.jackson.core.JsonProcessingException;
8 | import com.fasterxml.jackson.databind.JsonMappingException;
9 | import com.fasterxml.jackson.databind.ObjectMapper;
10 |
11 | import de.hatoka.common.capi.math.Money;
12 |
13 | class MoneyDeserializerTest
14 | {
15 | public static class MoneyContainer
16 | {
17 | private String name;
18 | private Money amount;
19 | public String getName()
20 | {
21 | return name;
22 | }
23 | public void setName(String name)
24 | {
25 | this.name = name;
26 | }
27 | public Money getAmount()
28 | {
29 | return amount;
30 | }
31 | public void setAmount(Money amount)
32 | {
33 | this.amount = amount;
34 | }
35 | }
36 |
37 | @Test
38 | void test() throws JsonMappingException, JsonProcessingException
39 | {
40 | String json = "{ \"name\":\"myname\", \"amount\":\"10 EUR\"}";
41 | MoneyContainer resolved = new ObjectMapper().readValue(json, MoneyContainer.class);
42 | assertEquals(Money.valueOf("10 EUR"), resolved.amount);
43 | assertEquals("myname", resolved.name);
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/main/java/de/hatoka/offlinepoker/application/OfflinePokerApplication.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.offlinepoker.application;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.boot.builder.SpringApplicationBuilder;
6 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
7 | import org.springframework.context.annotation.ComponentScan;
8 | import org.springframework.context.annotation.Import;
9 |
10 | import de.hatoka.cashgame.capi.CashGameConfiguration;
11 | import de.hatoka.group.capi.GroupConfiguration;
12 | import de.hatoka.player.capi.PlayerConfiguration;
13 | import de.hatoka.tournament.capi.TournamentConfiguration;
14 | import de.hatoka.user.capi.UserConfiguration;
15 |
16 | @SpringBootApplication
17 | @ComponentScan
18 | @Import(value = { UserConfiguration.class, GroupConfiguration.class, PlayerConfiguration.class, CashGameConfiguration.class, TournamentConfiguration.class })
19 | public class OfflinePokerApplication extends SpringBootServletInitializer
20 | {
21 | @Override
22 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
23 | {
24 | return application.sources(OfflinePokerApplication.class);
25 | }
26 |
27 | public static void main(String[] args)
28 | {
29 | SpringApplication.run(OfflinePokerApplication.class, args);
30 | }
31 | }
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/business/tournament_export.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/de.hatoka.offlinepoker.service/src/main/java/de/hatoka/offlinepoker/logging/RequestConverter.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.offlinepoker.logging;
2 |
3 | import jakarta.servlet.http.HttpServletRequest;
4 |
5 | import org.springframework.web.context.request.RequestAttributes;
6 | import org.springframework.web.context.request.RequestContextHolder;
7 | import org.springframework.web.context.request.ServletRequestAttributes;
8 |
9 | import ch.qos.logback.classic.pattern.ClassicConverter;
10 | import ch.qos.logback.classic.spi.ILoggingEvent;
11 |
12 | public class RequestConverter extends ClassicConverter
13 | {
14 | @Override
15 | public String convert(ILoggingEvent event) {
16 | String requestInfo = "";
17 | try
18 | {
19 | requestInfo = extractRequestInfo(requestInfo);
20 | }
21 | catch(Exception e)
22 | {
23 | // exception not handled to avoid system failures because of logging
24 | }
25 | return requestInfo;
26 | }
27 |
28 | private String extractRequestInfo(String requestInfo)
29 | {
30 | RequestAttributes attrs = RequestContextHolder.getRequestAttributes();
31 | if (attrs != null && attrs instanceof ServletRequestAttributes) {
32 | HttpServletRequest request = ((ServletRequestAttributes)attrs).getRequest();
33 | requestInfo = "[" + request.getMethod() + ":'" + request.getRequestURI() + "']";
34 | }
35 | return requestInfo;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/test/java/de/hatoka/user/internal/persistence/UserDaoTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.internal.persistence;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 | import static org.junit.jupiter.api.Assertions.assertTrue;
5 |
6 | import java.util.Optional;
7 |
8 | import org.junit.jupiter.api.Test;
9 | import org.junit.jupiter.api.extension.ExtendWith;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.test.context.ContextConfiguration;
12 | import org.springframework.test.context.junit.jupiter.SpringExtension;
13 |
14 | import de.hatoka.user.capi.business.UserRef;
15 | import tests.de.hatoka.user.UserTestConfiguration;
16 |
17 | @ExtendWith(SpringExtension.class)
18 | @ContextConfiguration(classes = { UserTestConfiguration.class })
19 | public class UserDaoTest
20 | {
21 | private static final String LOCAL_REF = UserDaoTest.class.getSimpleName();
22 | private static final UserRef USER_REF = UserRef.valueOfLocal(LOCAL_REF);
23 |
24 | @Autowired
25 | private UserDao userDao;
26 |
27 | @Test
28 | public void testFindLocalRef()
29 | {
30 | UserPO userPO = new UserPO();
31 | userPO.setGlobalRef(USER_REF.getGlobalRef());
32 | userDao.save(userPO);
33 | Optional findUserOpt = userDao.findByGlobalRef(USER_REF.getGlobalRef());
34 | assertTrue(findUserOpt.isPresent());
35 | assertEquals(userPO, findUserOpt.get());
36 | userDao.delete(userPO);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/internal/remote/GroupBO2RO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.remote;
2 |
3 | import java.util.List;
4 | import java.util.stream.Collectors;
5 |
6 | import org.springframework.stereotype.Component;
7 |
8 | import de.hatoka.group.capi.business.GroupBO;
9 | import de.hatoka.group.capi.remote.GroupDataRO;
10 | import de.hatoka.group.capi.remote.GroupInfoRO;
11 | import de.hatoka.group.capi.remote.GroupRO;
12 |
13 | @Component
14 | public class GroupBO2RO
15 | {
16 | public GroupRO apply(GroupBO group)
17 | {
18 | GroupDataRO data = new GroupDataRO();
19 | data.setName(group.getName());
20 | data.setAdmins(group.getAdmins().stream().map(a -> a.getUser().getRef().getGlobalRef()).collect(Collectors.toList()));
21 | data.setMembers(group.getMembers().stream().map(m -> m.getPlayer().get().getRef().getGlobalRef()).collect(Collectors.toList()));
22 | GroupInfoRO info = new GroupInfoRO();
23 | info.setCountMember(group.getMembers().size());
24 | info.setCountAdmin(group.getAdmins().size());
25 | GroupRO result = new GroupRO();
26 | result.setRefGlobal(group.getRef().getGlobalRef());
27 | result.setRefLocal(group.getRef().getLocalRef());
28 | result.setData(data);
29 | result.setInfo(info);
30 | return result;
31 | }
32 |
33 | public List apply(List groups)
34 | {
35 | return groups.stream().map(this::apply).collect(Collectors.toList());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/TableBOImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Collections;
5 | import java.util.Comparator;
6 | import java.util.List;
7 |
8 | import org.springframework.beans.factory.config.ConfigurableBeanFactory;
9 | import org.springframework.context.annotation.Scope;
10 | import org.springframework.stereotype.Component;
11 |
12 | import de.hatoka.tournament.capi.business.CompetitorBO;
13 | import de.hatoka.tournament.capi.business.TableBO;
14 |
15 | @Component
16 | @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
17 | public class TableBOImpl implements TableBO, ITableBO
18 | {
19 | private final int number;
20 | private List competitors = new ArrayList<>();
21 |
22 | public TableBOImpl(int number)
23 | {
24 | this.number = number;
25 | }
26 |
27 | @Override
28 | public void add(CompetitorBO competitor)
29 | {
30 | competitors.add(competitor);
31 | competitors.sort(new Comparator()
32 | {
33 | @Override
34 | public int compare(CompetitorBO o1, CompetitorBO o2)
35 | {
36 | return o1.getSeatNo().compareTo(o2.getSeatNo());
37 | }
38 | });
39 | }
40 |
41 | @Override
42 | public int getTableNo()
43 | {
44 | return number;
45 | }
46 |
47 | @Override
48 | public List getCompetitors()
49 | {
50 | return Collections.unmodifiableList(competitors);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/business/CashGameComparators.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.business;
2 |
3 | import java.util.Comparator;
4 |
5 | import de.hatoka.cashgame.capi.business.CompetitorBO;
6 | import de.hatoka.common.capi.math.Comparators;
7 |
8 | public final class CashGameComparators
9 | {
10 | private CashGameComparators()
11 | {
12 | }
13 |
14 | public static final Comparator RESULT = new Comparator()
15 | {
16 | @Override
17 | public int compare(CompetitorBO o1, CompetitorBO o2)
18 | {
19 | if (o1 == null || o2 == null)
20 | {
21 | return Comparators.NULL.compare(o1, o2);
22 | }
23 | // largest first
24 | int result = Comparators.MONEY.compare(o2.getResult(), o1.getResult());
25 | if (result == 0)
26 | {
27 | if( o1.isActive() != o2.isActive())
28 | {
29 | result = o1.isActive() ? -1 : 1;
30 | }
31 | }
32 | return result;
33 | }
34 | };
35 |
36 | public static final Comparator NAME = new Comparator()
37 | {
38 | @Override
39 | public int compare(CompetitorBO o1, CompetitorBO o2)
40 | {
41 | if (o1 == null || o2 == null)
42 | {
43 | return Comparators.NULL.compare(o1, o2);
44 | }
45 | return Comparators.STRING.compare(o1.getPlayer().getName(), o2.getPlayer().getName());
46 | }
47 | };
48 | }
49 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | HATOKA Account Application
7 |
8 | Account DB
9 | jdbc/AccountDB
10 | javax.sql.DataSource
11 | Container
12 |
13 |
14 |
15 | Resource reference to a factory for javax.mail.Session
16 | instances that may be used for sending electronic mail
17 | messages, preconfigured to connect to the appropriate
18 | SMTP server.
19 |
20 | mail/Session
21 | javax.mail.Session
22 | Container
23 |
24 |
25 | Account Application
26 | org.glassfish.jersey.servlet.ServletContainer
27 |
28 | javax.ws.rs.Application
29 | de.hatoka.account.internal.app.AccountApplication
30 |
31 |
32 |
33 | Account Application
34 | /account/*
35 |
36 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/test/java/de/hatoka/group/internal/persistence/MemberDaoTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.internal.persistence;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertFalse;
4 | import static org.junit.jupiter.api.Assertions.assertTrue;
5 |
6 | import java.util.List;
7 |
8 | import org.junit.jupiter.api.Test;
9 | import org.junit.jupiter.api.extension.ExtendWith;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.test.context.ContextConfiguration;
12 | import org.springframework.test.context.junit.jupiter.SpringExtension;
13 |
14 | import tests.de.hatoka.group.GroupTestConfiguration;
15 |
16 | @ExtendWith(SpringExtension.class)
17 | @ContextConfiguration(classes = { GroupTestConfiguration.class })
18 | public class MemberDaoTest
19 | {
20 | private static final String PLAYER_REF = MemberDaoTest.class.getSimpleName() + "OWNER";
21 | private static final String GROUP_REF = MemberDaoTest.class.getSimpleName() + "GROUP";
22 |
23 | @Autowired
24 | private GroupMemberDao dao;
25 |
26 | @Test
27 | public void testFindByGroupRef()
28 | {
29 | GroupMemberPO member = new GroupMemberPO();
30 | member.setGroupRef(GROUP_REF);
31 | member.setPlayerRef(PLAYER_REF);
32 |
33 | dao.save(member);
34 | List members = dao.findByGroupRef(GROUP_REF);
35 | assertTrue(members.contains(member), "contains member");
36 | List otherMembers = dao.findByGroupRef(GROUP_REF + "non_existing");
37 | assertFalse(otherMembers.contains(member), "doesn't contain member of other group");
38 | dao.delete(member);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/test/java/de/hatoka/common/capi/math/PriceTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.math;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 |
5 | import java.math.BigDecimal;
6 |
7 | import org.junit.jupiter.api.Test;
8 |
9 | public class PriceTest
10 | {
11 | private static final Quantity ONE_KILO_GRAM = new Quantity(BigDecimal.ONE, UnitScale.KILO, Unit.GRAM);
12 | private static final Quantity SEVEN_HUNDRED_GRAM = new Quantity(new BigDecimal("700"), Unit.GRAM);
13 |
14 | private static final BigDecimal BIG_DECIMAL_0_84 = new BigDecimal("0.84");
15 | private static final BigDecimal BIG_DECIMAL_1_19 = new BigDecimal("1.19");
16 | private static final Price UNDER_TEST_ONE = new Price(BigDecimal.ONE, CurrencyConstants.EUR);
17 |
18 | private static final Price PRICE_10_EUR_PER_KILO = new Price(Money.valueOf(BigDecimal.TEN, CurrencyConstants.EUR),
19 | ONE_KILO_GRAM);
20 | private static final Price PRICE_7_EUR_PER_SEVEN_HUNDED_GRAM = new Price(
21 | Money.valueOf(new BigDecimal("7"), CurrencyConstants.EUR), SEVEN_HUNDRED_GRAM);
22 |
23 | @Test
24 | public void testDivide()
25 | {
26 | assertEquals(BIG_DECIMAL_0_84, UNDER_TEST_ONE.divide(BIG_DECIMAL_1_19).getMoney().round().getAmount());
27 | }
28 |
29 | @Test
30 | public void testKiloMultiply()
31 | {
32 | assertEquals(PRICE_7_EUR_PER_SEVEN_HUNDED_GRAM, PRICE_10_EUR_PER_KILO.getPriceFor(SEVEN_HUNDRED_GRAM));
33 | }
34 |
35 | @Test
36 | public void testMulitiply()
37 | {
38 | assertEquals(BIG_DECIMAL_1_19, UNDER_TEST_ONE.multiply(BIG_DECIMAL_1_19).getMoney().round().getAmount());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/main/java/de/hatoka/cashgame/internal/remote/model/RankRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.cashgame.internal.remote.model;
2 |
3 | import java.math.BigDecimal;
4 |
5 | import de.hatoka.common.capi.math.Money;
6 |
7 | public class RankRO
8 | {
9 | private int firstPosition;
10 | private Integer lastPosition;
11 | private BigDecimal percentage; // 0.5 for 50%
12 | private Money amountPerPlayer;
13 | private Money amount;
14 |
15 | public RankRO()
16 | {
17 | }
18 |
19 | public int getFirstPosition()
20 | {
21 | return firstPosition;
22 | }
23 |
24 | public void setFirstPosition(int firstPosition)
25 | {
26 | this.firstPosition = firstPosition;
27 | }
28 |
29 | public Integer getLastPosition()
30 | {
31 | return lastPosition;
32 | }
33 |
34 | public void setLastPosition(Integer lastPosition)
35 | {
36 | this.lastPosition = lastPosition;
37 | }
38 |
39 | public BigDecimal getPercentage()
40 | {
41 | return percentage;
42 | }
43 |
44 | public void setPercentage(BigDecimal percentage)
45 | {
46 | this.percentage = percentage;
47 | }
48 |
49 | public boolean isPercentageFilled()
50 | {
51 | return percentage != null && !percentage.equals(BigDecimal.ZERO);
52 | }
53 |
54 | public Money getAmountPerPlayer()
55 | {
56 | return amountPerPlayer;
57 | }
58 |
59 | public void setAmountPerPlayer(Money amountPerPlayer)
60 | {
61 | this.amountPerPlayer = amountPerPlayer;
62 | }
63 |
64 | public Money getAmount()
65 | {
66 | return amount;
67 | }
68 |
69 | public void setAmount(Money amount)
70 | {
71 | this.amount = amount;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/remote/model/RankRO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.remote.model;
2 |
3 | import java.math.BigDecimal;
4 |
5 | import de.hatoka.common.capi.math.Money;
6 |
7 | public class RankRO
8 | {
9 | private int firstPosition;
10 | private Integer lastPosition;
11 | private BigDecimal percentage; // 0.5 for 50%
12 | private Money amountPerPlayer;
13 | private Money amount;
14 |
15 | public RankRO()
16 | {
17 | }
18 |
19 | public int getFirstPosition()
20 | {
21 | return firstPosition;
22 | }
23 |
24 | public void setFirstPosition(int firstPosition)
25 | {
26 | this.firstPosition = firstPosition;
27 | }
28 |
29 | public Integer getLastPosition()
30 | {
31 | return lastPosition;
32 | }
33 |
34 | public void setLastPosition(Integer lastPosition)
35 | {
36 | this.lastPosition = lastPosition;
37 | }
38 |
39 | public BigDecimal getPercentage()
40 | {
41 | return percentage;
42 | }
43 |
44 | public void setPercentage(BigDecimal percentage)
45 | {
46 | this.percentage = percentage;
47 | }
48 |
49 | public boolean isPercentageFilled()
50 | {
51 | return percentage != null && !percentage.equals(BigDecimal.ZERO);
52 | }
53 |
54 | public Money getAmountPerPlayer()
55 | {
56 | return amountPerPlayer;
57 | }
58 |
59 | public void setAmountPerPlayer(Money amountPerPlayer)
60 | {
61 | this.amountPerPlayer = amountPerPlayer;
62 | }
63 |
64 | public Money getAmount()
65 | {
66 | return amount;
67 | }
68 |
69 | public void setAmount(Money amount)
70 | {
71 | this.amount = amount;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/internal/business/UserBORepositoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.internal.business;
2 |
3 | import java.util.List;
4 | import java.util.Optional;
5 | import java.util.stream.Collectors;
6 |
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | import de.hatoka.common.capi.exceptions.DuplicateObjectException;
11 | import de.hatoka.user.capi.business.UserBO;
12 | import de.hatoka.user.capi.business.UserBORepository;
13 | import de.hatoka.user.capi.business.UserRef;
14 | import de.hatoka.user.internal.persistence.UserDao;
15 | import de.hatoka.user.internal.persistence.UserPO;
16 |
17 | @Component
18 | public class UserBORepositoryImpl implements UserBORepository
19 | {
20 | @Autowired
21 | private UserDao userDao;
22 | @Autowired
23 | private UserBOFactory factory;
24 |
25 | @Override
26 | public UserBO createUser(UserRef globalRef)
27 | {
28 | Optional userOpt = userDao.findByGlobalRef(globalRef.getGlobalRef());
29 | if (userOpt.isPresent())
30 | {
31 | throw new DuplicateObjectException("User", "externalRef", globalRef.getGlobalRef());
32 | }
33 | UserPO userPO = new UserPO();
34 | userPO.setGlobalRef(globalRef.getGlobalRef());
35 | userDao.save(userPO);
36 | return factory.get(userPO);
37 | }
38 |
39 | @Override
40 | public Optional findUser(UserRef externalRef)
41 | {
42 | return userDao.findByGlobalRef(externalRef.getGlobalRef()).map(factory::get);
43 | }
44 |
45 | @Override
46 | public List getAllUsers()
47 | {
48 | return userDao.findAll().stream().map(factory::get).collect(Collectors.toList());
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/de.hatoka.user/src/main/java/de/hatoka/user/capi/business/UserRef.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.user.capi.business;
2 |
3 | import java.util.Objects;
4 |
5 | public class UserRef
6 | {
7 | private static final String USER_REF_PREFIX = "user:";
8 | private final String localRef;
9 |
10 | /**
11 | * @param localRef local user reference (like "abc")
12 | * @return user ref
13 | */
14 | public static UserRef valueOfLocal(String localRef)
15 | {
16 | return new UserRef(localRef);
17 | }
18 |
19 | /**
20 | * @param globalRef global user reference (like "user:abc")
21 | * @return
22 | */
23 | public static UserRef valueOfGlobal(String globalRef)
24 | {
25 | if (globalRef.startsWith(USER_REF_PREFIX))
26 | {
27 | return new UserRef(globalRef.substring(USER_REF_PREFIX.length()));
28 | }
29 | throw new IllegalArgumentException("ref '"+globalRef+"' is not a user");
30 | }
31 |
32 | private UserRef(String localRef)
33 | {
34 | this.localRef = localRef;
35 | }
36 |
37 | public String getLocalRef()
38 | {
39 | return localRef;
40 | }
41 |
42 | public String getGlobalRef()
43 | {
44 | return USER_REF_PREFIX + localRef;
45 | }
46 |
47 | @Override
48 | public String toString()
49 | {
50 | return getGlobalRef();
51 | }
52 |
53 | @Override
54 | public int hashCode()
55 | {
56 | return Objects.hash(localRef);
57 | }
58 |
59 | @Override
60 | public boolean equals(Object obj)
61 | {
62 | if (this == obj)
63 | return true;
64 | if (obj == null)
65 | return false;
66 | if (getClass() != obj.getClass())
67 | return false;
68 | UserRef other = (UserRef)obj;
69 | return Objects.equals(localRef, other.localRef);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/de.hatoka.group/src/main/java/de/hatoka/group/capi/business/GroupRef.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.group.capi.business;
2 |
3 | import java.util.Objects;
4 |
5 | public class GroupRef
6 | {
7 | private static final String GROUP_REF_PREFIX = "group:";
8 | private final String localRef;
9 |
10 | /**
11 | * @param localRef local user reference (like "abc")
12 | * @return user ref
13 | */
14 | public static GroupRef valueOfLocal(String localRef)
15 | {
16 | return new GroupRef(localRef);
17 | }
18 |
19 | /**
20 | * @param globalRef global user reference (like "group:abc")
21 | * @return
22 | */
23 | public static GroupRef valueOfGlobal(String globalRef)
24 | {
25 | if (globalRef.startsWith(GROUP_REF_PREFIX))
26 | {
27 | return new GroupRef(globalRef.substring(GROUP_REF_PREFIX.length()));
28 | }
29 | throw new IllegalArgumentException("ref '"+globalRef+"' is not a group");
30 | }
31 |
32 | private GroupRef(String localRef)
33 | {
34 | this.localRef = localRef;
35 | }
36 |
37 | public String getLocalRef()
38 | {
39 | return localRef;
40 | }
41 |
42 | public String getGlobalRef()
43 | {
44 | return GROUP_REF_PREFIX + localRef;
45 | }
46 |
47 | @Override
48 | public String toString()
49 | {
50 | return getGlobalRef();
51 | }
52 |
53 | @Override
54 | public int hashCode()
55 | {
56 | return Objects.hash(localRef);
57 | }
58 |
59 | @Override
60 | public boolean equals(Object obj)
61 | {
62 | if (this == obj)
63 | return true;
64 | if (obj == null)
65 | return false;
66 | if (getClass() != obj.getClass())
67 | return false;
68 | GroupRef other = (GroupRef)obj;
69 | return Objects.equals(localRef, other.localRef);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n%ex%n
8 |
9 |
10 |
11 | logs/error.log
12 |
13 | logs/error.%d{yyyy-MM-dd}.log.zip
14 |
15 |
16 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n%ex%n
17 |
18 |
19 |
20 | logs/debug.log
21 |
22 | logs/debug.%d{yyyy-MM-dd}.log.zip
23 |
24 |
25 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_tables.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
Table 1
3 |
4 |
5 | | Obi-Wan |
6 |
7 |
10 |
13 | |
14 |
15 |
16 | | Trinity |
17 |
18 |
21 |
24 | |
25 |
26 |
27 |
Table 2
28 |
29 |
30 | | Neo |
31 |
32 |
35 |
38 | |
39 |
40 |
41 |
Inactive players
42 |
43 |
44 | | Player |
45 | Position |
46 | Result |
47 |
48 |
49 | | Darth Mouth |
50 | 9 |
51 | 3 $ |
52 |
53 |
54 |
57 |
58 |
--------------------------------------------------------------------------------
/de.hatoka.common/src/test/java/de/hatoka/common/capi/math/QuantityTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.common.capi.math;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 | import static org.junit.jupiter.api.Assertions.assertThrows;
5 |
6 | import java.math.BigDecimal;
7 |
8 | import org.junit.jupiter.api.Test;
9 |
10 | public class QuantityTest
11 | {
12 | private static final Quantity ONE_KILO_GRAM = new Quantity(BigDecimal.ONE, UnitScale.KILO, Unit.GRAM);
13 | private static final Quantity SEVEN_HUNDRED_GRAM = new Quantity(new BigDecimal("700"), Unit.GRAM);
14 | private static final Quantity SEVEN_HUNDRED_KILO_GRAM = new Quantity(new BigDecimal("700"), UnitScale.KILO,
15 | Unit.GRAM);
16 | private static final Quantity SEVEN_HUNDRED_LITER = new Quantity(new BigDecimal("700"), Unit.LITER);
17 |
18 | @Test
19 | public void testDivide()
20 | {
21 | assertEquals(new BigDecimal("0.7"), SEVEN_HUNDRED_GRAM.divide(ONE_KILO_GRAM));
22 | assertEquals(new BigDecimal("700"), SEVEN_HUNDRED_KILO_GRAM.divide(ONE_KILO_GRAM));
23 | }
24 |
25 | @Test
26 | public void testEquals()
27 | {
28 | assertEquals(new Quantity(new BigDecimal("700.00"), Unit.GRAM).hashCode(),
29 | new Quantity(new BigDecimal("700"), Unit.GRAM).hashCode());
30 | assertEquals(new Quantity(new BigDecimal("700.00"), Unit.GRAM), new Quantity(new BigDecimal("700"), Unit.GRAM));
31 | }
32 |
33 | @Test
34 | public void testToString()
35 | {
36 | assertEquals("700g", SEVEN_HUNDRED_GRAM.toString());
37 | assertEquals("1kg", ONE_KILO_GRAM.toString());
38 | assertEquals("1", Quantity.ONE_PCS.toString());
39 | }
40 |
41 | @Test
42 | public void testWrongUnit()
43 | {
44 | assertThrows(IllegalArgumentException.class, () -> {
45 | SEVEN_HUNDRED_LITER.divide(ONE_KILO_GRAM);
46 | });
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_tables.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
Table 1
3 |
4 |
5 | | Obi-Wan |
6 |
7 |
10 |
13 | |
14 |
15 |
16 | | Trinity |
17 |
18 |
21 |
24 | |
25 |
26 |
27 |
Table 2
28 |
29 |
30 | | Neo |
31 |
32 |
35 |
38 | |
39 |
40 |
41 |
Inactive players
42 |
43 |
44 | | Player |
45 | Position |
46 | Result |
47 |
48 |
49 | | Darth Mouth |
50 | 9 |
51 | 3 $ |
52 |
53 |
54 |
57 |
58 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/capi/business/CompetitorBO.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.capi.business;
2 |
3 | import de.hatoka.common.capi.math.Money;
4 | import de.hatoka.player.capi.business.PlayerBO;
5 | import de.hatoka.tournament.capi.types.CompetitorState;
6 |
7 | /**
8 | * A competitor is an player attending at a tournament.
9 | */
10 | public interface CompetitorBO
11 | {
12 | /**
13 | * @return the amount of money spend by player (buy-in and re-buy)
14 | */
15 | Money getInPlay();
16 |
17 | /**
18 | * @return the player instance
19 | */
20 | PlayerBO getPlayer();
21 |
22 | /**
23 | * @return (Current) tournament position of player.
24 | */
25 | Integer getPosition();
26 |
27 | /**
28 | * @return the amount of money won by player after going out. (without investment)
29 | */
30 | Money getResult();
31 |
32 | /**
33 | * Player is in.
34 | *
35 | * @return
36 | */
37 | CompetitorState getState();
38 |
39 | /**
40 | * @return true if player is active, means can playing cards
41 | */
42 | default boolean isActive()
43 | {
44 | return CompetitorState.ACTIVE.equals(getState());
45 | }
46 |
47 | /**
48 | * @return table number the player is sitting
49 | */
50 | Integer getTableNo();
51 |
52 | /**
53 | * @return seat number the player is sitting
54 | */
55 | Integer getSeatNo();
56 |
57 | /**
58 | * Removes competitor from game
59 | */
60 | void remove();
61 |
62 | /**
63 | * Competitor pays the buy-in and is allowed to play (is active afterwards)
64 | *
65 | * @param competitorBO
66 | */
67 | void buyin();
68 |
69 | /**
70 | * Competitor pays additional re-buy and is allowed to play (is still active)
71 | * Rebuy amount is defined by tournament and/or round.
72 | */
73 | void rebuy();
74 | }
75 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_tables.result.xml:
--------------------------------------------------------------------------------
1 |
2 |
Table 1
3 |
4 |
5 | | Obi-Wan |
6 |
7 |
10 |
13 | |
14 |
15 |
16 | | Trinity |
17 |
18 |
21 |
24 | |
25 |
26 |
27 |
Table 2
28 |
29 |
30 | | Neo |
31 |
32 |
35 |
38 | |
39 |
40 |
41 |
Inactive players
42 |
43 |
44 | | Player |
45 | Position |
46 | Result |
47 |
48 |
49 | | Darth Mouth |
50 | 9 |
51 | 3 $ |
52 |
53 |
54 |
57 |
58 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/clickdummy/tournament/bigScreen.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Main Event
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
Current Time
16:01:10
22 |
23 |
24 |
Current Level
09:68
25 |
26 |
27 |
Next Pause
17:50
28 |
29 |
30 |
31 |
32 |
Stack Average
2500
33 |
34 |
35 |
Players left
15/20
36 |
37 |
38 |
49 |
50 |
51 |
(Next Level 250/500/0)
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/clickdummy/tournament/bigScreen.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Main Event
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
Current Time
16:01:10
22 |
23 |
24 |
Current Level
09:68
25 |
26 |
27 |
Next Pause
17:50
28 |
29 |
30 |
31 |
32 |
Stack Average
2500
33 |
34 |
35 |
Players left
15/20
36 |
37 |
38 |
49 |
50 |
51 |
(Next Level 250/500/0)
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/de.hatoka.tournament/src/main/java/de/hatoka/tournament/internal/business/TournamentBORepositoryImpl.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.tournament.internal.business;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 | import java.util.stream.Collectors;
6 |
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | import de.hatoka.tournament.capi.business.TournamentBO;
11 | import de.hatoka.tournament.capi.business.TournamentBORepository;
12 | import de.hatoka.tournament.internal.persistence.TournamentDao;
13 | import de.hatoka.tournament.internal.persistence.TournamentPO;
14 | import de.hatoka.user.capi.business.UserRef;
15 |
16 | @Component
17 | public class TournamentBORepositoryImpl implements TournamentBORepository
18 | {
19 | @Autowired
20 | private TournamentBOFactory tournamentFactory;
21 | @Autowired
22 | private TournamentDao tournamentDao;
23 |
24 | @Override
25 | public TournamentBO createTournament(UserRef userRef, String localTournamentRef, Date startDate, String name)
26 | {
27 | return tournamentFactory.get(createTournamentPO(userRef, localTournamentRef, name, startDate));
28 | }
29 |
30 | private TournamentPO createTournamentPO(UserRef userRef, String localTournamentRef, String name, Date startDate)
31 | {
32 | TournamentPO tournamentPO = new TournamentPO();
33 | tournamentPO.setOwnerRef(userRef.getGlobalRef());
34 | tournamentPO.setLocalRef(localTournamentRef);
35 | tournamentPO.setName(name);
36 | tournamentPO.setStartDate(startDate);
37 | return tournamentDao.save(tournamentPO);
38 | }
39 |
40 | @Override
41 | public List getTournaments(UserRef userRef)
42 | {
43 | return tournamentDao.getByOwnerRef(userRef.getGlobalRef()).stream()
44 | .map(tournamentFactory::get)
45 | .collect(Collectors.toList());
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/de.hatoka.player/src/test/java/de/hatoka/player/capi/business/PlayerBORepositoryTest.java:
--------------------------------------------------------------------------------
1 | package de.hatoka.player.capi.business;
2 |
3 | import static org.junit.jupiter.api.Assertions.assertEquals;
4 | import static org.junit.jupiter.api.Assertions.assertTrue;
5 |
6 | import java.util.List;
7 |
8 | import org.junit.jupiter.api.Test;
9 | import org.junit.jupiter.api.extension.ExtendWith;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.test.context.ContextConfiguration;
12 | import org.springframework.test.context.junit.jupiter.SpringExtension;
13 |
14 | import de.hatoka.user.capi.business.UserRef;
15 | import tests.de.hatoka.player.PlayerTestConfiguration;
16 |
17 | @ExtendWith(SpringExtension.class)
18 | @ContextConfiguration(classes = { PlayerTestConfiguration.class })
19 | public class PlayerBORepositoryTest
20 | {
21 | private static final UserRef USER_REF = UserRef.valueOfLocal(PlayerBORepositoryTest.class.getSimpleName());
22 | private static final PlayerRef PLAYER_REF_ONE = PlayerRef.valueOf(USER_REF, "player-one");
23 | private static final PlayerRef PLAYER_REF_TWO = PlayerRef.valueOf(USER_REF, "player-two");
24 |
25 | @Autowired
26 | private PlayerBORepository repository;
27 |
28 | @Test
29 | public void testCrud()
30 | {
31 | PlayerBO player1 = repository.createPlayer(PLAYER_REF_ONE, "ready-player-one");
32 | PlayerBO player2 = repository.createPlayer(PLAYER_REF_TWO, "ready-player-two");
33 | List players = repository.getPlayers(USER_REF);
34 | assertEquals(2, players.size());
35 | assertTrue(players.contains(player1));
36 | assertTrue(players.contains(player2));
37 | player1.remove();
38 | players = repository.getPlayers(USER_REF);
39 | assertEquals(1, players.size());
40 | player2.remove();
41 | players = repository.getPlayers(USER_REF);
42 | assertTrue(players.isEmpty());
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/de.hatoka.cashgame/src/test/resources/de/hatoka/tournament/internal/templates/app/tournament_general.result.xml:
--------------------------------------------------------------------------------
1 |
28 |
--------------------------------------------------------------------------------