Пример #1
0
 public Map<String, List<T9Node>> getSiblings(String t9id) {
   Map<String, List<T9Node>> result = new TreeMap<String, List<T9Node>>();
   T9Tree tree = data.getObject();
   List<T9Node> children = tree.getSiblings(t9id);
   if (children != null) {
     for (T9Node child : children) {
       String language = child.getLang();
       result.put(language, tree.getPath(child.getId()));
     }
   }
   return result;
 }
Пример #2
0
 public JSONObject getSiblingsAsJSON(String t9id) throws JSONException {
   Map<String, List<T9Node>> siblings = getSiblings(t9id);
   JSONObject asJson = new JSONObject();
   for (Map.Entry<String, List<T9Node>> entry : siblings.entrySet()) {
     JSONArray path = new JSONArray();
     for (T9Node node : entry.getValue()) {
       JSONObject properties = new JSONObject();
       ExtPropertyConverter.addProperties(node, node.getClass(), properties);
       path.put(properties);
     }
     asJson.put(entry.getKey(), path);
   }
   return asJson;
 }