ActionType actionType = null;
boolean completed = true;
boolean failed = false;
for (Iterator iter = progressObjects.iterator(); iter.hasNext();) {
ProgressObject progress = (ProgressObject) iter.next();
DeploymentStatus status = progress.getDeploymentStatus();
CommandType curCommandType = status.getCommand();
ActionType curActionType = status.getAction();
if ( null == commandType ) {
commandType = curCommandType;
actionType = curActionType;
} else if ( commandType != curCommandType ) {
throw new AssertionError("Heterogeneous CommandType");
} else if ( actionType != curActionType ) {
throw new AssertionError("Heterogeneous ActionType");
}
message.append(status.getMessage() + "\n");
if ( StateType.FAILED == status.getState() ) {
failed = true;
} else if ( StateType.COMPLETED != status.getState() ) {
completed = false;
}
commandType = status.getCommand();
actionType = status.getAction();
}
if ( failed ) {
return new DeploymentStatusImpl(commandType, actionType,
StateType.FAILED, message.toString());
} else if ( completed ) {