cancel
Showing results for 
Search instead for 
Did you mean: 

Check-in; adding versionable aspect

lista
Star Contributor
Star Contributor
Hi all,

I'm trying to use the Check in/Check out API to do just that.
My problem appears once I try to add the versionable aspect to the node I'm checking out, so that the versioning works once I check the node back in.

//Add versionable aspect in order for check-in history to work                    targetNode.addAspect("cm:versionable");          targetNode.save();                    var workingCopyNode = targetNode.checkout();‍‍‍‍‍‍

Problem is that adding aspect locks the node, and that stops me from checking it out.

I'm not sure how to go around this problem, and any help is appreciated. Smiley Happy
5 REPLIES 5

lista
Star Contributor
Star Contributor
I still haven't been able to solve this.

This is the error I'm getting:

Message:   Failed to execute transaction-level behaviour public abstract void org.alfresco.repo.node.NodeServicePolicies$OnAddAspectPolicy.onAddAspect(org.alfresco.service.cmr.repository.NodeRef,org.alfresco.service.namespace.QName) in transaction e550bfe8-1057-49ae-b771-220b61915098    Exception:   org.alfresco.service.cmr.lock.NodeLockedException - Can not perform operation since the node (id:b3ed0a6a-4e84-4cbe-97a3-f0311b93c0b2) is locked.‍‍‍‍

There one more thing, too: I get undefined response when calling .isLocked or .hasLockAccess.

Thanks Smiley Happy

lista
Star Contributor
Star Contributor
This problem happened because a web script is processing the code inside a transaction.
Adding this piece of code to the web script descriptor will take care of the issue:

<transaction>none</transaction>‍

I don't know how I haven't seen this before.
Hopefully, this will be of a help to someone else.

Cheers!

alfsynch
Champ in-the-making
Champ in-the-making
Hi All,

I got the same problem.

Where are we supposed (file..)to put the <transaction>none</transaction>

Thanks in advance for a reply

Regards

Stéf

rogier_oudshoor
Champ in-the-making
Champ in-the-making
In your webscript's .desc.xml

lista
Star Contributor
Star Contributor
Just keep in my that the transaction was set to required in the first place for a reason, and always take care of what you're doing.
In case you didn't know, once you set the authentication to user, transaction is set to required by default, without you specifying so. If the authentication is set to none, then the transaction is set to none by default too.