Ejemplo n.º 1
0
  /*
   * Gets a ContentSpec tuple for a specified id.
   */
  public RESTTranslatedTopicV1 getTranslatedContentSpecById(
      final int id, final Integer rev, final String locale) {
    if (locale == null) return null;
    final RESTTopicV1 cs = getTopicById(id, rev, true);
    if (cs == null) return null;

    final List<RESTTagV1> topicTypes =
        ComponentBaseTopicV1.returnTagsInCategoriesByID(
            cs, CollectionUtilities.toArrayList(CSConstants.TYPE_CATEGORY_ID));
    if (cs.getTranslatedTopics_OTM() != null && cs.getTranslatedTopics_OTM().getItems() != null) {
      for (final RESTTagV1 type : topicTypes) {
        if (type.getId().equals(CSConstants.CONTENT_SPEC_TAG_ID)) {
          for (final RESTTranslatedTopicV1 topic : cs.getTranslatedTopics_OTM().getItems()) {
            if (topic.getLocale().equals(locale)) return topic;
          }
        }
      }
    }
    return null;
  }
Ejemplo n.º 2
0
  /*
   * Gets a translated topic based on a topic id and locale
   */
  public RESTTranslatedTopicV1 getTranslatedTopicByTopicId(
      final Integer id, final Integer rev, final String locale) {
    if (locale == null) return null;
    final RESTTopicV1 topic = getTopicById(id, rev, true);
    if (topic == null) return null;

    for (final RESTTranslatedTopicV1 translatedTopic : topic.getTranslatedTopics_OTM().getItems()) {
      if (translatedTopic.getLocale().equals(locale)) return translatedTopic;
    }

    return null;
  }