protected static String dumpTreeToJSON(Tree tree, WidgetItemInStep rootItem, Object assignee,
Object candidateGroups, Object swimlane, String stepName,
Object description, Object commentary,
Collection<Permission> permissions) {
I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
TaskConfig tc = new TaskConfig();
tc.setTaskName(stepName);
Map<String, Object> treeMap = collectNode(tree, rootItem, 1);
if (assignee != null) {
treeMap.put(ASSIGNEE, assignee);
}
if (candidateGroups != null) {
treeMap.put(CANDIDATE_GROUPS, candidateGroups);
}
if (swimlane != null) {
treeMap.put(SWIMLANE, swimlane);
}
if (permissions != null) {
treeMap.put(STEP_PERMISSIONS, permissions);
}
if (description != null) {
treeMap.put(DESCRIPTION,description);
}
if (commentary != null) {
treeMap.put(COMMENTARY, encodeString(commentary));
}
tc.setParams(treeMap);
try {
return mapper.writeValueAsString(tc);
} catch (JsonGenerationException e) {
logger.log(Level.SEVERE, "Error dumping tree", e);