<?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: Automation service - Restore Version in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326620#M13621</link>
    <description>&lt;P&gt;There is no such operation in default Nuxeo.&lt;/P&gt;
&lt;P&gt;You could easily create one, the basic API to use is &lt;A href="http://community.nuxeo.com/api/nuxeo/release-5.5/javadoc/org/nuxeo/ecm/core/api/CoreSession.html#restoreToVersion%28org.nuxeo.ecm.core.api.DocumentRef,%20org.nuxeo.ecm.core.api.DocumentRef%29"&gt;CoreSession.restoreToVersion&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Jan 2012 12:21:28 GMT</pubDate>
    <dc:creator>Florent_Guillau</dc:creator>
    <dc:date>2012-01-12T12:21:28Z</dc:date>
    <item>
      <title>Automation service - Restore Version</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326619#M13620</link>
      <description>&lt;P&gt;Hi,
Is there an automation service allowing to restore a previous version of a document ?
By restore , i mean set an older version as the current document.&lt;/P&gt;
&lt;P&gt;If not , and i want to add an operation , could someone point me on what Nuxeo classes i will need to do so.&lt;/P&gt;
&lt;P&gt;tx
Michel&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2012 16:33:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326619#M13620</guid>
      <dc:creator>mcaissie_</dc:creator>
      <dc:date>2012-01-10T16:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: Automation service - Restore Version</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326620#M13621</link>
      <description>&lt;P&gt;There is no such operation in default Nuxeo.&lt;/P&gt;
&lt;P&gt;You could easily create one, the basic API to use is &lt;A href="http://community.nuxeo.com/api/nuxeo/release-5.5/javadoc/org/nuxeo/ecm/core/api/CoreSession.html#restoreToVersion%28org.nuxeo.ecm.core.api.DocumentRef,%20org.nuxeo.ecm.core.api.DocumentRef%29"&gt;CoreSession.restoreToVersion&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2012 12:21:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326620#M13621</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2012-01-12T12:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Automation service - Restore Version</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326621#M13622</link>
      <description>&lt;P&gt;Great it works just fine !&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;@Operation(id = RestoreDocument.ID,
    category = Constants.CAT_DOCUMENT,
    label = "RestoreDocument",
    description = "Restore the input Document version.")
public class RestoreDocument {

    public final static String ID = "Document.RestoreDocument";

    @Context
    protected CoreSession session;

    @Param(name = "versionDocumentId")
    protected String versionDocumentId;

    @OperationMethod
    public DocumentModel run(DocumentModel doc) throws Exception {
        List&amp;lt;DocumentModel&amp;gt; versions = session.getVersions(doc.getRef());
        if (versions != null) {
            for (DocumentModel version : versions) {
                if (version.getId().equals(versionDocumentId)) {
                    session.restoreToVersion(doc.getRef(), version.getRef());
                    return version;
                }
            }
        }
        throw new Exception("Version Document Id not found: " + versionDocumentId);
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jan 2012 18:59:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326621#M13622</guid>
      <dc:creator>mcaissie_</dc:creator>
      <dc:date>2012-01-12T18:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Automation service - Restore Version</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326622#M13623</link>
      <description>&lt;P&gt;I'd like to try your code! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; But I have not figured out how to add this operation and how to call it by a remote automation client.
I have read the documentation on how to "contribute an operation" (http://doc.nuxeo.com/display/NXDOC/Contributing+an+Operation) but is not clear for me where how and where add the operation... in which xml? in a jar?&lt;/P&gt;
&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2013 17:36:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326622#M13623</guid>
      <dc:creator>maumig_</dc:creator>
      <dc:date>2013-09-17T17:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Automation service - Restore Version</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326623#M13624</link>
      <description>&lt;P&gt;I'd like to try your code!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2013 17:51:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326623#M13624</guid>
      <dc:creator>maumig_</dc:creator>
      <dc:date>2013-09-17T17:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: Automation service - Restore Version</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326624#M13625</link>
      <description>&lt;P&gt;Hi, I would like to know how to do this in version 7.2?&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2015 07:35:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-service-restore-version/m-p/326624#M13625</guid>
      <dc:creator>markvincent9_</dc:creator>
      <dc:date>2015-05-14T07:35:42Z</dc:date>
    </item>
  </channel>
</rss>

