@Override public String getPathAsString() { if (path != null) { return path.toString(); } return null; }
@Override public String getPathAsString() { return path == null ? null : path.toString(); }
@Override @Deprecated public String getPath() { Path path = collectPath(new Path("/")); return path.toString(); }
@Override public DocumentRef getParentRef() { if (parentRef == null && path != null) { if (path.isAbsolute()) { Path parentPath = path.removeLastSegments(1); parentRef = new PathRef(parentPath.toString()); } // else keep parentRef null } return parentRef; }
@Override public DocumentRef getParentRef() { if (path == null) { return null; } if (!path.isAbsolute()) { return null; } return new PathRef(path.removeLastSegments(1).toString()); }
String segment = segments[i]; if (property.isScalar()) { throw new PropertyNotFoundException(path.toString(), "segment " + segment + " points to a scalar property"); int p = segment.lastIndexOf('['); if (p == -1) { throw new PropertyNotFoundException(path.toString(), "Parse error: no matching '[' was found"); property = property.get(segment); if (property == null) { throw new PropertyNotFoundException(path.toString(), "segment " + segment + " cannot be resolved");
String schema = getSchema().getName(); String originalXpath = collectPath(new Path("/")).append(name).toString().substring(1); String xpath;
@Override protected String computePathUserWorkspaceRoot(CoreSession userCoreSession, DocumentModel currentDocument) throws ClientException { Path path = new Path("/" + targetDomainName); return path.toString(); }
/** * Must be overridden to provide real URLs */ public String getUrl(TreeItem item) { return item.getPath().toString(); }
public static String getParentPath(String path) { path = new Path(path).removeLastSegments(1).toString(); // Ensures that path starts with a "/" and doesn't end with a "/". if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } if (!path.startsWith("/")) { path = "/" + path; } return path; }
protected static String getCacheEntryPath(String key) { Path path = new Path(ConversionServiceImpl.getCacheBasePath()); List<String> subPath = getSubPathFromKey(key); for (String subPart : subPath) { path = path.append(subPart); new File(path.toString()).mkdir(); } // path = path.append(key); return path.toString(); }
protected AbstractVirtualBackend(String name, String rootUrl, CoreSession session, RealBackendFactory realBackendFactory) { super(session); this.backendDisplayName = name; this.rootUrl = new Path(rootUrl).append(this.backendDisplayName).toString(); this.realBackendFactory = realBackendFactory; }
protected String findFarthestContainerPath(String documentPath) { Path containerPath = new Path(documentPath); String result; do { result = containerPath.toString(); containerPath = containerPath.removeLastSegments(1); } while (!containerPath.isRoot() && documentManager.exists(new PathRef(containerPath.toString()))); return result; }
@Override public DocumentObject newDocument(String path) { PathRef pathRef = new PathRef(doc.getPath().append(path).toString()); DocumentModel doc = ctx.getCoreSession().getDocument(pathRef); return (DocumentObject) ctx.newObject("Document", doc); }
protected boolean cleanTrashPath(DocumentModel parent, String name) { Path checkedPath = new Path(parent.getPathAsString()).append(name); if (getSession().exists(new PathRef(checkedPath.toString()))) { DocumentModel model = getSession().getDocument(new PathRef(checkedPath.toString())); if (model != null && model.isTrashed()) { name = name + "." + System.currentTimeMillis(); getSession().move(model.getRef(), parent.getRef(), name); return true; } } return false; }
@Override protected DocumentModel doCreateUserWorkspacesRoot(CoreSession unrestrictedSession, PathRef rootRef) { String parentPath = new Path(rootRef.toString()).removeLastSegments(1).toString(); DocumentModel doc = unrestrictedSession.createDocumentModel(parentPath, UserWorkspaceConstants.USERS_PERSONAL_WORKSPACES_ROOT, getUserWorkspaceRootType()); doc.setProperty("dublincore", "title", UserWorkspaceConstants.USERS_PERSONAL_WORKSPACES_ROOT); doc.setProperty("dublincore", "description", ""); return doc; }
protected DocumentModel getParentDocument(CoreSession session, DocumentModel doc) { DocumentModel parent; if (session.exists(doc.getRef())) { parent = session.getParentDocument(doc.getRef()); } else { Path parentPath = doc.getPath().removeLastSegments(1); parent = session.getDocument(new PathRef(parentPath.toString())); } return parent; }
@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); }
@Override protected DocumentModel doCreateUserWorkspace(CoreSession unrestrictedSession, PathRef wsRef, String userName) { String parentPath = new Path(wsRef.toString()).removeLastSegments(1).toString(); String wsName = new Path(wsRef.toString()).lastSegment(); DocumentModel doc = unrestrictedSession.createDocumentModel(parentPath, wsName, getUserWorkspaceType()); doc.setProperty("dublincore", "title", buildUserWorkspaceTitle(userName)); doc.setProperty("dublincore", "description", ""); return doc; }