@Override public void setPathInfo(String parentPath, String name) { path = new Path(parentPath == null ? name : parentPath + '/' + name); }
@Override public void setPathInfo(String parentPath, String name) { path = new Path(parentPath == null ? name : parentPath + '/' + name); ref = new PathRef(parentPath, name); }
@Override public Property resolvePath(String path) throws PropertyNotFoundException { return resolvePath(new Path(path)); }
@Override @Deprecated public String getPath() { Path path = collectPath(new Path("/")); return path.toString(); }
/** * Constructor to be used by clients. * <p> * A client constructed data model must contain at least the path and the type. */ public DocumentModelImpl(String parentPath, String name, String type) { this(type); String fullPath = parentPath == null ? name : parentPath + (parentPath.endsWith("/") ? "" : "/") + name; path = new Path(fullPath); ref = new PathRef(fullPath); if (getDocumentType() != null) { facets.addAll(getDocumentType().getFacets()); } schemas = computeSchemas(getDocumentType(), instanceFacets, false); schemasOrig = new HashSet<>(schemas); }
String schema = getSchema().getName(); String originalXpath = collectPath(new Path("/")).append(name).toString().substring(1); String xpath;
public static Path createFromSegments(String[] segments) { if (segments.length == 0) { return ROOT; } return new Path(segments, HAS_LEADING); }
public Path uptoSegment(final int count) { if (count == 0) { return new Path(NO_SEGMENTS, separators & HAS_LEADING); } if (count >= segments.length) { return this; } assert count > 0; // Invalid parameter to Path.uptoSegment final String[] newSegments = new String[count]; System.arraycopy(segments, 0, newSegments, 0, count); return new Path(newSegments, separators); }
public Path makeRelative() { if (!isAbsolute()) { return this; } return new Path(segments, separators & HAS_TRAILING); }
@Override protected String computePathUserWorkspaceRoot(CoreSession userCoreSession, DocumentModel currentDocument) throws ClientException { Path path = new Path("/" + targetDomainName); return path.toString(); }
public Path removeTrailingSeparator() { if (!hasTrailingSeparator()) { return this; } return new Path(segments, separators & HAS_LEADING); }
/** * @deprecated since 10.1 - seems unused */ @Deprecated public static void copyTree(File src, File dst, PathFilter filter) throws IOException { copyTree(src, dst, new Path("/"), filter); }
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 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; }
public Path addFileExtension(String extension) { if (isRoot() || isEmpty() || hasTrailingSeparator()) { return this; } int len = segments.length; String[] newSegments = new String[len]; System.arraycopy(segments, 0, newSegments, 0, len - 1); newSegments[len - 1] = segments[len - 1] + '.' + extension; return new Path(newSegments, separators); }
public static boolean isValidPath(String path) { Path test = new Path(path); for (int i = 0, max = test.segmentCount(); i < max; i++) { if (!isValidSegment(test.segment(i))) { return false; } } return true; }
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(); }
@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; }
@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; }