Fixed persistence of boolean properties, checkbox control was not sending false when unchecked and sending 'on' as value when selected

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14335 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2009-05-15 14:57:35 +00:00
parent 80c131be6e
commit 17fd83154b

View File

@@ -77,6 +77,7 @@ public class NodeHandler extends AbstractHandler
{ {
private static final Log logger = LogFactory.getLog(NodeHandler.class); private static final Log logger = LogFactory.getLog(NodeHandler.class);
protected static final String ON = "on";
protected static final String PROP = "prop"; protected static final String PROP = "prop";
protected static final String ASSOC = "assoc"; protected static final String ASSOC = "assoc";
protected static final String DATA_KEY_SEPARATOR = "_"; protected static final String DATA_KEY_SEPARATOR = "_";
@@ -912,6 +913,14 @@ public class NodeHandler extends AbstractHandler
// persist the List // persist the List
value = list; value = list;
} }
else if (propDef.getDataType().getName().equals(DataTypeDefinition.BOOLEAN))
{
// check for browser representation of true, that being "on"
if (value instanceof String && ON.equals(value))
{
value = Boolean.TRUE;
}
}
else if (propDef.getDataType().getName().equals(DataTypeDefinition.LOCALE)) else if (propDef.getDataType().getName().equals(DataTypeDefinition.LOCALE))
{ {
value = I18NUtil.parseLocale((String)value); value = I18NUtil.parseLocale((String)value);
@@ -1002,6 +1011,8 @@ public class NodeHandler extends AbstractHandler
// Each element in this array will be a new target node in association // Each element in this array will be a new target node in association
// with the current node. // with the current node.
for (String nextTargetNode : nodeRefs) for (String nextTargetNode : nodeRefs)
{
if (nextTargetNode.length() > 0)
{ {
if (NodeRef.isNodeRef(nextTargetNode)) if (NodeRef.isNodeRef(nextTargetNode))
{ {
@@ -1061,6 +1072,7 @@ public class NodeHandler extends AbstractHandler
} }
} }
} }
}
/** /**
* Persists the given field data as the name property * Persists the given field data as the name property