class PreparationUtils {

    private static void prettyPrint(PreparationRepository repository, String stepId, OutputStream out) {
        if (stepId == null) {
            return;
        }
        try {
            Step step = repository.get(stepId, Step.class);
            BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
            writer.append("\t\tStep (").append(step.id()).append(")").append("\n");
            writer.flush();
            PreparationActions blob = repository.get(step.getContent(), PreparationActions.class);
            prettyPrint(blob, out);
            if (step.getParent() != null) {
                prettyPrint(repository, step.getParent(), out);
            }
        } catch (IOException e) {
            throw new TalendRuntimeException(BaseErrorCodes.UNEXPECTED_EXCEPTION, e);
        }
    }

}