Package com.google.livingstories.client

Examples of com.google.livingstories.client.ContentItemTypesBundle


    if (result != null) {
      return result;
    }

    result = Maps.newHashMap();
    ContentItemTypesBundle globalBundle = new ContentItemTypesBundle("");
    result.put(null, globalBundle);

    // put an entry in the map for each theme, too. Since some themes may have no content items,
    // we should do this up-front, not lazily.
    for (Theme theme : getThemesForLivingStory(livingStoryId)) {
      result.put(theme.getId(), new ContentItemTypesBundle(theme.getName()));
    }
   
    // In principle, we could try to track when we've found every content item type that we care
    // about, in every possible theme, terminating the loop early if our dance card is completely
    // filled, but it's such a micro-optimization at this point that it's not worthwhile.
    List<BaseContentItem> allContentItems =
        contentRpcService.getContentItemsForLivingStory(livingStoryId, true);
   
    for (BaseContentItem contentItem : allContentItems) {
      if (!addContentItemToTypesBundle(contentItem, globalBundle)) {
        continue;
      }
     
      for (Long themeId : contentItem.getThemeIds()) {
        ContentItemTypesBundle themeBundle = result.get(themeId);
        if (themeBundle == null) {
          logger.warning("contentItem " + contentItem.getId() + " refers to themeId " + themeId
              + ", but this theme does not appear to be in the story.");
        } else {
          addContentItemToTypesBundle(contentItem, themeBundle);
View Full Code Here


   * Answers queries on whether the theme the user might like to switch to can be filtered
   * according to the current type filter. If not, the caller should likely switch it back to the
   * "all" view.
   */
  private boolean filterAppliesToTheme(FilterSpec filterSpec, Long newThemeId) {
    ContentItemTypesBundle bundle = contentItemTypesBundles.get(newThemeId);
    if (bundle == null) {
      throw new IllegalArgumentException("filterAppliesToTheme given an unknown theme id argument");
    }
    return getTuplesForTypesBundle(bundle).contains(new TypeFilterTuple(
        "", filterSpec.contentItemType, filterSpec.assetType, filterSpec.opinion));
View Full Code Here

TOP

Related Classes of com.google.livingstories.client.ContentItemTypesBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.