return getTypeDefinitionInternal(repositoryId, typeId);
}
public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
TypeDefinitionListImpl result = new TypeDefinitionListImpl();
// find the link
String link = null;
if (typeId == null) {
link = loadCollection(repositoryId, Constants.COLLECTION_TYPES);
} else {
link = loadTypeLink(repositoryId, typeId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
}
if (link == null) {
throw new CmisObjectNotFoundException("Unknown repository or type!");
}
UrlBuilder url = new UrlBuilder(link);
url.addParameter(Constants.PARAM_TYPE_ID, typeId);
url.addParameter(Constants.PARAM_PROPERTY_DEFINITIONS, includePropertyDefinitions);
url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
url.addParameter(Constants.PARAM_SKIP_COUNT, skipCount);
// read and parse
HttpUtils.Response resp = read(url);
AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
// handle top level
for (AtomElement element : feed.getElements()) {
if (element.getObject() instanceof AtomLink) {
if (isNextLink(element)) {
result.setHasMoreItems(Boolean.TRUE);
}
} else if (isInt(NAME_NUM_ITEMS, element)) {
result.setNumItems((BigInteger) element.getObject());
}
}
result.setList(new ArrayList<TypeDefinition>(feed.getEntries().size()));
// get the children
if (!feed.getEntries().isEmpty()) {
for (AtomEntry entry : feed.getEntries()) {
TypeDefinition child = null;
lockTypeLinks();
try {
// walk through the entry
for (AtomElement element : entry.getElements()) {
if (element.getObject() instanceof AtomLink) {
addTypeLink(repositoryId, entry.getId(), (AtomLink) element.getObject());
} else if (element.getObject() instanceof CmisTypeDefinitionType) {
child = convert((CmisTypeDefinitionType) element.getObject());
}
}
} finally {
unlockTypeLinks();
}
if (child != null) {
result.getList().add(child);
}
}
}
return result;