cancel
Showing results for 
Search instead for 
Did you mean: 

Java code to set a complex property

marco_altieri_7
Confirmed Champ
Confirmed Champ

I have a property that can be multivalue and each value is a complex property that contains two string subproperty.

Can someone give me an example of java code to set this type of property?

1 REPLY 1

Not applicable

For example: To put "wishedValue1" and "wishedValue2" into subfields "fieldName1" and "fieldName2" of "metadataName" (in "schemaPrefix") which is complex and multivalued:

	List<Map<String, Object>> complexValuesList = new ArrayList<Map<String, Object>>();
	Map<String, Object> complexValue = new HashMap<String, Object>();
	complexValue.put("fieldName1", "wishedValue1");
	complexValue.put("fieldName2", "wishedValue2");
	complexValuesList.add(complexValue);
	customDocType.setPropertyValue("schemaPrefix:metadataName", (Serializable) complexValuesList);

You could find another example there: https://answers.nuxeo.com/general/q/c1d1279ec8b745089bcd0fd06daea3fa/How-to-programatically-populate...