Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,18 @@ public PathMappedDeleteResult delete( String packageType, String type, String na
return new PathMappedDeleteResult( packageType, type, name, path, result );
}

public PathMappedListResult list( String packageType, String type, String name, String path, boolean recursive )
public PathMappedListResult list( String packageType, String type, String name, String path, boolean recursive, int limit )
{
String[] list;
StoreKey storeKey = new StoreKey( packageType, StoreType.get( type ), name );
if ( recursive )
{
list = fileManager.list( storeKey.toString(), path, true, DEFAULT_RECURSIVE_LIST_LIMIT );
int lmt = DEFAULT_RECURSIVE_LIST_LIMIT;
if ( limit > 0 )
{
lmt = limit;
}
list = fileManager.list( storeKey.toString(), path, true, lmt );
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ public PathMappedListResult listRoot( final @ApiParam( required = true ) @PathPa
final @ApiParam( allowableValues = "hosted,group,remote", required = true ) @PathParam( "type" ) String type,
final @ApiParam( required = true ) @PathParam( "name" ) String name,
final @QueryParam( "recursive" ) boolean recursive,
final @QueryParam( "limit" ) int limit,
final @Context HttpServletRequest request,
final @Context SecurityContext securityContext )
{
logger.debug( "List, packageType:{}, type:{}, name:{}, recursive:{}", packageType, type, name, recursive );
return controller.list( packageType, type, name, ROOT_DIR, recursive );
return controller.list( packageType, type, name, ROOT_DIR, recursive, limit );
}

@ApiOperation( "List specified path." )
Expand All @@ -98,12 +99,13 @@ public PathMappedListResult list( final @ApiParam( required = true ) @PathParam(
final @ApiParam( required = true ) @PathParam( "name" ) String name,
final @PathParam( "path" ) String path,
final @QueryParam( "recursive" ) boolean recursive,
final @QueryParam( "limit" ) int limit,
final @Context HttpServletRequest request,
final @Context SecurityContext securityContext )
{
logger.debug( "List, packageType:{}, type:{}, name:{}, path:{}, recursive:{}", packageType, type, name, path,
recursive );
return controller.list( packageType, type, name, path, recursive );
return controller.list( packageType, type, name, path, recursive, limit );
}

@ApiOperation( "Get specified path." )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class PathMappedListResult

private String path;

private int size;

private String[] list;

public PathMappedListResult( String packageType, String type, String name, String path, String[] list )
Expand All @@ -19,6 +21,7 @@ public PathMappedListResult( String packageType, String type, String name, Strin
this.name = name;
this.path = path;
this.list = list;
this.size = list != null ? list.length : 0;
}

public String getPackageType()
Expand Down Expand Up @@ -70,4 +73,14 @@ public void setList( String[] list )
{
this.list = list;
}

public int getSize()
{
return size;
}

public void setSize( int size )
{
this.size = size;
}
}