コード例 #1
0
  public static ContentTree createDocFolderTree(
      ApplicationManager appManager, Application app, String dataSourceUid, long flags)
      throws ParserConfigurationException, SAXException, IOException, ParseException {
    ContentTree tree = new ContentTree();
    tree.id = "1";
    DataSourceBase dataSource = app.getDataSource(dataSourceUid);

    DataSourceCache dsc = ServerCache.getDSC(appManager, app, dataSource);
    ArrayList<CContent> calendars = dsc.getByType(ECMContentSourceType.GoogleDocumentFolder);
    if (calendars != null) {
      // addTreeItemsByParent(CList albums,ArrayList<CListItem>photos,ContentTree
      // tree,DataSourceBase dataSource)
      // addTreeItemsByParentCalendars(ArrayList<CContent>calendars,ContentTree tree,DataSourceBase
      // dataSource)
      GoogleTreeFactory.addTreeItemsByParentDocFolders(calendars, tree, dataSource);
    }

    return tree;
  }
コード例 #2
0
  public static ContentTree createAlbumTree(
      ApplicationManager appManager, Application app, String dataSourceUid, long flags)
      throws ParserConfigurationException, SAXException, IOException, ParseException {
    ContentTree tree = new ContentTree();
    tree.id = "1";
    DataSourceBase dataSource = app.getDataSource(dataSourceUid);

    DataSourceCache dsc = ServerCache.getDSC(appManager, app, dataSource);
    ArrayList<CList> albums = dsc.getByType(ECMContentSourceType.GooglePicassaAlbum);
    ArrayList<CListItem> entries = dsc.getByType(ECMContentSourceType.GooglePicassaItem);
    if (albums != null && entries != null) {
      CList cAlbums = albums.get(0);
      if (cAlbums != null) {
        // addTreeItemsByParent(CList albums,ArrayList<CListItem>photos,ContentTree
        // tree,DataSourceBase dataSource)

        GoogleTreeFactory.addTreeItemsByParent(cAlbums, entries, tree, dataSource);
      }
    }

    return tree;
  }
コード例 #3
0
  public static ContentTree createDataSourceTree(
      ApplicationManager appManager, Application app, long flags)
      throws ParserConfigurationException, SAXException, IOException, ParseException {
    ContentTree tree = new ContentTree();
    tree.id = "1";
    ArrayList<ContentTreeItem> result = new ArrayList<ContentTreeItem>();
    tree.setItems(result);

    ArrayList<DataSourceBase> datasources = app.getDataSources();

    ContentTreeItem rootItem = new ContentTreeItem();
    rootItem.name = "Data Sources";
    rootItem.label = "Data Sources";
    rootItem.id = "9898989";
    rootItem.children = new ArrayList<Reference>();
    // result.add(rootItem);
    tree.items.add(rootItem);
    rootItem.type = "top";
    rootItem.contentType =
        "" + ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.Unknown);

    for (int i = 0; i < datasources.size(); i++) {
      DataSourceBase ds = datasources.get(i);
      String dsType = ds.getType();
      Boolean isValid =
          dsType.equals("Youtube")
              || dsType.equals("Picassa")
              || dsType.equals("Calendar")
              || dsType.equals("Documents");
      if (!isValid) continue;

      ContentTreeItem item = new ContentTreeItem();
      item.name = GoogleTreeFactory.getDataSourceLabel(ds);
      item.id = "" + ds.getUid();
      item.dataSourceUID = ds.uid;
      item.contentType =
          "" + ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.DataSourceItem);
      /*
      item.children = new ArrayList<Reference>();
      Reference ref0 = new Reference();
      ref0._reference="" + "asdasd";
      item.addChild(ref0);
      */
      Reference ref = new Reference();
      ref._reference = "" + item.id;
      rootItem.addChild(ref);
      result.add(item);
      item.type = ds.getType();

      if (dsType.equals("Picassa")
          && BitUtils.hasFlag(
              flags,
              ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.GooglePicassaAlbum))) {
        ArrayList<ContentTreeItem> albumItems =
            GoogleTreeFactory.addAlbums(appManager, app, ds, item, tree, flags);
        if (albumItems != null) {
          tree.items.addAll(albumItems);
        }
      }

      if (dsType.equals("Calendar")
          && BitUtils.hasFlag(
              flags,
              ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.GoogleCalendar))) {
        ArrayList<ContentTreeItem> albumItems =
            GoogleTreeFactory.addCalendars(appManager, app, ds, item, tree, flags);
        if (albumItems != null) {
          tree.items.addAll(albumItems);
        }
      }

      Boolean docs =
          BitUtils.hasFlag(
              flags,
              ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.GoogleDocumentFolder));
      if (dsType.equals("Documents")
          && BitUtils.hasFlag(
              flags,
              ECMContentSourceTypeTools.TypeToInteger(ECMContentSourceType.GoogleDocumentFolder))) {
        ArrayList<ContentTreeItem> albumItems =
            GoogleTreeFactory.addDocFolders(appManager, app, ds, item, tree, flags);
        if (albumItems != null) {
          tree.items.addAll(albumItems);
        }
      }
    }
    // tree.setItems(result);

    return tree;
  }