use of com.enonic.xp.vfs.VirtualFilePath in project xp by enonic.
the class NodeImportPathResolver method resolveNodeImportPath.
public static NodePath resolveNodeImportPath(final VirtualFile parent, final VirtualFile exportRoot, final NodePath importRoot) {
final VirtualFilePath parentPath = parent.getPath();
final VirtualFilePath exportRootPath = exportRoot.getPath();
final VirtualFilePath relativePath = parentPath.subtractPath(exportRootPath);
final NodePath.Builder builder = NodePath.create(importRoot);
relativePath.getElements().forEach(builder::addElement);
return builder.build();
}
use of com.enonic.xp.vfs.VirtualFilePath in project xp by enonic.
the class NodeImporter method getChildrenAbsolutePaths.
private List<String> getChildrenAbsolutePaths(final VirtualFile parent, final List<String> childNames) {
final List<String> children = new ArrayList<>();
for (final String childName : childNames) {
final VirtualFilePath join = parent.getPath().join(childName);
children.add(join.getPath());
}
return children;
}
use of com.enonic.xp.vfs.VirtualFilePath in project xp by enonic.
the class ExportReader method getOrderSource.
public VirtualFile getOrderSource(final VirtualFile nodeFolder) {
final VirtualFilePath orderSourcePath = nodeFolder.getPath().join(SYSTEM_FOLDER_NAME, ORDER_EXPORT_NAME);
final VirtualFile orderFile = nodeFolder.resolve(orderSourcePath);
if (!orderFile.exists()) {
throw new ImportNodeException("Parent has manual ordering of children, expected at:" + orderFile.getPath());
}
return orderFile;
}
use of com.enonic.xp.vfs.VirtualFilePath in project xp by enonic.
the class ExportReader method getBinarySource.
public VirtualFile getBinarySource(final VirtualFile nodeFolder, final String binaryReferenceString) {
final VirtualFilePath binaryFilePath = nodeFolder.getPath().join(SYSTEM_FOLDER_NAME, BINARY_FOLDER, binaryReferenceString);
final VirtualFile binaryFile = nodeFolder.resolve(binaryFilePath);
if (!binaryFile.exists()) {
throw new ImportNodeException("Missing binary source, expected at: " + binaryFile.getPath());
}
return binaryFile;
}
use of com.enonic.xp.vfs.VirtualFilePath in project xp by enonic.
the class ExportReader method getNodeSource.
public VirtualFile getNodeSource(final VirtualFile nodeFolder) {
final VirtualFilePath nodeSourcePath = nodeFolder.getPath().join(SYSTEM_FOLDER_NAME, NODE_XML_EXPORT_NAME);
final VirtualFile nodeVF = nodeFolder.resolve(nodeSourcePath);
if (!nodeVF.exists()) {
throw new ImportNodeException("Missing node source, expected at: " + nodeVF.getPath());
}
return nodeVF;
}
Aggregations