if (link == null) {
throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
}
UrlBuilder url = new UrlBuilder(link);
url.addParameter(Constants.PARAM_ALL_VERSIONS, allVersions);
url.addParameter(Constants.PARAM_UNFILE_OBJECTS, unfileObjects);
url.addParameter(Constants.PARAM_CONTINUE_ON_FAILURE, continueOnFailure);
// make the call
HttpUtils.Response resp = HttpUtils.invokeDELETE(url, getSession());
// check response code
if (resp.getResponseCode() == 200 || resp.getResponseCode() == 202 || resp.getResponseCode() == 204) {
return new FailedToDeleteDataImpl();
}
// If the server returned an internal server error, get the remaining
// children of the folder. We only retrieve the first level, since
// getDescendants() is not supported by all repositories.
if (resp.getResponseCode() == 500) {
link = loadLink(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_CHILDREN);
if (link != null) {
url = new UrlBuilder(link);
// we only want the object ids
url.addParameter(Constants.PARAM_FILTER, "cmis:objectId");
url.addParameter(Constants.PARAM_ALLOWABLE_ACTIONS, false);
url.addParameter(Constants.PARAM_RELATIONSHIPS, IncludeRelationships.NONE);
url.addParameter(Constants.PARAM_RENDITION_FILTER, "cmis:none");
url.addParameter(Constants.PARAM_PATH_SEGMENT, false);
// 1000 children should be enough to indicate a problem
url.addParameter(Constants.PARAM_MAX_ITEMS, 1000);
url.addParameter(Constants.PARAM_SKIP_COUNT, 0);
// read and parse
resp = read(url);
AtomFeed feed = parse(resp.getStream(), AtomFeed.class);