/* * Gets the Author Tag for a specific topic */ public RESTTagV1 getAuthorForTopic(final int topicId, final Integer rev) { if (rev == null) { final List<RESTTagV1> tags = this.getTagsByTopicId(topicId); if (tags != null) { for (RESTTagV1 tag : tags) { if (ComponentTagV1.containedInCategory(tag, CSConstants.WRITER_CATEGORY_ID)) return tag; } } } else { final RESTTopicV1 topic = this.getTopicById(topicId, rev); if (topic != null) { for (RESTTopicV1 topicRevision : topic.getRevisions().getItems()) { if (topicRevision.getRevision().equals(rev)) { List<RESTTagV1> writerTags = ComponentBaseTopicV1.returnTagsInCategoriesByID( topicRevision, CollectionUtilities.toArrayList(CSConstants.WRITER_CATEGORY_ID)); if (writerTags.size() == 1) return writerTags.get(0); break; } } } } return null; }
/* * Gets a List of all type tuples for a specified name. */ public RESTTagV1 getTypeByName(final String name) { final List<RESTTagV1> tags = getTagsByName(name); // Iterate through the list of tags and check if the tag is a Type and // matches the name. if (tags != null) { for (final RESTTagV1 tag : tags) { if (ComponentTagV1.containedInCategory(tag, CSConstants.TYPE_CATEGORY_ID) && tag.getName().equals(name)) { return tag; } } } return null; }