-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Factory for Card, Game, and CardInPlay
See #24 Signed-off-by: vartanbeno <vartanbeno@gmail.com>
- Loading branch information
1 parent
fc03dad
commit 29bd322
Showing
6 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package dom.model.card; | ||
|
||
import org.dsrg.soenea.domain.MapperException; | ||
import org.dsrg.soenea.uow.MissingMappingException; | ||
import org.dsrg.soenea.uow.UoW; | ||
|
||
public class CardFactory { | ||
|
||
public static Card createNew(long id, long version, long deck, String type, String name) | ||
throws MissingMappingException, MapperException { | ||
|
||
Card card = new Card(id, version, deck, type, name); | ||
UoW.getCurrent().registerNew(card); | ||
|
||
return card; | ||
|
||
} | ||
|
||
public static Card createClean(long id, long version, long deck, String type, String name) { | ||
|
||
Card card = new Card(id, version, deck, type, name); | ||
UoW.getCurrent().registerClean(card); | ||
|
||
return card; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package dom.model.cardinplay; | ||
|
||
import org.dsrg.soenea.domain.MapperException; | ||
import org.dsrg.soenea.uow.MissingMappingException; | ||
import org.dsrg.soenea.uow.UoW; | ||
|
||
import dom.model.card.ICard; | ||
import dom.model.deck.IDeck; | ||
import dom.model.game.IGame; | ||
import dom.model.user.IUser; | ||
|
||
public class CardInPlayFactory { | ||
|
||
public static CardInPlay createNew(long id, long version, IGame game, IUser player, IDeck deck, ICard card, int status) | ||
throws MissingMappingException, MapperException { | ||
|
||
CardInPlay cardInPlay = new CardInPlay(id, version, game, player, deck, card, status); | ||
UoW.getCurrent().registerNew(cardInPlay); | ||
|
||
return cardInPlay; | ||
|
||
} | ||
|
||
public static CardInPlay createClean(long id, long version, IGame game, IUser player, IDeck deck, ICard card, int status) | ||
throws MissingMappingException, MapperException { | ||
|
||
CardInPlay cardInPlay = new CardInPlay(id, version, game, player, deck, card, status); | ||
UoW.getCurrent().registerClean(cardInPlay); | ||
|
||
return cardInPlay; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package dom.model.game; | ||
|
||
import org.dsrg.soenea.domain.MapperException; | ||
import org.dsrg.soenea.uow.MissingMappingException; | ||
import org.dsrg.soenea.uow.UoW; | ||
|
||
import dom.model.deck.IDeck; | ||
import dom.model.user.IUser; | ||
|
||
public class GameFactory { | ||
|
||
public static Game createNew(long id, long version, IUser challenger, IUser challengee, IDeck challengerDeck, IDeck challengeeDeck, int status) | ||
throws MissingMappingException, MapperException { | ||
|
||
Game game = new Game(id, version, challenger, challengee, challengerDeck, challengeeDeck, status); | ||
UoW.getCurrent().registerNew(game); | ||
|
||
return game; | ||
|
||
} | ||
|
||
public static Game createClean(long id, long version, IUser challenger, IUser challengee, IDeck challengerDeck, IDeck challengeeDeck, int status) { | ||
|
||
Game game = new Game(id, version, challenger, challengee, challengerDeck, challengeeDeck, status); | ||
UoW.getCurrent().registerClean(game); | ||
|
||
return game; | ||
|
||
} | ||
|
||
} |