// repository exists
int skip = skipCount == null ? 0 : skipCount.intValue();
int max = maxItems == null ? -1 : maxItems.intValue();
TypeDefinitionListImpl result = new TypeDefinitionListImpl();
List<TypeDefinitionContainer> children;
if (typeId == null) {
// spec says that base types must be returned in this case
children = fStoreManager.getRootTypes(repositoryId, inclPropDefs);
} else {
children = getTypeDescendants(context, repositoryId, typeId, BigInteger.valueOf(1),
inclPropDefs, null);
}
result.setNumItems(BigInteger.valueOf(children.size()));
result.setHasMoreItems(children.size() > max - skip);
List<TypeDefinition> childrenTypes = new ArrayList<TypeDefinition>();
ListIterator<TypeDefinitionContainer> it = children.listIterator(skip);
if (max < 0) {
max = children.size();
}
for (int i = skip; i < max + skip && it.hasNext(); i++) {
childrenTypes.add(it.next().getTypeDefinition());
}
result.setList(childrenTypes);
return result;
}