mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -333,35 +333,41 @@ 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()))
|
||||||
{
|
{
|
||||||
Serializable value = entry.getValue();
|
// property is present
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Serializable value = entry.getValue();
|
||||||
|
|
||||||
// TODO what other conversions are nessesary here for other types of default values ?
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
// Check the type of the default property
|
// TODO what other conversions are nessesary here for other types of default values ?
|
||||||
PropertyDefinition prop = this.dictionaryService.getProperty(entry.getKey());
|
|
||||||
if (prop != null)
|
// ensure that we deliver the property in the correct form
|
||||||
|
if (DataTypeDefinition.BOOLEAN.equals(prop.getDataType().getName()) == true)
|
||||||
|
{
|
||||||
|
if (value instanceof String)
|
||||||
{
|
{
|
||||||
if (DataTypeDefinition.BOOLEAN.equals(prop.getDataType().getName()) == true)
|
if (((String)value).toUpperCase().equals("TRUE") == true)
|
||||||
{
|
{
|
||||||
if (value instanceof String)
|
value = Boolean.TRUE;
|
||||||
{
|
}
|
||||||
if (((String)value).toUpperCase().equals("TRUE") == true)
|
else if (((String)value).toUpperCase().equals("FALSE") == true)
|
||||||
{
|
{
|
||||||
value = Boolean.TRUE;
|
value = Boolean.FALSE;
|
||||||
}
|
|
||||||
else if (((String)value).toUpperCase().equals("FALSE") == true)
|
|
||||||
{
|
|
||||||
value = Boolean.FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the default value of the property
|
|
||||||
properties.put(entry.getKey(), value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the default value of the property
|
||||||
|
properties.put(entry.getKey(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user