* @throws JspException not thrown
*/
public int doStartTag()
throws JspException {
NodeBean node = StrutsTagUtils.findNode(this, pageContext);
if (node == null) {
throw new JspException("The 'iterateMembers' tag must be nested " +
"inside a 'node' tag or an iteration over nodes.");
}
int depthValue = 1;
if (depth != null) {
try {
depthValue = Integer.parseInt(depth);
} catch (NumberFormatException e) {
if (depth.equalsIgnoreCase("infinity")) {
depthValue = Integer.MAX_VALUE;
}
else {
throw new JspException("The attribute 'depth' of the " +
"'iterateMembers' tag must contain an integer value.");
}
}
}
Vector members = node.getMembers(depthValue);
// evaluate the includes/excludes, which can be comma separated lists
Vector includeRolesVector = tokenizeString(includeRoles);
Vector excludeRolesVector = tokenizeString(excludeRoles);
Vector includeTypesVector = tokenizeString(includeTypes);
Vector excludeTypesVector = tokenizeString(excludeTypes);
Iterator i = members.iterator();
membersIteration: while (i.hasNext()) {
NodeBean member = (NodeBean)i.next();
String nodeType = member.getType();
if (excludeTypesVector.contains(nodeType) ||
(!includeTypesVector.isEmpty() &&
!includeTypesVector.contains(nodeType))) {
i.remove();
continue membersIteration;
}
Vector nodeRoles = member.getRoles();
for (int j = 0; j < nodeRoles.size(); j++) {
String nodeRole = (String)nodeRoles.elementAt(j);
if (excludeRolesVector.contains(nodeRole)) {
i.remove();
continue membersIteration;