. Tree Navigator performance improvement

- explicit txns around multiple nodeservice calls and internal (permission check free) nodeservice to retrieve node names
 - 25% improvement to retrieving node lists
. Permission code hotspot tuning and nodeservice methods ACL configuration tuning

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4960 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-01-29 18:42:30 +00:00
parent 200ff43d6e
commit c68cf150b4
3 changed files with 148 additions and 80 deletions

View File

@@ -8,6 +8,7 @@ import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
import javax.transaction.UserTransaction;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
@@ -47,6 +48,7 @@ public class NavigatorPluginBean implements IContextListener
protected NodeRef previouslySelectedNode;
private NodeService nodeService;
private NodeService internalNodeService;
private DictionaryService dictionaryService;
private static final Log logger = LogFactory.getLog(NavigatorPluginBean.class);
@@ -69,6 +71,12 @@ public class NavigatorPluginBean implements IContextListener
FacesContext context = FacesContext.getCurrentInstance();
ResponseWriter out = context.getResponseWriter();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(context, true);
tx.begin();
Map params = context.getExternalContext().getRequestParameterMap();
String nodeRefStr = (String)params.get("nodeRef");
String area = (String)params.get("area");
@@ -118,6 +126,14 @@ public class NavigatorPluginBean implements IContextListener
if (logger.isDebugEnabled())
logger.debug("returning XML: " + xml.toString());
}
// commit the transaction
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
/**
@@ -263,6 +279,12 @@ public class NavigatorPluginBean implements IContextListener
this.companyHomeRootNodes = new ArrayList<TreeNode>();
this.companyHomeNodes = new HashMap<String, TreeNode>();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
// query for the child nodes of company home
NodeRef root = new NodeRef(Repository.getStoreRef(),
Application.getCompanyRootId());
@@ -280,6 +302,13 @@ public class NavigatorPluginBean implements IContextListener
this.companyHomeNodes.put(node.getNodeRef(), node);
}
}
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
return this.companyHomeRootNodes;
@@ -301,6 +330,12 @@ public class NavigatorPluginBean implements IContextListener
this.myHomeRootNodes = new ArrayList<TreeNode>();
this.myHomeNodes = new HashMap<String, TreeNode>();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
// query for the child nodes of the user's home
NodeRef root = new NodeRef(Repository.getStoreRef(),
Application.getCurrentUser(FacesContext.getCurrentInstance()).getHomeSpaceId());
@@ -318,6 +353,13 @@ public class NavigatorPluginBean implements IContextListener
this.myHomeNodes.put(node.getNodeRef(), node);
}
}
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
return this.myHomeRootNodes;
@@ -339,6 +381,12 @@ public class NavigatorPluginBean implements IContextListener
this.guestHomeRootNodes = new ArrayList<TreeNode>();
this.guestHomeNodes = new HashMap<String, TreeNode>();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
// query for the child nodes of the guest home space
NavigationBean navBean = getNavigationBean();
if (navBean != null)
@@ -359,6 +407,13 @@ public class NavigatorPluginBean implements IContextListener
}
}
}
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception tex) {}
}
}
return this.guestHomeRootNodes;
@@ -372,6 +427,14 @@ public class NavigatorPluginBean implements IContextListener
this.nodeService = nodeService;
}
/**
* @param internalNodeService The internalNodeService to set.
*/
public void setInternalNodeService(NodeService internalNodeService)
{
this.internalNodeService = internalNodeService;
}
/**
* @param dictionaryService The DictionaryService to set.
*/
@@ -554,8 +617,8 @@ public class NavigatorPluginBean implements IContextListener
protected TreeNode createTreeNode(NodeRef nodeRef)
{
TreeNode node = new TreeNode(nodeRef.toString(),
Repository.getNameForNode(this.nodeService, nodeRef),
(String)this.nodeService.getProperty(nodeRef, ApplicationModel.PROP_ICON));
Repository.getNameForNode(this.internalNodeService, nodeRef),
(String)this.internalNodeService.getProperty(nodeRef, ApplicationModel.PROP_ICON));
return node;
}
@@ -568,7 +631,7 @@ public class NavigatorPluginBean implements IContextListener
protected NavigationBean getNavigationBean()
{
return (NavigationBean)FacesHelper.getManagedBean(
FacesContext.getCurrentInstance(), "NavigationBean");
FacesContext.getCurrentInstance(), NavigationBean.BEAN_NAME);
}
/**
@@ -579,7 +642,7 @@ public class NavigatorPluginBean implements IContextListener
protected BrowseBean getBrowseBean()
{
return (BrowseBean)FacesHelper.getManagedBean(
FacesContext.getCurrentInstance(), "BrowseBean");
FacesContext.getCurrentInstance(), BrowseBean.BEAN_NAME);
}
/**

View File

@@ -3129,6 +3129,10 @@
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>internalNodeService</property-name>
<value>#{nodeService}</value>
</managed-property>
<managed-property>
<property-name>dictionaryService</property-name>
<value>#{DictionaryService}</value>

View File

@@ -435,12 +435,13 @@ a.topToolbarLinkHighlight, a.topToolbarLinkHighlight:link, a.topToolbarLinkHighl
.pager
{
padding: 5px 3px 4px 3px;
padding: 4px 2px 3px 2px;
border: 1px dotted #cccccc;
}
.pager img
{
margin-top:2px;
vertical-align: -20%;
}