public List<Terran> getTerran() { List<Terran> allTerranArmies = new ArrayList<>(); Iterable<Terran> values = repository.findAll(); for (Terran terran : values) allTerranArmies.add(terran); return allTerranArmies; }
public List<Terran> getSingleTerran(String email) { List<Terran> allTerranArmies = new ArrayList<>(); Iterable<Terran> values = repository.findAll(); for (Terran terran : values) { String user = terran.getUser(); if (user.equals(email)) { allTerranArmies.add(terran); } } return allTerranArmies; }
public void createArmy( List<String> army, String raceSel, String armyname, String email, String pop) { RaceSelector race = new RaceSelector(); Race terran = race.getRace(raceSel); for (int i = 0; i < army.size(); i++) { Unit unit = terran.addUnit(army.get(i)); } terran.setArmyName(armyname); terran.setUser(email); terran.setArmyPop(Integer.parseInt(pop)); repository.save((Terran) terran); }
public Terran findById(long id) { Terran terran; terran = repository.findOne(id); return terran; }
public void delete(Terran terran) { repository.delete(terran); }