req.setCreationType(1); // sub food web
req.setOriginFoodweb(propertiesConfig.getProperty("serengetiNetworkId")); // Serengeti
int nodeList[] = {Integer.valueOf(propertiesConfig.getProperty("defaultSpecies1Id")), Integer.valueOf(propertiesConfig.getProperty("defaultSpecies2Id"))}; // Grass & buffalo
req.setNodeList(nodeList);
CreateFoodwebResponse response = null;
try {
response = (CreateFoodwebResponse) svc.executeNetworkCreationRequest(req);
//TODO: Write web service call to database
} catch (RemoteException e) {
e.printStackTrace();
}
String errorMsg = response.getMessage();
if (errorMsg != null) {
System.err.println("Error type: " + response.getErrorType() + " error msg:" + errorMsg);
return null;
} else {
int timestepIdx = 0;
List<Integer> lPrey = new ArrayList<Integer>();
List<Integer> lPredator = new ArrayList<Integer>();
List<SpeciesZoneType> speciesList = new ArrayList<SpeciesZoneType>();
SpeciesZoneType szt1 = new SpeciesZoneType(propertiesConfig.getProperty("defaultSpecies1Name"), 5, Integer.valueOf(propertiesConfig.getProperty("defaultSpecies1SpeciesCount")), Double.valueOf(propertiesConfig.getProperty("defaultSpecies1PerSpeciesBiomass")), 0.0, SpeciesTypeEnum.PLANT);
SpeciesZoneType szt2 = new SpeciesZoneType(propertiesConfig.getProperty("defaultSpecies2Name"), 88, Integer.valueOf(propertiesConfig.getProperty("defaultSpecies2SpeciesCount")), Double.valueOf(propertiesConfig.getProperty("defaultSpecies2PerSpeciesBiomass")), 0.0, SpeciesTypeEnum.ANIMAL);
speciesList.add(szt1);
speciesList.add(szt2);
//Increasing carrying capacity of grass
ManipulationResponse mResponse = modifyManipulatingParameters(speciesList, timestepIdx , true, response.getNetworkId());
if(mResponse == null)
return null;
String manipulationId = mResponse.getManipulationId();
String oldNetworkId = mResponse.getNetworksId();