@Test public void testGetKey() { final DropboxPathContainerService s = new DropboxPathContainerService(); assertEquals("", s.getKey(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("r")))); assertEquals("/f", s.getKey(new Path(new Path("/", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("r")), "f", EnumSet.of(Path.Type.file)))); assertEquals("/Business", s.getKey(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("", s.getKey(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("/d", s.getKey(new Path(new Path("/Business", EnumSet.of(Path.Type.directory, Path.Type.volume)).withAttributes(new PathAttributes().withVersionId("a")), "d", EnumSet.of(Path.Type.directory)))); }
@Override public String getKey(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); final String namespace = container.attributes().getVersionId(); if(StringUtils.isNotBlank(namespace)) { if(file.isRoot()) { if(useNamespace) { return String.format("ns:%s", namespace); } return StringUtils.EMPTY; } final String key = this.isContainer(file) ? StringUtils.EMPTY : Path.DELIMITER + super.getKey(file); if(useNamespace) { return String.format("ns:%s%s", namespace, key); } return key; } } return file.isRoot() ? StringUtils.EMPTY : file.getAbsolute(); }
DropboxPathContainerService extends PathContainerService { @Override public String getKey(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); final String namespace = container.attributes().getVersionId(); if(StringUtils.isNotBlank(namespace)) { if(file.isRoot()) { if(useNamespace) { return String.format("ns:%s", namespace); } return StringUtils.EMPTY; } final String key = this.isContainer(file) ? StringUtils.EMPTY : Path.DELIMITER + super.getKey(file); if(useNamespace) { return String.format("ns:%s%s", namespace, key); } return key; } } return file.isRoot() ? StringUtils.EMPTY : file.getAbsolute(); } }
DropboxPathContainerService extends PathContainerService { @Override public String getKey(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); final String namespace = container.attributes().getVersionId(); if(StringUtils.isNotBlank(namespace)) { if(file.isRoot()) { if(useNamespace) { return String.format("ns:%s", namespace); } return StringUtils.EMPTY; } final String key = this.isContainer(file) ? StringUtils.EMPTY : Path.DELIMITER + super.getKey(file); if(useNamespace) { return String.format("ns:%s%s", namespace, key); } return key; } } return file.isRoot() ? StringUtils.EMPTY : file.getAbsolute(); }  }
DropboxPathContainerService extends PathContainerService { @Override public String getKey(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); final String namespace = container.attributes().getVersionId(); if(StringUtils.isNotBlank(namespace)) { if(file.isRoot()) { if(useNamespace) { return String.format("ns:%s", namespace); } return StringUtils.EMPTY; } final String key = this.isContainer(file) ? StringUtils.EMPTY : Path.DELIMITER + super.getKey(file); if(useNamespace) { return String.format("ns:%s%s", namespace, key); } return key; } } return file.isRoot() ? StringUtils.EMPTY : file.getAbsolute(); }  DropboxPathContainerService withNamespace(final boolean useNamespace); @Override boolean isContainer(final Path file); @Override String getKey(final Path file); }
DropboxPathContainerService extends PathContainerService { @Override public String getKey(final Path file) { if(PreferencesFactory.get().getBoolean("dropbox.business.enable")) { final Path container = this.getContainer(file); final String namespace = container.attributes().getVersionId(); if(StringUtils.isNotBlank(namespace)) { if(file.isRoot()) { if(useNamespace) { return String.format("ns:%s", namespace); } return StringUtils.EMPTY; } final String key = this.isContainer(file) ? StringUtils.EMPTY : Path.DELIMITER + super.getKey(file); if(useNamespace) { return String.format("ns:%s%s", namespace, key); } return key; } } return file.isRoot() ? StringUtils.EMPTY : file.getAbsolute(); }  DropboxPathContainerService withNamespace(final boolean useNamespace); @Override boolean isContainer(final Path file); @Override String getKey(final Path file);  }