List<ClusterTreeQueryResults> directChildren = data.get(parentId);
if (directChildren != null) {
for (ClusterTreeQueryResults child : directChildren) {
ClusterKeyFlyweight childNodeKey = new ClusterKeyFlyweight(child.resourceTypeId, child.resourceKey);
ClusterFlyweight childNode = children.get(childNodeKey);
Set<Integer> memberList;
if (childNode == null) {
childNode = new ClusterFlyweight(childNodeKey);
childNode.setClusterSize(maxChildrenExpected);
children.put(childNodeKey, childNode);
memberList = new HashSet<Integer>();
members.put(childNodeKey, memberList);
} else {
memberList = members.get(childNodeKey);
}
childNode.addResource(child.resourceName);
childNode.incrementMembers();
memberList.add(child.resourceId);
}
}
}