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

76593: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud)
      76534: MNT-10226: Merged DEV to V4.2-BUG-FIX (4.2.4)
         76512: MNT-10226: Web Script - Status 500 error on 'Edit Properties' page after adding 'Restrictable' aspect through CMIS 1.1 API
            - Convert default value in appliance with type of the property.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@77660 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-07-22 15:59:13 +00:00
parent ded1d1a971
commit e9da763689
2 changed files with 20 additions and 1 deletions

View File

@@ -740,6 +740,16 @@ public class PropertyValue implements Cloneable, Serializable
return valueType.getOrdinalNumber(); return valueType.getOrdinalNumber();
} }
/**
* If property value of the type <code>QName</code> is supported
*
* @param typeQName the type qualified name
*/
public static boolean isDataTypeSupported(QName typeQName)
{
return valueTypesByPropertyType.keySet().contains(typeQName);
}
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {

View File

@@ -31,6 +31,7 @@ import java.util.Set;
import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint; import org.alfresco.repo.dictionary.constraint.ListOfValuesConstraint;
import org.alfresco.repo.dictionary.constraint.RegisteredConstraint; import org.alfresco.repo.dictionary.constraint.RegisteredConstraint;
import org.alfresco.repo.domain.PropertyValue;
import org.alfresco.repo.forms.Field; import org.alfresco.repo.forms.Field;
import org.alfresco.repo.forms.FieldGroup; import org.alfresco.repo.forms.FieldGroup;
import org.alfresco.repo.forms.PropertyFieldDefinition; import org.alfresco.repo.forms.PropertyFieldDefinition;
@@ -166,7 +167,15 @@ public class PropertyFieldProcessor extends QNameFieldProcessor<PropertyDefiniti
PropertyDefinition propDef = data.getPropertyDefinition(name); PropertyDefinition propDef = data.getPropertyDefinition(name);
if (propDef != null) if (propDef != null)
{ {
return propDef.getDefaultValue(); QName typeQName = propDef.getDataType().getName();
String strDefaultValue = propDef.getDefaultValue();
if (PropertyValue.isDataTypeSupported(typeQName))
{
// convert to the appropriate type
PropertyValue pv = new PropertyValue(typeQName, strDefaultValue);
return pv.getValue(typeQName);
}
return strDefaultValue;
} }
return null; return null;
} }