Skip to content
Snippets Groups Projects
Commit 999a1a80 authored by Leonard Haddad's avatar Leonard Haddad :rocket:
Browse files

Merge branch 'model' into 'master'

added inventory

See merge request reswp-2020/galaxytrucker!23
parents 363bd33d cbf0a227
No related branches found
No related tags found
No related merge requests found
Showing
with 145 additions and 5 deletions
......@@ -27,7 +27,7 @@ public class Planet implements Serializable {
private float posY;
/** Ereignis dass auf diesem Planeten eintrifft */
@DatabaseField(columnName = "event")
@DatabaseField(columnName = "event",foreign = true)
@NonNull
private PlanetEvent event;
}
......@@ -110,6 +110,11 @@ public class Ship implements Serializable {
@DatabaseField(foreign = true,columnName = "crew")
private List<Crew> crew;
/** Inventory */
@NonNull
@DatabaseField(foreign = true, columnName = "inventory")
private List<Weapon> inventory;
/**
* Take damage
*/
......
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class CrewNotFoundException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class DuplicateCrewException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class DuplicateOverworldException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class DuplicatePlanetException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class DuplicateSystemException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class OverworldNotFoundException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class PlanetNotFoundException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Exception;
public class SystemNotFoundException extends Exception {
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Persistence;
import com.galaxytrucker.galaxytruckerreloaded.Model.Crew.Crew;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.CrewNotFoundException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateCrewException;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.support.ConnectionSource;
public class CrewDAO extends ObjectDAO<Crew> {
/** Add a new crew member to the database
* */
/** Database connection */
private ConnectionSource source;
/** Crew dao */
private Dao<Crew,String> crewDao;
/**
* Add a new crew member to the database
*
* @param c - the crew to persist
* @throws DuplicateCrewException if the crew member already exists in the database
*/
@Override
public void persist(Crew o) throws Exception {
public void persist(Crew c) throws DuplicateCrewException {
}
/**
* Remove an existing crew member from the database
*
* @param c - the crew member to remove
* @throws CrewNotFoundException if the crew member couldn't be found in the database
*/
@Override
public void remove(Crew o) throws Exception {
public void remove(Crew c) throws CrewNotFoundException {
}
/** Constructor
* @param source - database connection source */
public CrewDAO(ConnectionSource source){}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Persistence;
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.ObjectDAO;
public class OverworldDAO extends ObjectDAO<Overworld> {
/** 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 */
@Override
public void persist(Overworld o) throws DuplicateOverworldException {
}
/** Remove an existing OverWorld from the database
* @param o - the OverWorld to remove
* @throws OverworldNotFoundException if the OverWorld cannot be found in the database */
@Override
public void remove(Overworld o) throws OverworldNotFoundException {
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Persistence;
import com.galaxytrucker.galaxytruckerreloaded.Model.Map.Planet;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicatePlanetException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.PlanetNotFoundException;
public class PlanetDAO extends ObjectDAO<Planet> {
/**
* Add a new planet to the database
*
* @param p - the planet to add
* @throws DuplicatePlanetException if the planet already exists in the database
*/
@Override
public void persist(Planet p) throws DuplicatePlanetException {
}
/**
* Remove an existing planet from the database
*
* @param p - the planet to remove
* @throws PlanetNotFoundException if the planet cannot be found in the database
*/
@Override
public void remove(Planet p) throws PlanetNotFoundException {
}
}
package com.galaxytrucker.galaxytruckerreloaded.Server.Persistence;
import com.galaxytrucker.galaxytruckerreloaded.Model.ShipLayout.System;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.DuplicateSystemException;
import com.galaxytrucker.galaxytruckerreloaded.Server.Exception.SystemNotFoundException;
public class SystemDAO extends ObjectDAO<System> {
/** Add a new system to the database
* @param s - the system to add
* @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
* @param s - the system to remove
* @throws SystemNotFoundException if the system cannot be found in the database */
@Override
public void remove(System s) throws SystemNotFoundException {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment