You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Mano Swerts <m....@aca-it.be> on 2010/12/13 09:52:08 UTC

Update Multi value property using a Map

Hi all,

I am trying to update a org.apache.chemistry.opencmis.client.api.Document using the updateProperties(Map<String, ?>) method.
This works fine, except for multi value properties. They don't get updated and remain null.

It works when I use the method setPropertyMultivalue(String, List), but I don't want to use this method because It doesn't except null values.

I am working with version OpenCMIS version 0.1.0.

Thanks in advance.

Kind regards, 

Mano Swerts


_________________________________________________

 We published a new company movie featuring YOU!
         See http://www.aca-it.be/movie
_________________________________________________


Re: Update Multi value property using a Map

Posted by Mano Swerts <m....@aca-it.be>.
Hi Florian,

I will try OpenCMIS 0.2 then. I think that will solve my problem. I simplified the code in my mail and replaced a custom getter with "new Date()", but in our code the getter returns a GregorianCalendar. My mistake.

I'll let you know if this solves my problem.

Thanks.

Mano

On 13 Dec 2010, at 12:42, Florian Müller wrote:

> Hi Mano,
> 
> I have tested that with OpenCMIS 0.2 and the multi-value property update works.
> What doesn't work, however, is the single-value property update. DateTime properties have to be of type GregorianCalendar and not Date. You should get an exception.
> 
> Which Alfresco version and which binding are you using?
> 
> 
> Cheers,
> 
> Florian
> 
> 
> On 13/12/2010 11:03, Mano Swerts wrote:
>> Hi Florian,
>> 
>> Yes the property is updatable and it doesn't require a check-out. Like I 
>> stated below, it does work when using the *setPropertyMultivalue* 
>> method. I provide a List<BigInteger> to the method which does not 
>> contain null values. Other single value properties however can be null, 
>> so we'd like to use the Map approach for all properties to be consistent.
>> 
>> This is my description of the property in my alfresco model XML:
>> 
>> <propertyname="park:documentCreationDate">
>> <type>d:datetime</type>
>> </property>
>> <propertyname="park:userAssignmentStaffNumbers">
>> <type>d:int</type>
>> <multiple>true</multiple>
>> </property>
>> 
>> This is a simplified snippet from the code:
>> 
>> List<BigInteger> staffNumbers = new ArrayList<BigInteger>();
>> staffNumbers.add(new BigInteger("123"));
>> 
>> Map<String, Object> properties = new HashMap<String, Object>();
>> properties.put("park:documentCreationDate", newDate()); //Single value 
>> property works
>> properties.put("park:userAssignmentStaffNumbers", staffNumbers);
>> 
>> // works: 
>> document.setPropertyMultivalue("park:userAssignmentStaffNumbers", 
>> staffNumbers);
>> document.updateProperties(properties);
>> 
>> I hope this helps.
>> 
>> Kind regards,
>> 
>> Mano Swerts
>> 
>> 
>> On 13 Dec 2010, at 11:38, Florian Müller wrote:
>> 
>>> Hi Mano,
>>> 
>>> Could you provide a few more details?
>>> Is the property updatable? Is the document checked out? Does the type 
>>> require a check-out before update? Do you provide a List<> of 
>>> homogenous values without null values? What is the data type of the 
>>> property?
>>> 
>>> Property values are checked by OpenCMIS before they are send to the 
>>> repository. If they don't comply with the CMIS spec or don't match the 
>>> object type, OpenCMIS throws an exception. But in a few cases it drops 
>>> the value without warning.
>>> 
>>> 
>>> Cheers,
>>> 
>>> Florian
>>> 
>>> 
>>> On 13/12/2010 08:52, Mano Swerts wrote:
>>>> Hi all,
>>>> 
>>>> I am trying to update a 
>>>> org.apache.chemistry.opencmis.client.api.Document using the 
>>>> updateProperties(Map<String, ?>) method.
>>>> This works fine, except for multi value properties. They don't get 
>>>> updated and remain null.
>>>> 
>>>> It works when I use the method setPropertyMultivalue(String, List), 
>>>> but I don't want to use this method because It doesn't except null 
>>>> values.
>>>> 
>>>> I am working with version OpenCMIS version 0.1.0.
>>>> 
>>>> Thanks in advance.
>>>> 
>>>> Kind regards,
>>>> 
>>>> Mano Swerts
>>>> 
>>>> 
>>>> _________________________________________________
>>>> 
>>>> We published a new company movie featuring YOU!
>>>> See http://www.aca-it.be/movie
>>>> _________________________________________________
>>>> 
>>>> 
>> 
> 

Met vriendelijke groeten, 
Kind regards, 
Bien à vous, 

Mano Swerts
Solution Engineer
_______________________________________________________

ACA IT-Solutions

Ilgatlaan 5C                        Clovislaan 82
B-3500 Hasselt                     B-1000 Brussel
Belgium                                   Belgium

T: +32 (0)11 26 50 10          E: m.swerts@aca-it.be
F: +32 (0)11 26 50 11          U: www.aca-it.be  
M: +32 (0)484 80 81 45        
_______________________________________________________


Re: Update Multi value property using a Map

Posted by Florian Müller <fl...@alfresco.com>.
Hi Mano,

I have tested that with OpenCMIS 0.2 and the multi-value property update works.
What doesn't work, however, is the single-value property update. DateTime properties have to be of type GregorianCalendar and not Date. You should get an exception.

Which Alfresco version and which binding are you using?


Cheers,

Florian


On 13/12/2010 11:03, Mano Swerts wrote:
> Hi Florian,
> 
> Yes the property is updatable and it doesn't require a check-out. Like I 
> stated below, it does work when using the *setPropertyMultivalue* 
> method. I provide a List<BigInteger> to the method which does not 
> contain null values. Other single value properties however can be null, 
> so we'd like to use the Map approach for all properties to be consistent.
> 
> This is my description of the property in my alfresco model XML:
> 
> <propertyname="park:documentCreationDate">
> <type>d:datetime</type>
> </property>
> <propertyname="park:userAssignmentStaffNumbers">
> <type>d:int</type>
> <multiple>true</multiple>
> </property>
> 
> This is a simplified snippet from the code:
> 
> List<BigInteger> staffNumbers = new ArrayList<BigInteger>();
> staffNumbers.add(new BigInteger("123"));
> 
> Map<String, Object> properties = new HashMap<String, Object>();
> properties.put("park:documentCreationDate", newDate()); //Single value 
> property works
> properties.put("park:userAssignmentStaffNumbers", staffNumbers);
> 
> // works: 
> document.setPropertyMultivalue("park:userAssignmentStaffNumbers", 
> staffNumbers);
> document.updateProperties(properties);
> 
> I hope this helps.
> 
> Kind regards,
> 
> Mano Swerts
> 
> 
> On 13 Dec 2010, at 11:38, Florian Müller wrote:
> 
>> Hi Mano,
>>
>> Could you provide a few more details?
>> Is the property updatable? Is the document checked out? Does the type 
>> require a check-out before update? Do you provide a List<> of 
>> homogenous values without null values? What is the data type of the 
>> property?
>>
>> Property values are checked by OpenCMIS before they are send to the 
>> repository. If they don't comply with the CMIS spec or don't match the 
>> object type, OpenCMIS throws an exception. But in a few cases it drops 
>> the value without warning.
>>
>>
>> Cheers,
>>
>> Florian
>>
>>
>> On 13/12/2010 08:52, Mano Swerts wrote:
>>> Hi all,
>>>
>>> I am trying to update a 
>>> org.apache.chemistry.opencmis.client.api.Document using the 
>>> updateProperties(Map<String, ?>) method.
>>> This works fine, except for multi value properties. They don't get 
>>> updated and remain null.
>>>
>>> It works when I use the method setPropertyMultivalue(String, List), 
>>> but I don't want to use this method because It doesn't except null 
>>> values.
>>>
>>> I am working with version OpenCMIS version 0.1.0.
>>>
>>> Thanks in advance.
>>>
>>> Kind regards,
>>>
>>> Mano Swerts
>>>
>>>
>>> _________________________________________________
>>>
>>> We published a new company movie featuring YOU!
>>> See http://www.aca-it.be/movie
>>> _________________________________________________
>>>
>>>
> 


Re: Update Multi value property using a Map

Posted by Mano Swerts <m....@aca-it.be>.
Hi Florian,

Yes the property is updatable and it doesn't require a check-out. Like I stated below, it does work when using the setPropertyMultivalue method. I provide a List<BigInteger> to the method which does not contain null values. Other single value properties however can be null, so we'd like to use the Map approach for all properties to be consistent.

This is my description of the property in my alfresco model XML:

<property name="park:documentCreationDate">
	<type>d:datetime</type>
</property>
<property name="park:userAssignmentStaffNumbers">
	<type>d:int</type>
	<multiple>true</multiple>
</property>

This is a simplified snippet from the code:

List<BigInteger> staffNumbers = new ArrayList<BigInteger>();
staffNumbers.add(new BigInteger("123"));

Map<String, Object> properties = new HashMap<String, Object>();
properties.put("park:documentCreationDate", new Date()); //Single value property works
properties.put("park:userAssignmentStaffNumbers", staffNumbers);

// works: document.setPropertyMultivalue("park:userAssignmentStaffNumbers", staffNumbers);
document.updateProperties(properties);

I hope this helps.

Kind regards,

Mano Swerts


On 13 Dec 2010, at 11:38, Florian Müller wrote:

> Hi Mano,
> 
> Could you provide a few more details?
> Is the property updatable? Is the document checked out? Does the type require a check-out before update? Do you provide a List<> of homogenous values without null values? What is the data type of the property?
> 
> Property values are checked by OpenCMIS before they are send to the repository. If they don't comply with the CMIS spec or don't match the object type, OpenCMIS throws an exception. But in a few cases it drops the value without warning.
> 
> 
> Cheers,
> 
> Florian
> 
> 
> On 13/12/2010 08:52, Mano Swerts wrote:
>> Hi all,
>> 
>> I am trying to update a org.apache.chemistry.opencmis.client.api.Document using the updateProperties(Map<String, ?>) method.
>> This works fine, except for multi value properties. They don't get updated and remain null.
>> 
>> It works when I use the method setPropertyMultivalue(String, List), but I don't want to use this method because It doesn't except null values.
>> 
>> I am working with version OpenCMIS version 0.1.0.
>> 
>> Thanks in advance.
>> 
>> Kind regards,
>> 
>> Mano Swerts
>> 
>> 
>> _________________________________________________
>> 
>>  We published a new company movie featuring YOU!
>>          See http://www.aca-it.be/movie
>> _________________________________________________
>> 
>> 


Re: Update Multi value property using a Map

Posted by Florian Müller <fl...@alfresco.com>.
Hi Mano,

Could you provide a few more details?
Is the property updatable? Is the document checked out? Does the type 
require a check-out before update? Do you provide a List<> of homogenous 
values without null values? What is the data type of the property?

Property values are checked by OpenCMIS before they are send to the 
repository. If they don't comply with the CMIS spec or don't match the 
object type, OpenCMIS throws an exception. But in a few cases it drops 
the value without warning.


Cheers,

Florian


On 13/12/2010 08:52, Mano Swerts wrote:
> Hi all,
>
> I am trying to update a org.apache.chemistry.opencmis.client.api.Document using the updateProperties(Map<String, ?>) method.
> This works fine, except for multi value properties. They don't get updated and remain null.
>
> It works when I use the method setPropertyMultivalue(String, List), but I don't want to use this method because It doesn't except null values.
>
> I am working with version OpenCMIS version 0.1.0.
>
> Thanks in advance.
>
> Kind regards,
>
> Mano Swerts
>
>
> _________________________________________________
>
>   We published a new company movie featuring YOU!
>           See http://www.aca-it.be/movie
> _________________________________________________
>
>