WorkspaceCreateResponse_Type response)
throws ExecutionProblem {
final Workspace workspace = new Workspace();
// these things are not based on any information returned
try {
this.populateInitialRepr(workspace);
} catch (ParameterProblem e) {
throw new ExecutionProblem(
"unexpected problem: " + e.getMessage(), e);
}
// length/not-null already checked
final CreatedWorkspace_Type[] allrefs = response.getCreatedWorkspace();
final Schedule_Type xmlSchedule = allrefs[0].getSchedule();
if (xmlSchedule == null) {
throw new ExecutionProblem(
"(?) no schedule in factory response");
}
final VirtualNetwork_Type xmlNetwork = allrefs[0].getNetworking();
if (xmlNetwork != null) {
workspace.setCurrentNetworking(new Networking(xmlNetwork));
}
workspace.setEpr(allrefs[0].getEpr());
try {
workspace.setInitialSchedule(new Schedule(xmlSchedule));
// this is intentionally a separate object:
workspace.setCurrentSchedule(new Schedule(xmlSchedule));
} catch (InvalidDurationException e) {
throw new ExecutionProblem(
"(?) invalid data in factory response: " +
e.getMessage(), e);
}
final EndpointReferenceType ensembleEPR = response.getEnsembleEPR();
if (ensembleEPR != null) {
workspace.setEnsembleMemberEPR(ensembleEPR);
}
final EndpointReferenceType contextEPR = response.getContextEPR();
if (contextEPR != null) {
workspace.setContextMemberEPR(contextEPR);
}
return workspace;
}