Cancel check out using original document node reference

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2009 08:34 PM
Hello everyone,
I want to perform cancelcheckout of a document in my application. But for that as I understand we need the working copy reference of the original document. But my application first searches the documents using repository service. In the search results we do not get the working copy reference from QueryResult object.
So how can I get the working copy reference using any of the web services considering that the only input I have is original node reference/id.
In the below post, http://forums.alfresco.com/en/viewtopic.php?f=27&t=16390#p54418 it is mentioned that we can manage to get the working copy ref using uuid. But how did you manage to get the uuid of the working copy ?.
Actually as per my understanding when we do a check out, in the CheckOutResult object we receive references to working copy. But not at the time of querying a node.
Any help would be highly appreciated.
Punit
I want to perform cancelcheckout of a document in my application. But for that as I understand we need the working copy reference of the original document. But my application first searches the documents using repository service. In the search results we do not get the working copy reference from QueryResult object.
So how can I get the working copy reference using any of the web services considering that the only input I have is original node reference/id.
In the below post, http://forums.alfresco.com/en/viewtopic.php?f=27&t=16390#p54418 it is mentioned that we can manage to get the working copy ref using uuid. But how did you manage to get the uuid of the working copy ?.
Actually as per my understanding when we do a check out, in the CheckOutResult object we receive references to working copy. But not at the time of querying a node.
Any help would be highly appreciated.
Punit
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-19-2009 11:42 PM
Hi Punit
I didn't get any method that returns working copy reference if file is already checkedout.
According to my application, I am craeting a folder(folder name based on request id for eg., A123) in alfresco server. If I upload a photo (for eg., car.jpeg) using photo browser, then I renamed this jpeg file like photo.jpeg and
I put this photo in the request id folder. I am uploading 5 different files for a request id.
Let me explain what I did. When I upload a document in alfresco tht time —
Case 1: If file is already checkin
1) I am adding versioning aspect to the checkin file.
2) Checkedout the checkin file and get the CheckOutResult object
3) get the Working Copy Reference from CheckOutResult object
4) write the data in working copy
5) checkin the file
Case 2: If file is already checkedout
1) If i add versioning aspect to the checkedout file, it is throwing following exception–
RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>org.alfresco.service.cmr.lock.NodeLockedException: Can not perform operation since the node (id:91fec287-e3b9-11dd-bbcd-d302f1baf9e5) is locked.</ns1:message>
That means Node is already checkedout.
2) that time I am getting the file name and extn which we have to upload. In my case, no need to get file name from alfresco because I always rename the file before uploading operation (file name depends on browse button).
Note : As per my understanding, you can't do checkout/checkin for different extn. means if you have already a file policy.doc in alfresco then you can't checkin this file by some other extn (for eg, policy.pdf)
3)Now I am creating a new file object like filename + " (Working Copy)." + extn
Note: As you noticed that when you checkedout a file (policy.pdf) that time alfresco creates a working copy (policy Working Copy.pdf)
4)Now I am searching this file name in that request id then I am getting workingCopyReference of checkedout file
5) write the data in working copy
6) checkin the file
Hope it will help.
Regards
Nishant Chauhan
I didn't get any method that returns working copy reference if file is already checkedout.
According to my application, I am craeting a folder(folder name based on request id for eg., A123) in alfresco server. If I upload a photo (for eg., car.jpeg) using photo browser, then I renamed this jpeg file like photo.jpeg and
I put this photo in the request id folder. I am uploading 5 different files for a request id.
Let me explain what I did. When I upload a document in alfresco tht time —
Case 1: If file is already checkin
1) I am adding versioning aspect to the checkin file.
2) Checkedout the checkin file and get the CheckOutResult object
3) get the Working Copy Reference from CheckOutResult object
4) write the data in working copy
5) checkin the file
Case 2: If file is already checkedout
1) If i add versioning aspect to the checkedout file, it is throwing following exception–
RepositoryFault:<ns1:errorCode>0</ns1:errorCode><ns1:message>org.alfresco.service.cmr.lock.NodeLockedException: Can not perform operation since the node (id:91fec287-e3b9-11dd-bbcd-d302f1baf9e5) is locked.</ns1:message>
That means Node is already checkedout.
2) that time I am getting the file name and extn which we have to upload. In my case, no need to get file name from alfresco because I always rename the file before uploading operation (file name depends on browse button).
Note : As per my understanding, you can't do checkout/checkin for different extn. means if you have already a file policy.doc in alfresco then you can't checkin this file by some other extn (for eg, policy.pdf)
3)Now I am creating a new file object like filename + " (Working Copy)." + extn
Note: As you noticed that when you checkedout a file (policy.pdf) that time alfresco creates a working copy (policy Working Copy.pdf)
4)Now I am searching this file name in that request id then I am getting workingCopyReference of checkedout file
5) write the data in working copy
6) checkin the file
Hope it will help.
Regards
Nishant Chauhan

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2009 03:21 AM
Thanks very much for the reply..
The applicable case to me is Case 2 and step 4 onwards..
As I understand you are suggesting to get the working copy reference using file name i.e the <file-name>(working copy) given by alfresco.
So this approach is also fine to get the working copy reference.
But i was thinking if I could get reference using some identifier then it would be better..that means instead of searching thru filename if i could search using some identifier for ex : node id then it would be better..
So I am trying to implement another approach, i will try that if it works and post the result. The solution is :
I have the node id of the original document. Now each working copy of the original document has the "source" property set to node id of the original document.
So if I do a query with criteria as source property equals the node id that i have, then this will return me the references of working copies of the original document.
the only thing is I have to get the latest relevent working copy. So i will try that out and post the result….
Thanks again for the help…
-Punit
The applicable case to me is Case 2 and step 4 onwards..
As I understand you are suggesting to get the working copy reference using file name i.e the <file-name>(working copy) given by alfresco.
So this approach is also fine to get the working copy reference.
But i was thinking if I could get reference using some identifier then it would be better..that means instead of searching thru filename if i could search using some identifier for ex : node id then it would be better..
So I am trying to implement another approach, i will try that if it works and post the result. The solution is :
I have the node id of the original document. Now each working copy of the original document has the "source" property set to node id of the original document.
So if I do a query with criteria as source property equals the node id that i have, then this will return me the references of working copies of the original document.
the only thing is I have to get the latest relevent working copy. So i will try that out and post the result….
Thanks again for the help…
-Punit

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2009 06:47 PM
The issue has got resolved.
To get a working copy reference from the original node id, put a query like below…
ASPECT:"cm:workingcopy" AND @cm\:source:"workspace://SpacesStore/f8faf091-1931-4715-b0dc-762c82504e3b"
In the above query, the node id used is the node id of the original document. This query will give the working copy reference using which we can cancel the checkout / update(re-checkin) the document.
Hope this helps
Punit
To get a working copy reference from the original node id, put a query like below…
ASPECT:"cm:workingcopy" AND @cm\:source:"workspace://SpacesStore/f8faf091-1931-4715-b0dc-762c82504e3b"
In the above query, the node id used is the node id of the original document. This query will give the working copy reference using which we can cancel the checkout / update(re-checkin) the document.
Hope this helps
Punit

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-05-2009 05:24 AM
This post helped me, thank you all.
I have a question, if no-one will mind:
Why don't I see the 'cm:workingcopy' aspect when using node browser?
I have a question, if no-one will mind:
Why don't I see the 'cm:workingcopy' aspect when using node browser?
