Skip to content

Commit

Permalink
Revert "[MNT-24127] Added endpoint implementation to calculating fold…
Browse files Browse the repository at this point in the history
…er size."

This reverts commit 412af05.
  • Loading branch information
mohit-singh4 committed Mar 5, 2024
1 parent 8036b31 commit bbebfec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3567,7 +3567,7 @@ public Map<String, Object> getFolderSize(String folderNodeId){
int k = 1024;
String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"};
int i = (int) Math.floor(Math.log(size) / Math.log(k));
float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i)));
float finalSize = Float.parseFloat(String.valueOf((size / Math.pow(k, i))));

Check warning

Code scanning / PMD

Useless parentheses. Warning

Useless parentheses.
Map<String, Object> response = new HashMap<>();
response.put("id", folderNodeId);
response.put("size", String.valueOf(finalSize + " " + sizes[i]));
Expand All @@ -3579,7 +3579,11 @@ protected long getNodeSize(NodeRef nodeRef){
long size=0;

Check warning

Code scanning / PMD

The initializer for variable 'size' is never used (overwritten on line 3582) Warning

The initializer for variable 'size' is never used (overwritten on line 3582)
// Collecting current node size.
ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT);
size = contentData.getSize();
try {
size = contentData.getSize();
} catch (Exception e) {
size = 0;
}
List<ChildAssociationRef> chilAssocsList = nodeService.getChildAssocs(nodeRef);
for (ChildAssociationRef childAssociationRef : chilAssocsList) {
NodeRef childNodeRef = childAssociationRef.getChildRef();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ public static interface DeleteSetWithResponse extends ResourceAction
*/
public void deleteSet(String entityResourceId, Parameters params, WithResponse withResponse);
}
interface FolderSize<E> extends ResourceAction
public static interface FolderSize<E> extends ResourceAction

Check warning

Code scanning / PMD

Unnecessary modifiers 'public static' on interface 'FolderSize': the interface is declared in an interface type Warning

Unnecessary modifiers 'public static' on interface 'FolderSize': the interface is declared in an interface type
{
/**
* Return the size of Folder.
*
* @param nodeId Entity resource context for this relationship.
*/
E readAll(String nodeId);
public E readAll(String nodeId);

Check warning

Code scanning / PMD

Unnecessary modifiers 'public static' on interface 'FolderSize': the interface is declared in an interface type Warning

Unnecessary modifier 'public' on method 'readAll': the method is declared in an interface type
}
}

0 comments on commit bbebfec

Please sign in to comment.