List<Category> categoryImages = new ArrayList<Category>();
LinkedHashMap<String, String> subCategories = new LinkedHashMap<String, String>();
int i = 0;
// loop through the results and split out images and sub-categories
while (i < categoryTopics.size()) {
Category category = categoryTopics.get(i);
if (category.getTopicType() == Topic.TYPE_IMAGE) {
categoryTopics.remove(i);
categoryImages.add(category);
continue;
}
if (category.getTopicType() == Topic.TYPE_CATEGORY) {
categoryTopics.remove(i);
String value = category.getChildTopicName().substring(
NamespaceHandler.NAMESPACE_CATEGORY.length() + NamespaceHandler.NAMESPACE_SEPARATOR.length());
subCategories.put(category.getChildTopicName(), value);
continue;
}
i++;
}
next.addObject("categoryTopics", categoryTopics);