Details
-
Improvement
-
Resolution: Fixed
-
Major
-
1.1
-
None
-
-
Yes
-
Empty show more show less
Description
Index: src/main/java/info/magnolia/module/categorization/util/CategoryUtil.java
===================================================================
--- src/main/java/info/magnolia/module/categorization/util/CategoryUtil.java (revision 31605)
+++ src/main/java/info/magnolia/module/categorization/util/CategoryUtil.java (working copy)
@@ -96,7 +96,7 @@
public static Collection getRelatedCategories(String name) {
List relatedNodes = new ArrayList();
try {
- Content categoryNode = getCategoryNodeByName(name);
+ final Content categoryNode = getCategoryNodeByName(name);
if(categoryNode.hasContent("relatedUUID")) {
Collection uuids = categoryNode.getChildByName("relatedUUID").getChildren();
Iterator uuidsIt = uuids.iterator();
@@ -110,6 +110,23 @@
}
}
}
+ //Check if has sub categories
+ if (categoryNode.hasChildren()) {
+ relatedNodes.addAll(categoryNode.getChildren());
+ }
+ // check if has siblings
+ if(categoryNode.getLevel() > 2) {
+ Content parent = categoryNode.getParent();
+ relatedNodes.add(parent);
+ Iterator childrenIt = parent.getChildren().iterator();
+
+ while(childrenIt.hasNext()) {
+ Content item = (Content)childrenIt.next();
+ if(!categoryNode.getUUID().equals(item.getUUID())) {
+ relatedNodes.add(item);
+ }
+ }
+ }
} catch (RepositoryException e) {
log.warn("cant get category " + name, e);
}
Checklists
Acceptance criteria