You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Xavi Beumala <xb...@adobe.com> on 2011/06/14 10:34:42 UTC
:import operation and versioning
Hi all,
I'm trying to use the :import operation in combination with versioning but I can't get it to run properly.
What I'm trying to achieve is submitting 2 curl :import operations. The first one creates a new object, the second one should create a new version by modifying a property:
curl -u admin:admin -F":operation=import" -F":contentType=json" -F":content={'person1':{'jcr:primaryType':'nt:unstructured','jcr:mixinTypes':['mix:versionable'], 'surname':'aaa'}}" -F":replaceProperties=true" -F":checkin=true" -F":autoCheckout=true" http://localhost:4502/content/people
curl -u admin:admin -F":operation=import" -F":contentType=json" -F":content={'person1':{'jcr:primaryType':'nt:unstructured','jcr:mixinTypes':['mix:versionable'], 'surname':'bbb'}}" -F":replaceProperties=true" -F":checkin=true" -F":autoCheckout=true" http://localhost:4502/content/people
Note that only 'surname':'aaa' and 'surname':'bbb' is changing between requests.
The first requests works as expected, creates the node and check it in. The problem resides in the second request where I receive the error " javax.jcr.version.VersionException: Unable to perform operation. Node is checked-in."
It looks like the :autoCheckout option is not being taken into consideration. I've also set to true the "Auto checkout nodes" option in the Apache Sling Post Servlet configuration.
Any hint on what I'm doing wrong or how I could get this to work?
Many thanks in advance
Xavi
Re: :import operation and versioning
Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Xavi,
On Tue, Jun 14, 2011 at 10:34 AM, Xavi Beumala <xb...@adobe.com> wrote:
> ...What I'm trying to achieve is submitting 2 curl :import operations. The first one creates a new object, the second one should create a new version by modifying a property:
>
> curl -u admin:admin -F":operation=import" -F":contentType=json" -F":content={'person1':{'jcr:primaryType':'nt:unstructured','jcr:mixinTypes':['mix:versionable'], 'surname':'aaa'}}" -F":replaceProperties=true" -F":checkin=true" -F":autoCheckout=true" http://localhost:4502/content/people
>
>
> curl -u admin:admin -F":operation=import" -F":contentType=json" -F":content={'person1':{'jcr:primaryType':'nt:unstructured','jcr:mixinTypes':['mix:versionable'], 'surname':'bbb'}}" -F":replaceProperties=true" -F":checkin=true" -F":autoCheckout=true" http://localhost:4502/content/people
>
> ...The problem resides in the second request where I receive the error " javax.jcr.version.VersionException: Unable to perform operation. Node is checked-in."
>
> It looks like the :autoCheckout option is not being taken into consideration. I've also set to true the "Auto checkout nodes" option in the Apache Sling Post Servlet configuration.
That's indeed a bug, autoCheckout is not taken into account. I've
created SLING-2108 to track it.
For now, you can use this in between those requests:
curl -u admin:admin -F":operation=checkout"
http://localhost:4502/content/people/person1
-Bertrand