Sicherheitsänderung wegen falschen Zugriffsrechten
parent
21ea8aff1d
commit
24380733bf
|
@ -5,6 +5,7 @@ import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class Factory implements Serializable {
|
public class Factory implements Serializable {
|
||||||
|
|
||||||
private HashMap<Integer, Robot> robots = new HashMap<>();
|
private HashMap<Integer, Robot> robots = new HashMap<>();
|
||||||
private int c3poID = 0;
|
private int c3poID = 0;
|
||||||
private int r2d2ID = 10000;
|
private int r2d2ID = 10000;
|
||||||
|
@ -14,10 +15,19 @@ public class Factory implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Has to return Collection<Robot>
|
//Has to return Collection<Robot>
|
||||||
public Collection<Robot> getRobotList(){
|
public Collection<Robot> robotListToCollection(){
|
||||||
return robots.values();
|
return robots.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String[] getRobotList() {
|
||||||
|
Collection<Robot> collect = robotListToCollection();
|
||||||
|
String[] list = new String[collect.size()];
|
||||||
|
int i = 0;
|
||||||
|
for(Robot r: collect){
|
||||||
|
list[i++] = r.toString();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
public boolean buildNewRobot(String name, int type){
|
public boolean buildNewRobot(String name, int type){
|
||||||
Robot r ;
|
Robot r ;
|
||||||
if(type == 0){
|
if(type == 0){
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package facade;
|
package facade;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import domain.Factory;
|
||||||
import java.util.Collection;
|
import domain.Robot;
|
||||||
import java.util.HashMap;
|
|
||||||
import domain.*;
|
|
||||||
import infrastructure.Persistenz;
|
import infrastructure.Persistenz;
|
||||||
|
|
||||||
public class FactorySystem {
|
public class FactorySystem {
|
||||||
|
@ -28,13 +26,7 @@ public class FactorySystem {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getAllRobots(){
|
public String[] getAllRobots(){
|
||||||
Collection<Robot> robots = factory.getRobotList();
|
return factory.getRobotList();
|
||||||
String[] list = new String[robots.size()];
|
|
||||||
int i = 0;
|
|
||||||
for(Robot r: robots){
|
|
||||||
list[i++] = r.toString();
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean buildNewRobot(String name, int type){
|
public boolean buildNewRobot(String name, int type){
|
||||||
|
|
Loading…
Reference in New Issue