io.takari.bpm.model.ProcessDefinitionHelper Maven / Gradle / Ivy
package io.takari.bpm.model;
import java.util.Collections;
import java.util.Map;
public final class ProcessDefinitionHelper {
public static String dump(ProcessDefinition pd) {
Map sms = Collections.emptyMap();
if (pd instanceof SourceAwareProcessDefinition) {
sms = ((SourceAwareProcessDefinition) pd).getSourceMaps();
}
StringBuilder b = new StringBuilder();
b.append("===================================\n").append("\tID: ").append(pd.getId()).append("\n");
dump(b, pd, sms, 2);
return b.toString();
}
private static StringBuilder pad(StringBuilder b, int level) {
for (int i = 0; i < level; i++) {
b.append("\t");
}
return b;
}
private static void dump(StringBuilder b, ProcessDefinition pd, Map sourceMaps, int level) {
for (AbstractElement e : pd.getChildren()) {
pad(b, level).append(e.getClass().getSimpleName()).append(" // ").append(e.getId()).append("\n");
SourceMap sm = sourceMaps.get(e.getId());
if (sm != null) {
pad(b, level + 1).append("source: ").append(sm).append("\n");
}
if (e instanceof ProcessDefinition) {
dump(b, (ProcessDefinition) e, sourceMaps, level + 1);
}
}
}
private ProcessDefinitionHelper() {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy