Sicherheitsänderung wegen falschen Zugriffsrechten

main
CedricNew 2023-01-07 16:34:36 +01:00
parent 21ea8aff1d
commit 24380733bf
2 changed files with 14 additions and 12 deletions

View File

@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.HashMap;
public class Factory implements Serializable {
private HashMap<Integer, Robot> robots = new HashMap<>();
private int c3poID = 0;
private int r2d2ID = 10000;
@ -14,10 +15,19 @@ public class Factory implements Serializable {
}
//Has to return Collection<Robot>
public Collection<Robot> getRobotList(){
public Collection<Robot> robotListToCollection(){
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){
Robot r ;
if(type == 0){

View File

@ -1,9 +1,7 @@
package facade;
import java.io.FileNotFoundException;
import java.util.Collection;
import java.util.HashMap;
import domain.*;
import domain.Factory;
import domain.Robot;
import infrastructure.Persistenz;
public class FactorySystem {
@ -28,13 +26,7 @@ public class FactorySystem {
}
public String[] getAllRobots(){
Collection<Robot> robots = factory.getRobotList();
String[] list = new String[robots.size()];
int i = 0;
for(Robot r: robots){
list[i++] = r.toString();
}
return list;
return factory.getRobotList();
}
public boolean buildNewRobot(String name, int type){