AlfMan200
AlfMan200

Reputation: 31

Alfresco: Find associated working copy of a node

Is there a way to retrieve the Working Copy Node of a given locked node?

I am building a webscript using javascript for Alfresco.

Thank you.

Upvotes: 3

Views: 2057

Answers (2)

Bulat
Bulat

Reputation: 262

In Alfresco 4 the model has changed and cm:source property is not used for working copies anymore. Also JavaScript property isLockOwner is not there for some reason. So you can get working copy this way:

if (node.isLocked && node.properties["cm:lockOwner"] == person.properties["cm:userName"]) {
    var workingCopy = node.assocs["cm:workingcopylink"][0];
}

Upvotes: 2

Jonas Heylen
Jonas Heylen

Reputation: 534

You can recognize working copies by the cm:workingcopy aspect. They have a reference to the original document in the cm:source property.

You can use the following Lucene query:

+ASPECT:"cm:workingcopy" +@cm:source:"workspace://SpacesStore/....."

where you replace "workspace://SpacesStore/....." with the noderef of the checked out document.

Upvotes: 2

Related Questions