List<ObjectParentData> result = null;
if (sop instanceof SingleFiling) {
ObjectData parent = getFolderParentIntern(repositoryId, (SingleFiling) sop, filter,
includeAllowableActions, includeRelationships, user, objectInfos);
if (null != parent) {
ObjectParentDataImpl parentData = new ObjectParentDataImpl();
parentData.setObject(parent);
String path = ((SingleFiling) sop).getPath();
int beginIndex = path.lastIndexOf(Filing.PATH_SEPARATOR) + 1;
// Note: if not found results in 0
String relPathSeg = path.substring(beginIndex, path.length());
parentData.setRelativePathSegment(relPathSeg);
result = Collections.singletonList((ObjectParentData) parentData);
} else {
result = Collections.emptyList();
}
} else if (sop instanceof MultiFiling) {
result = new ArrayList<ObjectParentData>();
MultiFiling multiParentObj = (MultiFiling) sop;
List<Folder> parents = multiParentObj.getParents(user);
if (null != parents) {
for (Folder parent : parents) {
ObjectParentDataImpl parentData = new ObjectParentDataImpl();
TypeDefinition typeDef = fStoreManager.getTypeById(repositoryId, parent.getTypeId()).getTypeDefinition();
ObjectData objData = PropertyCreationHelper.getObjectData(typeDef, parent, filter, user, includeAllowableActions,
includeRelationships, "", false, true, null);
parentData.setObject(objData);
parentData.setRelativePathSegment(multiParentObj.getPathSegment());
result.add(parentData);
if (objectInfos != null) {
ObjectInfoImpl objectInfo = new ObjectInfoImpl();
fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, parent, objectInfo);
objectInfos.addObjectInfo(objectInfo);