@Override public boolean transform(ExportedDocument doc) { doc.setPath(doc.getPath().removeFirstSegments(1)); return true; } };
public TreeItem find(Path path) { if (root == null) { return null; } Path rootPath = root.getPath(); int p = path.matchingFirstSegments(rootPath); if (p == rootPath.segmentCount()) { return root.find(path.removeFirstSegments(p)); } return null; }
@Override public Backend getBackend(String uri) { Path path = new Path(uri); if (path.segmentCount() == 0) { return this; } else { String key = path.segment(0); initIfNeed(); if (backendMap == null) { return null; } Backend backend = backendMap.get(key); if (backend == null) { return null; } String location = path.removeFirstSegments(1).toString(); return backend.getBackend(location); } }
@Override public ExportedDocument read() throws IOException { if (iterator.hasNext()) { DocumentModel docModel = iterator.next(); if (pathSegmentsToRemove > 0) { // remove unwanted leading segments return new ExportedDocumentImpl(docModel, docModel.getPath().removeFirstSegments(pathSegmentsToRemove), inlineBlobs); } else { return new ExportedDocumentImpl(docModel, inlineBlobs); } } return null; }
docModel.getPath().removeFirstSegments(pathSegmentsToRemove), inlineBlobs); } else { result = new ExportedDocumentImpl(docModel, inlineBlobs); Path path = docModel.getPath().append(VERSION_VIRTUAL_PATH_SEGMENT).append(docModel.getVersionLabel()); if (pathSegmentsToRemove > 0) { path = path.removeFirstSegments(pathSegmentsToRemove);
destinationPath = destinationPath.removeFirstSegments(removeSegments);
@Override public Path parseLocation(String location) { Path finalLocation = new Path(rootPath); Path rootUrlPath = new Path(rootUrl); Path urlLocation = new Path(location); Path cutLocation = urlLocation.removeFirstSegments(rootUrlPath.segmentCount()); finalLocation = finalLocation.append(cutLocation); String fileName = finalLocation.lastSegment(); String parentPath = finalLocation.removeLastSegments(1).toString(); return new Path(parentPath).append(fileName); }