Removed deep nesting logic

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2137 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-01-18 16:28:39 +00:00
parent 235eedee97
commit 2ade4922f6

View File

@@ -333,16 +333,24 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
{ {
for (Map.Entry<QName, Serializable> entry : classDefinition.getDefaultValues().entrySet()) for (Map.Entry<QName, Serializable> entry : classDefinition.getDefaultValues().entrySet())
{ {
if (properties.containsKey(entry.getKey()) == false) if (properties.containsKey(entry.getKey()))
{ {
// property is present
continue;
}
Serializable value = entry.getValue(); Serializable value = entry.getValue();
// TODO what other conversions are nessesary here for other types of default values ?
// Check the type of the default property // Check the type of the default property
PropertyDefinition prop = this.dictionaryService.getProperty(entry.getKey()); PropertyDefinition prop = this.dictionaryService.getProperty(entry.getKey());
if (prop != null) if (prop == null)
{ {
// dictionary doesn't have a default value present
continue;
}
// TODO what other conversions are nessesary 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 (DataTypeDefinition.BOOLEAN.equals(prop.getDataType().getName()) == true)
{ {
if (value instanceof String) if (value instanceof String)
@@ -357,13 +365,11 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
} }
} }
} }
}
// Set the default value of the property // Set the default value of the property
properties.put(entry.getKey(), value); properties.put(entry.getKey(), value);
} }
} }
}
/** /**
* Drops the old primary association and creates a new one * Drops the old primary association and creates a new one