final List<Scriptable> items = new ArrayList<Scriptable>();
// Add all matching nodes to result
try {
NodeIterator it = node.getNodes(name);
while (it.hasNext()) {
items.add(ScriptRuntime.toObject(this, it.nextNode()));
}
} catch (RepositoryException e) {
log.debug("RepositoryException while collecting Node children",e);
}
// Add all matching properties to result
try {
PropertyIterator it = node.getProperties(name);
while (it.hasNext()) {
Property prop = it.nextProperty();
int type = prop.getType();
if (prop.getDefinition().isMultiple()) {
Value[] values = prop.getValues();
for (int i=0;i<values.length;i++) {
items.add(wrap(values[i]));