diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java index 29c7c35681ef4a36dc62262906120f4c5b37af56..e205d562ac3cbe07426feb8a5b8f78682748995d 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Model/Map/Planet.java @@ -11,23 +11,38 @@ import java.io.Serializable; @Setter public class Planet implements Serializable { - /** Planet name */ - @DatabaseField(id = true,columnName = "name") + /** + * Planet name + */ + @DatabaseField(id = true, columnName = "name") @NonNull private String name; - /** Horizontale Position auf der Karte */ + /** + * Horizontale Position auf der Karte + */ @DatabaseField(columnName = "posX") @NonNull private float posX; - /** Vertikale Position auf der Karte */ + /** + * Vertikale Position auf der Karte + */ @DatabaseField(columnName = "posY") @NonNull private float posY; - /** Ereignis dass auf diesem Planeten eintrifft */ - @DatabaseField(columnName = "event",foreign = true) + /** + * Ereignis dass auf diesem Planeten eintrifft + */ + @DatabaseField(columnName = "event", foreign = true) @NonNull private PlanetEvent event; + + /** + * If already discovered set to true + */ + @DatabaseField(columnName = "discovered") + @NonNull + private boolean discovered = false; } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/CrewDAO.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/CrewDAO.java index 3fbf72ddf1089f5e935275521405609fdb2c0a41..50436249d2812f7d33c5bc0154d6486ae72c476b 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/CrewDAO.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/CrewDAO.java @@ -8,11 +8,15 @@ import com.j256.ormlite.support.ConnectionSource; public class CrewDAO extends ObjectDAO<Crew> { - /** Database connection */ + /** + * Database connection + */ private ConnectionSource source; - /** Crew dao */ - private Dao<Crew,String> crewDao; + /** + * Crew dao + */ + private Dao<Crew, String> crewDao; /** * Add a new crew member to the database @@ -25,6 +29,16 @@ public class CrewDAO extends ObjectDAO<Crew> { } + /** + * Update a crew member in the database + * + * @param c - the crew member to update in the database + * @throws CrewNotFoundException if the crew cannot be found in the database + */ + public void update(Crew c) throws CrewNotFoundException { + + } + /** * Remove an existing crew member from the database * @@ -36,7 +50,11 @@ public class CrewDAO extends ObjectDAO<Crew> { } - /** Constructor - * @param source - database connection source */ - public CrewDAO(ConnectionSource source){} + /** + * Constructor + * + * @param source - database connection source + */ + public CrewDAO(ConnectionSource source) { + } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/OverworldDAO.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/OverworldDAO.java index f51ecbb6edf7be0d6e440d110597741164dc34fd..d6eaf36f5a3148912b40a00ba190c7808bc035c5 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/OverworldDAO.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/OverworldDAO.java @@ -7,17 +7,23 @@ import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ObjectDAO; public class OverworldDAO extends ObjectDAO<Overworld> { - /** Add a new OverWorld to the database + /** + * Add a new OverWorld to the database + * * @param o - the overworld to add to the database - * @throws DuplicateOverworldException if the OverWorld already exists in the database */ + * @throws DuplicateOverworldException if the OverWorld already exists in the database + */ @Override public void persist(Overworld o) throws DuplicateOverworldException { } - /** Remove an existing OverWorld from the database + /** + * Remove an existing OverWorld from the database + * * @param o - the OverWorld to remove - * @throws OverworldNotFoundException if the OverWorld cannot be found in the database */ + * @throws OverworldNotFoundException if the OverWorld cannot be found in the database + */ @Override public void remove(Overworld o) throws OverworldNotFoundException { diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/PlanetDAO.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/PlanetDAO.java index 70cb01e55844e723ac3a10ad7dcfc30c8afd5ae2..5032ff5818137357a7daffbff32a2f246d8efb97 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/PlanetDAO.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/PlanetDAO.java @@ -17,6 +17,16 @@ public class PlanetDAO extends ObjectDAO<Planet> { } + /** + * Update an existing planet in the database + * + * @param p - the planet to update + * @throws PlanetNotFoundException if the planet cannot be found in the database + */ + public void update(Planet p) throws PlanetNotFoundException { + + } + /** * Remove an existing planet from the database * diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/ShipDAO.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/ShipDAO.java index fe8e0a61f18fa6a88043fc2f32c2253737973683..c52866f94cba392ea8b64606d0d18c40bdf1c211 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/ShipDAO.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/ShipDAO.java @@ -38,6 +38,13 @@ public class ShipDAO extends ObjectDAO<Ship> { } + /** Update a ship in the database + * @param s - the ship to update + * @throws ShipNotFoundException if the ship cannot be found in the database */ + public void update(Ship s) throws ShipNotFoundException{ + + } + /** * Get a ship from the database using its associated user * diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/SystemDAO.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/SystemDAO.java index 934b1be478d85d829f4e87dbf07f8b0e9d0b62b3..b24557c591befcffd2b1986c8601f895066c91c3 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/SystemDAO.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/SystemDAO.java @@ -6,17 +6,23 @@ import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.SystemNotFoundEx public class SystemDAO extends ObjectDAO<System> { - /** Add a new system to the database + /** + * Add a new system to the database + * * @param s - the system to add - * @throws DuplicateSystemException if the system already exists in the database */ + * @throws DuplicateSystemException if the system already exists in the database + */ @Override public void persist(System s) throws DuplicateSystemException { } - /** Remove an existing system from the database + /** + * Remove an existing system from the database + * * @param s - the system to remove - * @throws SystemNotFoundException if the system cannot be found in the database */ + * @throws SystemNotFoundException if the system cannot be found in the database + */ @Override public void remove(System s) throws SystemNotFoundException { diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/UserDAO.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/UserDAO.java index 98855d2db9dfd8e2d5c35ec167611585509f1801..1476317173a0f78b7e3cd2c23c32125fab894868 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/UserDAO.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Persistence/UserDAO.java @@ -37,6 +37,13 @@ public class UserDAO extends ObjectDAO<User> { } + /** Update a user in the database + * @param u - the user to update + * @throws UserNotFoundException if the user cannot be found in the database */ + public void update(User u) throws UserNotFoundException { + + } + /** * Get a user from the database using his username * diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/CrewService.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/CrewService.java new file mode 100644 index 0000000000000000000000000000000000000000..ed275923f4e6fe31cccdfe883fb13d02b92859b8 --- /dev/null +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/CrewService.java @@ -0,0 +1,41 @@ +package com.galaxytrucker.galaxytruckerreloaded.Server.Services; + +import com.galaxytrucker.galaxytruckerreloaded.Model.Crew.Crew; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.CrewNotFoundException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateCrewException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.CrewDAO; + +public class CrewService { + + /** + * DAO + */ + private CrewDAO crewDAO; + + /** + * Add a new crew member + * + * @param c - the crew member to add + * @throws DuplicateCrewException if the crew already exists + */ + public void addCrew(Crew c) throws DuplicateCrewException { + } + + /** + * Edit an existing crew member + * + * @param c - the crew member to edit + * @throws CrewNotFoundException if the crew cannot be found + */ + public void editCrew(Crew c) throws CrewNotFoundException { + } + + /** + * Remove an existing crew member + * + * @param c - the crew to remove + * @throws CrewNotFoundException if the crew cannot be found + */ + public void removeCrew(Crew c) throws CrewNotFoundException { + } +} diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/OverworldService.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/OverworldService.java new file mode 100644 index 0000000000000000000000000000000000000000..9145fba7609ea2607deb2fd76634d3ac8d9b4e38 --- /dev/null +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/OverworldService.java @@ -0,0 +1,32 @@ +package com.galaxytrucker.galaxytruckerreloaded.Server.Services; + +import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Overworld; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateOverworldException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.OverworldNotFoundException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.OverworldDAO; + +public class OverworldService { + + /** + * DAO + */ + private OverworldDAO overworldDAO; + + /** + * Add a new OverWorld + * + * @param o - the OverWorld to add + * @throws DuplicateOverworldException if the OverWorld already exists + */ + public void addOverworld(Overworld o) throws DuplicateOverworldException { + } + + /** + * Remove an existing OverWorld + * + * @param o - the OverWorld to remove + * @throws OverworldNotFoundException if the OverWorld cannot be found + */ + public void removeOverworld(Overworld o) throws OverworldNotFoundException { + } +} diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/PlanetService.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/PlanetService.java new file mode 100644 index 0000000000000000000000000000000000000000..e6082c6978c5a59091827c831b51cd2f15a8189f --- /dev/null +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/PlanetService.java @@ -0,0 +1,41 @@ +package com.galaxytrucker.galaxytruckerreloaded.Server.Services; + +import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Planet; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicatePlanetException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.PlanetNotFoundException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.PlanetDAO; + +public class PlanetService { + + /** + * Planet DAO + */ + private PlanetDAO planetDAO; + + /** + * Add a new planet + * + * @param p - the planet to add + * @throws DuplicatePlanetException if the planet already exists + */ + public void addPlanet(Planet p) throws DuplicatePlanetException { + } + + /** + * Edit an existing planet + * + * @param p - the planet to edit + * @throws PlanetNotFoundException if the planet cannot be found + */ + public void editPlanet(Planet p) throws PlanetNotFoundException { + } + + /** + * Remove an existing planet + * + * @param p - the planet to remove + * @throws PlanetNotFoundException if the planet cannot be found + */ + public void removePlanet(Planet p) throws PlanetNotFoundException { + } +} diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/ShipService.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/ShipService.java index 9fb830675c95f104329ee4a4a100ad7271fc4519..0b8cb8af6b5ad72831c7abc5cd89a21c4583e7c4 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/ShipService.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/ShipService.java @@ -2,6 +2,10 @@ package com.galaxytrucker.galaxytruckerreloaded.Server.Services; import com.galaxytrucker.galaxytruckerreloaded.Model.Ship; import com.galaxytrucker.galaxytruckerreloaded.Model.User; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateShipException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.ShipNotFoundException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.UserNotFoundException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ObjectDAO; import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.ShipDAO; import com.j256.ormlite.support.ConnectionSource; @@ -16,16 +20,27 @@ public class ShipService { * Add a new ship to the database * * @param s - the ship to add + * + * @throws DuplicateShipException if the ship already exists in the database */ - public void addShip(Ship s) { + public void persist(Ship s) throws DuplicateShipException { + } + + /** Update a ship in the database + * @param s - the ship to update \ + * @throws ShipNotFoundException if the ship cannot be found in the database */ + public void update(Ship s) throws ShipNotFoundException{ + } /** * Fetch a ship from the database using the user associated to it * * @param u - the user associated to the ship + * + * @throws UserNotFoundException if the user cannot be found in the database */ - public User getShipByUser(User u) { + public User getShipByUser(User u) throws UserNotFoundException { return null; } @@ -34,7 +49,7 @@ public class ShipService { * * @param s - the ship to remove from the database */ - public void removeShip(Ship s) { + public void remove(Ship s) throws ShipNotFoundException { } /** diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/SystemService.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/SystemService.java new file mode 100644 index 0000000000000000000000000000000000000000..b5784d98011032ccf46cc8dd80e66f5a688e6bd9 --- /dev/null +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/SystemService.java @@ -0,0 +1,32 @@ +package com.galaxytrucker.galaxytruckerreloaded.Server.Services; + +import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.System; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateSystemException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.SystemNotFoundException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.SystemDAO; + +public class SystemService { + + /** + * System dao + */ + private SystemDAO systemDAO; + + /** + * Add a new system + * + * @param s - the system to add + * @throws DuplicateSystemException if the system already exists + */ + public void addSystem(System s) throws DuplicateSystemException { + } + + /** + * Remove a system + * + * @param s - the system to remove + * @throws SystemNotFoundException if the system cannot be found + */ + public void removeSystem(System s) throws SystemNotFoundException { + } +} diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/UserService.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/UserService.java index 39ce5443d2ed1bde5673d78267bf40344e749454..7e7d70e12625d60d22265390bbc95214d1bf91fc 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/UserService.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/Server/Services/UserService.java @@ -1,6 +1,8 @@ package com.galaxytrucker.galaxytruckerreloaded.Server.Services; import com.galaxytrucker.galaxytruckerreloaded.Model.User; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateUserException; +import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.UserNotFoundException; import com.galaxytrucker.galaxytruckerreloaded.Server.Persistence.UserDAO; import com.j256.ormlite.support.ConnectionSource; @@ -14,35 +16,41 @@ public class UserService { /** * add a new user to the database * - * @param user - the user to add + * @param username - the username of the user to add + * + * @throws DuplicateUserException if the user already exists */ - public void addUser(User user) { + public void addUser(String username) throws DuplicateUserException { } /** * Fetch a user from the database * * @param username - the username of the user to fetch + * + * @throws UserNotFoundException if the user couldn't be found */ - public User getUser(String username) { + public User getUser(String username) throws UserNotFoundException { return null; } /** - * Remove a user from the database + * Update a user in the database * - * @param u - the user to remove + * @param u - the user to update + * @throws UserNotFoundException if the user cannot be found in the database */ - public void removeUser(User u) { - + public void updateUser(User u) throws UserNotFoundException { } /** * Remove a user using his username * * @param username - the username of the user to remove + * + * @throws UserNotFoundException if the user cannot be found */ - public void removeUserByUsername(String username) { + public void removeUserByUsername(String username) throws UserNotFoundException { } /** @@ -59,13 +67,17 @@ public class UserService { * * @param username - the username of the user */ - public void saveGame(String username) { + public void saveGame(String username) throws UserNotFoundException { } - /** Login + /** + * Login + * * @param username - the username of the user - * @return true - if the login was successful else return false */ - public boolean login(String username){ + * @return true - if the login was successful else return false + * + */ + public boolean login(String username) { return false; } }