cancel
Showing results for 
Search instead for 
Did you mean: 

How to store multi valued attribute in web services

pitti
Champ in-the-making
Champ in-the-making
How to store the multi valued properties using the namedValue class
3 REPLIES 3

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

I haven't experimented with this yet but I don't think there is way to do this.

I've raised it as a bug and we'll try to get it resolved in 1.3.  See http://www.alfresco.org/jira/browse/AR-621

Cheers,
Roy

rwetherall
Confirmed Champ
Confirmed Champ
Hi,

This has been fixed now.  The NamedValue class now has two additional properties, isMultiValue and values.  If you want to set a multi-valued property then set the isMultiValue property to true (it will be false by default) and instead of setting the value property, instead set the values property with a string array of values.

Cheers,
Roy

fbertos
Champ in-the-making
Champ in-the-making
Hi,

I've tested this code in Alfresco Web Service Client 1.3 with Alfresco 1.3 it doesn't work. In Web Service 1.2 with Alfresco 1.2 works fine:

NamedValue[] properties = new NamedValue[]{
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "textProp"), "some text"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "intProp"), "12"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "longProp"), "1234567890"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "floatProp"), "12.345"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "doubleProp"), "12.345"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "dateProp"), "2005-09-16T00:00:00.000+00:00"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "datetimeProp"), "2005-09-16T17:01:03.456+01:00"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "booleanProp"), "false"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "qnameProp"), "{http://www.alfresco.org/model/webservicetestmodel/1.0}testProperties"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "noderefProp"), "workspace://SpacesStore/123123123"),
   Utils.createNamedValue(Constants.createQNameString("http://www.alfresco.org/model/webservicetestmodel/1.0", "textMultiProp"), new String[] {"firstValue", "secondValue", "thirdValue"}),                  
};

CMLUpdate cmlUpdate = new CMLUpdate(properties, new Predicate(new Reference[]{reference}, null, null), null);
CML cml = new CML();
cml.setUpdate(new CMLUpdate[]{cmlUpdate});
repositoryService.update(cml);   
    

In Alfresco 1.3 Web Client not exists the NamedValue(String, String) constructor, but there is a NamedValue(String, boolean, String, String[]) constructor and the boolean parameter tell me if i'm going to use the third or the fourth parameter….

Is it not better two methods?, NamedValue(String, String) and NamedValue(String, String[])? I cant see the reason for that two methods…

Can anybody help me, please?

Thanks!!!
Regards, fbertos