@Test public void testNamespace() { final DropboxPathContainerService s = new DropboxPathContainerService(); final Host host = new Host(new DropboxProtocol()); assertEquals(PathRoot.namespaceId("r"), s.getNamespace(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("r")))); assertEquals(PathRoot.namespaceId("r"), s.getNamespace(new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("r")), "f", EnumSet.of(Path.Type.file)))); assertEquals(PathRoot.HOME, s.getNamespace(new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("r")), "Business", EnumSet.of(Path.Type.directory, Path.Type.volume)))); assertEquals(PathRoot.namespaceId("a"), s.getNamespace(new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("r")), "Business", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("a")))); assertEquals(PathRoot.namespaceId("a"), s.getNamespace(new Path(new Path("/Business", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("a")), "d", EnumSet.of(Path.Type.directory)))); }
protected PathRoot getNamespace(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); if(StringUtils.isNotBlank(container.attributes().getVersionId())) { return PathRoot.namespaceId(container.attributes().getVersionId()); } } return PathRoot.HOME; }
DropboxPathContainerService extends PathContainerService { protected PathRoot getNamespace(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); if(StringUtils.isNotBlank(container.attributes().getVersionId())) { return PathRoot.namespaceId(container.attributes().getVersionId()); } } return PathRoot.HOME; } }
DropboxPathContainerService extends PathContainerService { protected PathRoot getNamespace(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); if(StringUtils.isNotBlank(container.attributes().getVersionId())) { return PathRoot.namespaceId(container.attributes().getVersionId()); } } return PathRoot.HOME; }  }
DropboxPathContainerService extends PathContainerService { protected PathRoot getNamespace(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); if(StringUtils.isNotBlank(container.attributes().getVersionId())) { return PathRoot.namespaceId(container.attributes().getVersionId()); } } return PathRoot.HOME; }  DropboxPathContainerService withNamespace(final boolean useNamespace); @Override boolean isContainer(final Path file); @Override String getKey(final Path file); }
DropboxPathContainerService extends PathContainerService { protected PathRoot getNamespace(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); if(StringUtils.isNotBlank(container.attributes().getVersionId())) { return PathRoot.namespaceId(container.attributes().getVersionId()); } } return PathRoot.HOME; }  DropboxPathContainerService withNamespace(final boolean useNamespace); @Override boolean isContainer(final Path file); @Override String getKey(final Path file);  }