String orderBy, Boolean includeAllowableActions, IncludeRelationships includeRelationships,
String renditionFilter, BigInteger maxItems, BigInteger skipCount, ExtensionsData extension,
ObjectInfoHandler objectInfos) {
validator.getCheckedOutDocs(context, repositoryId, folderId, extension);
ObjectListImpl res = new ObjectListImpl();
List<ObjectData> odList = new ArrayList<ObjectData>();
LOG.debug("start getCheckedOutDocs()");
String user = context.getUsername();
if (null == folderId) {
List<StoredObject> checkedOuts = fStoreManager.getObjectStore(repositoryId).getCheckedOutDocuments(
orderBy, context.getUsername(), includeRelationships);
for (StoredObject checkedOut : checkedOuts) {
TypeDefinition td = fStoreManager.getTypeById(repositoryId, checkedOut.getTypeId()).getTypeDefinition();
// DocumentVersion workingCopy = ((VersionedDocument) checkedOut).getPwc();
// if (null == workingCopy)
// throw new CmisConstraintException("document " + checkedOut + " is checked out but has no working copy");
ObjectData od = PropertyCreationHelper.getObjectData(td, checkedOut, filter, user,
includeAllowableActions, includeRelationships, renditionFilter, false, false, extension);
if (context.isObjectInfoRequired()) {
ObjectInfoImpl objectInfo = new ObjectInfoImpl();
fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, /* workingCopy */ checkedOut, objectInfo);
objectInfos.addObjectInfo(objectInfo);
}
odList.add(od);
}
} else {
LOG.debug("getting checked-out documents for folder: " + folderId);
ObjectInFolderList children = getChildrenIntern(repositoryId, folderId, filter, orderBy,
includeAllowableActions, includeRelationships, renditionFilter, false, -1, -1, false, context
.isObjectInfoRequired() ? objectInfos : null, user);
for (ObjectInFolderData child : children.getObjects()) {
ObjectData obj = child.getObject();
StoredObject so = fStoreManager.getObjectStore(repositoryId).getObjectById(obj.getId());
LOG.debug("Checked out: children:" + obj.getId());
if (so instanceof DocumentVersion && ((DocumentVersion) so).getParentDocument().isCheckedOut()) {
odList.add(obj);
if (context.isObjectInfoRequired()) {
ObjectInfoImpl objectInfo = new ObjectInfoImpl();
fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfo);
objectInfos.addObjectInfo(objectInfo);
}
}
}
}
res.setObjects(odList);
res.setNumItems(BigInteger.valueOf(odList.size()));
LOG.debug("end getCheckedOutDocs()");
return res;
}