use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileTreeDto in project pentaho-platform by pentaho.
the class FileResourceTest method testDoGetTree.
@Test
public void testDoGetTree() {
Integer depth = 0;
String filter = "filter";
Boolean showHidden = Boolean.TRUE;
Boolean includeAcls = Boolean.TRUE;
Boolean includeSysDirs = Boolean.FALSE;
RepositoryFileTreeDto mockRepositoryFileTreeDto = mock(RepositoryFileTreeDto.class);
doReturn(mockRepositoryFileTreeDto).when(fileResource.fileService).doGetTree(PATH_ID, depth, filter, showHidden, includeAcls, includeSysDirs);
RepositoryFileTreeDto testDto = fileResource.doGetTree(PATH_ID, depth, filter, showHidden, includeAcls, includeSysDirs);
assertEquals(mockRepositoryFileTreeDto, testDto);
verify(fileResource.fileService).doGetTree(PATH_ID, depth, filter, showHidden, includeAcls, includeSysDirs);
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileTreeDto in project pentaho-platform by pentaho.
the class FileResourceTest method testDoGetRootTree.
@Test
public void testDoGetRootTree() {
Integer depth = 0;
String filter = "filter";
Boolean showHidden = Boolean.TRUE;
Boolean includeAcls = Boolean.TRUE;
RepositoryFileTreeDto mockRepositoryFileTreeDto = mock(RepositoryFileTreeDto.class);
doReturn(mockRepositoryFileTreeDto).when(fileResource.fileService).doGetTree(FileUtils.PATH_SEPARATOR, depth, filter, showHidden, includeAcls);
RepositoryFileTreeDto testDto = fileResource.doGetRootTree(depth, filter, showHidden, includeAcls);
assertEquals(mockRepositoryFileTreeDto, testDto);
verify(fileResource.fileService, times(1)).doGetTree(FileUtils.PATH_SEPARATOR, depth, filter, showHidden, includeAcls);
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileTreeDto in project pentaho-platform by pentaho.
the class RepositoryFileTreeAdapter method unmarshal.
@Override
public RepositoryFileTree unmarshal(final RepositoryFileTreeDto v) {
List<RepositoryFileTree> children = null;
if (v.children != null) {
children = new ArrayList<RepositoryFileTree>();
for (RepositoryFileTreeDto child : v.children) {
children.add(unmarshal(child));
}
}
RepositoryFileTree repositoryFileTree = new RepositoryFileTree(RepositoryFileAdapter.toFile(v.file), children);
if (v.file.getVersioningEnabled() != null) {
repositoryFileTree.setVersioningEnabled(v.file.getVersioningEnabled());
}
if (v.file.getVersionCommentEnabled() != null) {
repositoryFileTree.setVersionCommentEnabled(v.file.getVersionCommentEnabled());
}
return repositoryFileTree;
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileTreeDto in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryWebService method getTreeFromRequest.
public RepositoryFileTreeDto getTreeFromRequest(final RepositoryRequest repositoryRequest) {
// RepositoryFileTree tree = repo.getTree( path, depth, filter, showHidden );
IAuthorizationPolicy policy = PentahoSystem.get(IAuthorizationPolicy.class);
boolean isAdmin = policy.isAllowed(AdministerSecurityAction.NAME);
// PDI uses this web-service and system folders must be returned to admin repository database connections.
if (!isAdmin) {
// Non Admin users can never get system folders
repositoryRequest.setIncludeSystemFolders(false);
getLogger().warn("User does not have administrator privileges; setting includeSystemFolders to false.");
}
RepositoryFileTree tree = repo.getTree(repositoryRequest);
return new RepositoryFileTreeAdapter(repositoryRequest).marshal(tree);
}
use of org.pentaho.platform.api.repository2.unified.webservices.RepositoryFileTreeDto in project pentaho-kettle by pentaho.
the class UnifiedRepositoryPurgeService method processRevisionDeletion.
private void processRevisionDeletion(PurgeUtilitySpecification purgeSpecification) throws PurgeDeletionException {
RepositoryRequest repositoryRequest = new RepositoryRequest(purgeSpecification.getPath(), true, -1, purgeSpecification.getFileFilter());
repositoryRequest.setTypes(FILES_TYPE_FILTER.FILES_FOLDERS);
repositoryRequest.setIncludeMemberSet(new HashSet<String>(Arrays.asList(new String[] { "name", "id", "folder", "path", "versioned", "versionId", "locked" })));
getLogger().debug("Creating file list");
RepositoryFileTreeDto tree = getRepoWs().getTreeFromRequest(repositoryRequest);
processPurgeForTree(tree, purgeSpecification);
}
Aggregations