Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

63749: Merged V4.2-BUG-FIX (4.2.2) to HEAD-BUG-FIX (4.3.0.BF)
      63717: Merged V4.1-BUG-FIX (4.1.9) to V4.2-BUG-FIX (4.2.2)
         63646:  Merged DEV to V4.1-BUG-FIX (4.1.9)
            55519: MNT-9203: CMIS: Cannot unset (set to null) property during checkin
              - CMISConnector#setProperty method was modified. Now we can set null values according to provided API. Also, testCheckIn unit test was added for this approach.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@64327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-03-14 17:01:02 +00:00
parent 824391d858
commit a201257a29
3 changed files with 112 additions and 29 deletions

View File

@@ -3427,34 +3427,27 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen
}
}
else
{
if (value == null)
{
nodeService.removeProperty(nodeRef, propertyQName);
}
else
{
// overflow check
if(propDef.getPropertyDefinition().getPropertyType() == PropertyType.INTEGER && value instanceof BigInteger)
{
org.alfresco.service.cmr.dictionary.PropertyDefinition def = dictionaryService.getProperty(propertyQName);
QName dataDef = def.getDataType().getName();
BigInteger bigValue = (BigInteger)value;
if ((bigValue.compareTo(maxInt) > 0 || bigValue.compareTo(minInt) < 0 ) && dataDef.equals(DataTypeDefinition.INT))
{
throw new CmisConstraintException("Value is out of range for property " + propertyQName.getLocalName());
}
if ((bigValue.compareTo(maxLong) > 0 || bigValue.compareTo(minLong) < 0 ) && dataDef.equals(DataTypeDefinition.LONG))
{
throw new CmisConstraintException("Value is out of range for property " + propertyQName.getLocalName());
}
}
nodeService.setProperty(nodeRef, propertyQName, value);
}
}
{
// overflow check
if (propDef.getPropertyDefinition().getPropertyType() == PropertyType.INTEGER && value instanceof BigInteger)
{
org.alfresco.service.cmr.dictionary.PropertyDefinition def = dictionaryService.getProperty(propertyQName);
QName dataDef = def.getDataType().getName();
BigInteger bigValue = (BigInteger) value;
if ((bigValue.compareTo(maxInt) > 0 || bigValue.compareTo(minInt) < 0) && dataDef.equals(DataTypeDefinition.INT))
{
throw new CmisConstraintException("Value is out of range for property " + propertyQName.getLocalName());
}
if ((bigValue.compareTo(maxLong) > 0 || bigValue.compareTo(minLong) < 0) && dataDef.equals(DataTypeDefinition.LONG))
{
throw new CmisConstraintException("Value is out of range for property " + propertyQName.getLocalName());
}
}
nodeService.setProperty(nodeRef, propertyQName, value);
}
}
}