mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
Performance tweaks for AVM Indexing.
Removed calls to getXXXPaths(). Changed mappings of properties and aspects on AVM Nodes to favor get all calls. Added getAspects() and getNodeProperties() which take AVMNodeDescriptors. Used these in AVM Indexing to reduce the number of redundant full lookups. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6121 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -90,12 +90,15 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
private Set<QName> fAspects;
|
||||
|
||||
private Map<QName, PropertyValue> fProperties;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
protected AVMNodeImpl()
|
||||
{
|
||||
fAspects = new HashSet<QName>();
|
||||
fProperties = new HashMap<QName, PropertyValue>();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,6 +110,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
AVMStore store)
|
||||
{
|
||||
fAspects = new HashSet<QName>();
|
||||
fProperties = new HashMap<QName, PropertyValue>();
|
||||
fID = id;
|
||||
fVersionID = -1;
|
||||
fIsRoot = false;
|
||||
@@ -343,14 +347,10 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
protected void copyProperties(AVMNode other)
|
||||
{
|
||||
Map<QName, PropertyValue> properties = other.getProperties();
|
||||
for (QName name : properties.keySet())
|
||||
fProperties = new HashMap<QName, PropertyValue>();
|
||||
for (Map.Entry<QName, PropertyValue> entry : other.getProperties().entrySet())
|
||||
{
|
||||
AVMNodeProperty newProp = new AVMNodePropertyImpl();
|
||||
newProp.setNode(this);
|
||||
newProp.setName(name);
|
||||
newProp.setValue(properties.get(name));
|
||||
AVMDAOs.Instance().fAVMNodePropertyDAO.save(newProp);
|
||||
fProperties.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,18 +394,15 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
{
|
||||
checkReadOnly();
|
||||
}
|
||||
AVMNodeProperty prop = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this, name);
|
||||
if (prop != null)
|
||||
fProperties.put(name, value);
|
||||
}
|
||||
|
||||
public void addProperties(Map<QName, PropertyValue> properties)
|
||||
{
|
||||
for (Map.Entry<QName, PropertyValue> entry : properties.entrySet())
|
||||
{
|
||||
prop.setValue(value);
|
||||
AVMDAOs.Instance().fAVMNodePropertyDAO.update(prop);
|
||||
return;
|
||||
fProperties.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
prop = new AVMNodePropertyImpl();
|
||||
prop.setNode(this);
|
||||
prop.setName(name);
|
||||
prop.setValue(value);
|
||||
AVMDAOs.Instance().fAVMNodePropertyDAO.save(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,14 +411,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
public void setProperties(Map<QName, PropertyValue> properties)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
checkReadOnly();
|
||||
}
|
||||
for (QName name : properties.keySet())
|
||||
{
|
||||
setProperty(name, properties.get(name));
|
||||
}
|
||||
fProperties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,12 +421,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
public PropertyValue getProperty(QName name)
|
||||
{
|
||||
AVMNodeProperty prop = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this, name);
|
||||
if (prop == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return prop.getValue();
|
||||
return fProperties.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -445,13 +430,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
public Map<QName, PropertyValue> getProperties()
|
||||
{
|
||||
Map<QName, PropertyValue> retVal = new HashMap<QName, PropertyValue>();
|
||||
List<AVMNodeProperty> props = AVMDAOs.Instance().fAVMNodePropertyDAO.get(this);
|
||||
for (AVMNodeProperty prop : props)
|
||||
{
|
||||
retVal.put(prop.getName(), prop.getValue());
|
||||
}
|
||||
return retVal;
|
||||
return fProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -464,7 +443,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
{
|
||||
checkReadOnly();
|
||||
}
|
||||
AVMDAOs.Instance().fAVMNodePropertyDAO.delete(this, name);
|
||||
fProperties.remove(name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -472,11 +451,7 @@ public abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
public void deleteProperties()
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
checkReadOnly();
|
||||
}
|
||||
AVMDAOs.Instance().fAVMNodePropertyDAO.deleteAll(this);
|
||||
fProperties.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user