code: protected void populateDatabaseTopics(final BuildData buildData,
              final Map<String, BaseTopicWrapper<?>> topics) throws BuildProcessingException {
          final List<TopicWrapper> allTopics = new ArrayList<TopicWrapper>();
          final List<TopicWrapper> latestTopics = new ArrayList<TopicWrapper>();
          final List<TopicWrapper> revisionTopics = new ArrayList<TopicWrapper>();
  
          // Calculate the ids of all the topics to get
          final List<ITopicNode> topicNodes = buildData.getContentSpec().getAllTopicNodes();
          for (final ITopicNode topicNode : topicNodes) {
              // Determine which topics we need to fetch the latest topics for and which topics we need to fetch revisions for.
              final TopicWrapper topic;
              if (topicNode.getRevision() != null && !buildData.getBuildOptions().getUseLatestVersions()) {
                  topic = topicProvider.getTopic(topicNode.getDBId(), topicNode.getRevision());
                  revisionTopics.add(topic);
                  allTopics.add(topic);
              } else if (buildData.getBuildOptions().getMaxRevision() != null && !buildData.getBuildOptions().getUseLatestVersions()) {
                  topic = topicProvider.getTopic(topicNode.getDBId(), buildData.getBuildOptions().getMaxRevision());
                  revisionTopics.add(topic);
                  allTopics.add(topic);
              } else {
                  topic = topicProvider.getTopic(topicNode.getDBId());
                  latestTopics.add(topic);
                  allTopics.add(topic);
              }
  
              // Add the topic to the topics collection
              final String key = DocBookBuildUtilities.getTopicBuildKey(topic);
              topics.put(key, topic);
              buildData.getBuildDatabase().add(topicNode, key);
          }
      }
docs: TODO
  
  @param buildData Information and data structures for the build.
  @param topics
  @return