workspace.setRequestedNetworking(new Networking(net));
}
final ResourceAllocation_Type ra = this.req.getResourceAllocation();
if (ra == null) {
throw new ParameterProblem("(?) no ResourceAllocation_Type");
}
workspace.setRequestedResourceAllocation(new ResourceAllocation(ra));
// this is intentionally a separate object:
workspace.setCurrentResourceAllocation(new ResourceAllocation(ra));
boolean trash = false;
if (this.req.getShutdownMechanism() != null
&& this.req.getShutdownMechanism().equals(
ShutdownMechanism_Type.Trash)) {
trash = true;
}
final ShutdownMech mech = new ShutdownMech(trash);
workspace.setRequestedShutdownMech(mech);
if (this.req.getInitialState() == null) {
workspace.setRequestedInitialState(State.DEFAULT_INITIAL_STATE);
} else {
final State initialState =
State.fromInitialState_Type(this.req.getInitialState());
workspace.setRequestedInitialState(initialState);
}
// this might be incorrect information already, but it is the initial
// state of all workspaces
workspace.setCurrentState(new State(State.STATE_Unstaged));
try {
final DeploymentTime_Type time = this.req.getDeploymentTime();
final int seconds =
CommonUtil.durationToSeconds(time.getMinDuration());
final Schedule schedule = new Schedule();
schedule.setDurationSeconds(seconds);
workspace.setRequestedSchedule(schedule);
} catch (NullPointerException e) {
throw new ParameterProblem(e.getMessage(), e);
} catch (InvalidDurationException e) {
throw new ParameterProblem(e.getMessage(), e);
}
}