cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to put a HashMap as property value in a node?

turgayz
Champ in-the-making
Champ in-the-making
Hi,
I want to put a HashMap in a property value, is this possible?
I am doing the following and getting an exception:

Model:

<property name="parameters">
    <title>Parameters</title>
    <type>d:any</type>
</property>
when I try to add an aspect containing this property:

Map parameterMap = new HashMap();
parameterMap.put("key1", "value1");

aspectProperties.put(Model.PROP_PARAMETERS, parameterMap );

nodeService.addAspect(spaceRef, Model.ASPECT_AN_ASPECT, aspectProperties);
I get this exception:

ERROR [util.transaction.SpringAwareUserTransaction] Transaction didn't commit
org.alfresco.service.cmr.repository.datatype.TypeConversionException: There is no conversion registered for the value:
   value class: java.util.HashMap
   to class: java.lang.String
   value: {key1=value1}
1 REPLY 1

andy
Champ on-the-rise
Champ on-the-rise
Hi

Type d:any can contain any serializable value.

For this value to be indexed there must be a way to convert this to a Collection of Strings. This would mean adding a converter.

Regards

Andy