<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cancel CheckOut in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/cancel-checkout/m-p/146186#M38713</link>
    <description>&lt;P&gt;You need to use the CheckOutCheckInService.&lt;/P&gt;
&lt;P&gt;Changes are happening in a different node, named "workingCopy".&lt;/P&gt;
&lt;P&gt;Following sample perform a "checkOut" operation on the original document, apply some changes on the working copy and replicate the changes in the original document.&lt;/P&gt;
&lt;PRE&gt;var workingCopy = document.checkout();
workingCopy.content = 'updated text 1';
doc = workingCopy.checkin();&lt;/PRE&gt;
&lt;P&gt;If you want to simply cancel the "checkOut", just apply the method to the working copy.&lt;/P&gt;
&lt;PRE&gt;var workingCopy = document.checkout();
workingCopy.cancelCheckout();&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Apr 2023 07:25:03 GMT</pubDate>
    <dc:creator>angelborroy</dc:creator>
    <dc:date>2023-04-18T07:25:03Z</dc:date>
    <item>
      <title>Cancel CheckOut</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/cancel-checkout/m-p/146185#M38712</link>
      <description>&lt;P&gt;Hello Team,&lt;BR /&gt;&lt;BR /&gt;I am using Alfresco Content Service Community 7.2.&lt;BR /&gt;&lt;BR /&gt;I am checking out my node using java script api as below.&lt;BR /&gt;node.addAspect("cm:workingcopy");&lt;BR /&gt;node.properties["cm:workingCopyMode"] = "Check Out";&lt;BR /&gt;node.properties["cm:workingCopyLabel"] = label;&lt;BR /&gt;node.properties["cm:workingCopyOwner"] = user;&lt;BR /&gt;&lt;BR /&gt;I wanted to cancel my Checked Out node so I am cancelling using below code&lt;/P&gt;&lt;PRE&gt;if (node.isLocked)
&amp;nbsp;node.removeAspect("cm:lockable");&lt;BR /&gt;
if (node.hasAspect("cm:workingcopy"))
&amp;nbsp;node.removeAspect("cm:workingcopy");&lt;BR /&gt;
node.Save();&lt;/PRE&gt;&lt;P&gt;And getting error&lt;BR /&gt;&lt;STRONG&gt;java.lang.UnsupportedOperationException: Use CheckOutCheckInservice to manipulate working copies.&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;So I changed my code to&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if (node.isLocked)
&amp;nbsp;node.removeAspect("cm:lockable");&lt;BR /&gt;
if (node.hasAspect("cm:workingcopy"))
&amp;nbsp;node.&lt;STRONG&gt;&lt;I&gt;cancelCheckout()&lt;/I&gt;&lt;/STRONG&gt;;&lt;BR /&gt;
node.Save();&lt;/PRE&gt;&lt;P&gt;And now I am getting below error.&lt;BR /&gt;&lt;STRONG&gt;CheckOutCheckInServiceException: 03131029 The original node cannot be found. Perhaps the copy has been corrupted or the original has been deleted or moved.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Do anyone have idea how to solve this issue?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 10:30:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/cancel-checkout/m-p/146185#M38712</guid>
      <dc:creator>vikash_patel</dc:creator>
      <dc:date>2023-04-13T10:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Cancel CheckOut</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/cancel-checkout/m-p/146186#M38713</link>
      <description>&lt;P&gt;You need to use the CheckOutCheckInService.&lt;/P&gt;
&lt;P&gt;Changes are happening in a different node, named "workingCopy".&lt;/P&gt;
&lt;P&gt;Following sample perform a "checkOut" operation on the original document, apply some changes on the working copy and replicate the changes in the original document.&lt;/P&gt;
&lt;PRE&gt;var workingCopy = document.checkout();
workingCopy.content = 'updated text 1';
doc = workingCopy.checkin();&lt;/PRE&gt;
&lt;P&gt;If you want to simply cancel the "checkOut", just apply the method to the working copy.&lt;/P&gt;
&lt;PRE&gt;var workingCopy = document.checkout();
workingCopy.cancelCheckout();&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2023 07:25:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/cancel-checkout/m-p/146186#M38713</guid>
      <dc:creator>angelborroy</dc:creator>
      <dc:date>2023-04-18T07:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Cancel CheckOut</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/cancel-checkout/m-p/146187#M38714</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/5487"&gt;@angelborroy&lt;/A&gt;&amp;nbsp;, for your good response.&lt;BR /&gt;&lt;BR /&gt;In my case it doesn't worked so I tried using below.&lt;/P&gt;&lt;PRE&gt; var webContext = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
 var behaviourFilter = webContext.getBean("policyBehaviourFilter", org.alfresco.repo.policy.BehaviourFilter);
 behaviourFilter.disableAllBehaviours();
 nodeRef.removeAspect("cm:workingCopy");
 nodeRef.unlock();
 behaviourFilter.enableAllBehaviours(); &lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Apr 2023 11:53:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/cancel-checkout/m-p/146187#M38714</guid>
      <dc:creator>vikash_patel</dc:creator>
      <dc:date>2023-04-24T11:53:19Z</dc:date>
    </item>
  </channel>
</rss>

