mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
AVM Nodes are (theoretically) mostly aspect ready. AVMNodeService is
now derived from AbstractNodeServiceImpl to make policy awareness easier. Moved addDefaultPropertyValues from DbNodeServiceImpl to AbstractNodeServiceImpl so AVMNodeService can use it. A fix for an NPE that showed up in stress test. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3603 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -42,8 +42,6 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.service.cmr.dictionary.AspectDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.ClassDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidAspectException;
|
||||
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
@@ -77,7 +75,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
{
|
||||
private static Log logger = LogFactory.getLog(DbNodeServiceImpl.class);
|
||||
|
||||
private DictionaryService dictionaryService;
|
||||
private NodeDaoService nodeDaoService;
|
||||
private StoreArchiveMap storeArchiveMap;
|
||||
private NodeService avmNodeService;
|
||||
@@ -87,11 +84,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
storeArchiveMap = new StoreArchiveMap(); // in case it is not set
|
||||
}
|
||||
|
||||
public void setDictionaryService(DictionaryService dictionaryService)
|
||||
{
|
||||
this.dictionaryService = dictionaryService;
|
||||
}
|
||||
|
||||
public void setNodeDaoService(NodeDaoService nodeDaoService)
|
||||
{
|
||||
this.nodeDaoService = nodeDaoService;
|
||||
@@ -347,53 +339,6 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default property values
|
||||
*
|
||||
* @param classDefinition
|
||||
* @param properties
|
||||
*/
|
||||
private void addDefaultPropertyValues(ClassDefinition classDefinition, Map<QName, Serializable> properties)
|
||||
{
|
||||
for (Map.Entry<QName, Serializable> entry : classDefinition.getDefaultValues().entrySet())
|
||||
{
|
||||
if (properties.containsKey(entry.getKey()))
|
||||
{
|
||||
// property is present
|
||||
continue;
|
||||
}
|
||||
Serializable value = entry.getValue();
|
||||
|
||||
// Check the type of the default property
|
||||
PropertyDefinition prop = this.dictionaryService.getProperty(entry.getKey());
|
||||
if (prop == null)
|
||||
{
|
||||
// dictionary doesn't have a default value present
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: what other conversions are necessary here for other types of default values ?
|
||||
|
||||
// ensure that we deliver the property in the correct form
|
||||
if (DataTypeDefinition.BOOLEAN.equals(prop.getDataType().getName()) == true)
|
||||
{
|
||||
if (value instanceof String)
|
||||
{
|
||||
if (((String)value).toUpperCase().equals("TRUE") == true)
|
||||
{
|
||||
value = Boolean.TRUE;
|
||||
}
|
||||
else if (((String)value).toUpperCase().equals("FALSE") == true)
|
||||
{
|
||||
value = Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the default value of the property
|
||||
properties.put(entry.getKey(), value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops the old primary association and creates a new one
|
||||
|
Reference in New Issue
Block a user