public static ArrayList<ContentTreeItem> addCalendars( ApplicationManager appManager, Application app, DataSourceBase dataSource, ContentTreeItem dataSourceItem, ContentTree destinationTree, long flags) { if (dataSource == null) { return null; } ContentTree tree = null; try { tree = GoogleTreeFactory.createCalendarTree(appManager, app, dataSource.uid, flags); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } if (tree == null) { return null; } /// add it to items : ContentTreeItem rootItem = new ContentTreeItem(); rootItem.name = "Calendars"; String uuid = UUID.randomUUID().toString(); rootItem.id = uuid; // rootItem.id = "55e969d6-c588-4268-a8b7-45240999d1cc"; rootItem.children = new ArrayList<Reference>(); destinationTree.items.add(rootItem); rootItem.type = "leaf"; rootItem.contentType = "" + ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.Unknown); Reference articleRef = new Reference(); articleRef._reference = "" + rootItem.id; dataSourceItem.addChild(articleRef); for (int i = 0; i < tree.items.size(); i++) { ContentTreeItem item = tree.items.get(i); if (item.contentType != null && item.contentType.equals( "" + ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.GoogleCalendar))) { Reference ref = new Reference(); ref._reference = "" + item.id; rootItem.addChild(ref); item.type = "leaf"; item.contentType = "" + ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.GoogleCalendar); } } return tree.items; }