if (stage.getParentStage() != null && !stage.getParentStage().isPlanModel()) { parentStageInstance = createStageHierarchy(stage.getParentStage(), defaultParentPlanItemInstance, stagesToCreate, movingPlanItemInstanceIds, caseInstanceChangeState, movePlanItemInstanceEntityContainer, commandContext); caseInstanceChangeState.getCreatedStageInstances().put(stage.getParentStage().getId(), parentStageInstance);
isOrphan = false; } else { parentStage = parentStage.getParentStage();
stagesToCreate.put(stage.getId(), stage); stage = stage.getParentStage();