mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
User content usages & quotas - initial check-in
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7453 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -51,6 +51,7 @@ import org.alfresco.web.bean.LoginBean;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.MapNode;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.NodePropertyResolver;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.ui.common.component.UIActionLink;
|
||||
@@ -111,6 +112,36 @@ public class UsersDialog extends BaseDialogBean implements IContextListener
|
||||
return this.users;
|
||||
}
|
||||
|
||||
public long getUsersTotalUsage()
|
||||
{
|
||||
long totalUsage = 0L;
|
||||
List<Node> users = getUsers();
|
||||
for(Node user : users)
|
||||
{
|
||||
Long sizeLatest = (Long)properties.getUserUsage((String)user.getProperties().get("userName"));
|
||||
if (sizeLatest != null)
|
||||
{
|
||||
totalUsage = totalUsage + sizeLatest;
|
||||
}
|
||||
}
|
||||
return totalUsage;
|
||||
}
|
||||
|
||||
public long getUsersTotalQuota()
|
||||
{
|
||||
long totalQuota = 0L;
|
||||
List<Node> users = getUsers();
|
||||
for(Node user : users)
|
||||
{
|
||||
Long sizeCurrent = (Long)user.getProperties().get("sizeQuota");
|
||||
if (sizeCurrent != null)
|
||||
{
|
||||
totalQuota = totalQuota + sizeCurrent;
|
||||
}
|
||||
}
|
||||
return totalQuota;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action event called by all actions that need to setup a Person context on
|
||||
* the Users bean before an action page is called. The context will be a
|
||||
@@ -305,6 +336,8 @@ public class UsersDialog extends BaseDialogBean implements IContextListener
|
||||
props.put("homeSpace", homeFolderNodeRef);
|
||||
}
|
||||
|
||||
node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest);
|
||||
|
||||
this.users.add(node);
|
||||
}
|
||||
|
||||
@@ -331,6 +364,13 @@ public class UsersDialog extends BaseDialogBean implements IContextListener
|
||||
return null;
|
||||
}
|
||||
|
||||
public NodePropertyResolver resolverUserSizeLatest = new NodePropertyResolver() {
|
||||
public Object get(Node personNode) {
|
||||
Long sizeLatest = (Long)properties.getUserUsage((String)personNode.getProperties().get("userName"));
|
||||
return sizeLatest;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Action handler to show all the users currently in the system
|
||||
*
|
||||
@@ -343,6 +383,11 @@ public class UsersDialog extends BaseDialogBean implements IContextListener
|
||||
this.users = Repository.getUsers(FacesContext.getCurrentInstance(),
|
||||
properties.getNodeService(), properties.getSearchService());
|
||||
|
||||
for (Node node : this.users)
|
||||
{
|
||||
node.addPropertyResolver("sizeLatest", this.resolverUserSizeLatest);
|
||||
}
|
||||
|
||||
// return null to stay on the same page
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user