} else {
final String id = request.getOptionalProperty(COLLECTION);
collection = context.getMappedObjectOrResult(id);
}
final RepeatMarker marker = request.createMarker();
final String variable = request.getOptionalProperty(ELEMENT_NAME);
final String scopeName = request.getOptionalProperty(SCOPE);
final Scope scope = RequestContext.scope(scopeName, Scope.REQUEST);
final String rowClassesList = request.getOptionalProperty(ROW_CLASSES, ODD_ROW_CLASS + "|" + EVEN_ROW_CLASS);
String[] rowClasses = new String[0];
if (rowClassesList != null) {
rowClasses = rowClassesList.split("[,|/]");
}
final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
if (facet.size(collection) == 0) {
request.skipUntilClose();
} else {
final Iterator<ObjectAdapter> iterator = facet.iterator(collection);
int row = 0;
while (iterator.hasNext()) {
final ObjectAdapter element = iterator.next();
context.addVariable("row", "" + (row + 1), Scope.REQUEST);
if (rowClassesList != null) {
context.addVariable("row-class", rowClasses[row % rowClasses.length], Scope.REQUEST);
}
context.addVariable(variable, context.mapObject(element, scope), scope);
marker.repeat();
request.processUtilCloseTag();
row++;
}
}
}