use of org.nuxeo.ecm.core.api.PathRef in project nuxeo-filesystem-connectors by nuxeo.
the class SimpleBackend method resolveParent.
protected DocumentModel resolveParent(String location) {
DocumentModel doc = null;
doc = getPathCache().get(location.toString());
if (doc != null) {
return doc;
}
DocumentRef docRef = new PathRef(location.toString());
if (exists(docRef)) {
doc = getSession().getDocument(docRef);
} else {
Path locationPath = new Path(location);
String filename = locationPath.lastSegment();
Path parentLocation = locationPath.removeLastSegments(1);
// first try with spaces (for create New Folder)
String folderName = filename;
DocumentRef folderRef = new PathRef(parentLocation.append(folderName).toString());
if (exists(folderRef)) {
doc = getSession().getDocument(folderRef);
}
}
getPathCache().put(location.toString(), doc);
return doc;
}
Aggregations