<?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: How to add a dynamic facet via nuxeo-java-client? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322260#M9261</link>
    <description>&lt;P&gt;Thanks for the confirmation, Kevin. We've already copied the AddFacet operation, but I really expected the full document creation to be available as an atomic operation in the client API. If I have to do 3 or 4 call to fully create one document, and something fails in the last step (a dynamic facet's attribute validation, for instance), I will have to run undo/compensation operations manually, unless I do server-side programming. It doesn't sound OK for me, since my applications are just clients. I hope Nuxeo client API evolve. Thanks anyway.&lt;/P&gt;</description>
    <pubDate>Thu, 01 Jun 2017 19:45:20 GMT</pubDate>
    <dc:creator>Daniel_Viero</dc:creator>
    <dc:date>2017-06-01T19:45:20Z</dc:date>
    <item>
      <title>How to add a dynamic facet via nuxeo-java-client?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322256#M9257</link>
      <description>&lt;P&gt;Hi there.&lt;/P&gt;
&lt;P&gt;I'm trying to create a document with an optional (dynamic) Facet, but it's not working.
I'm using java-client 1.0 with Nuxeo 7.10 HF-24.
My code is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;Document doc = new Document(name, "MyType");
doc.set("dc:title", "Doc Title");
doc.setFacets(Arrays.asList("MyFacet"));
doc.set("myfacet:attr1", "xpto");
doc = nuxeo.repository().createDocumentByPath(parentPath, doc);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The document is created, but the facet and its attributes are not there.
How to accomplish that using Nuxeo Java Client?
I don't want that Facet to be mandatory in MyType, since it is not applicable for all document instances.&lt;/P&gt;
&lt;P&gt;Thanks in advance.
Daniel Viero.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 17:10:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322256#M9257</guid>
      <dc:creator>Daniel_Viero</dc:creator>
      <dc:date>2017-05-31T17:10:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a dynamic facet via nuxeo-java-client?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322257#M9258</link>
      <description>&lt;P&gt;Isn't the nuxeo-java-client compatible only with Nuxeo LTS 2016 and upwards ?&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 17:29:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322257#M9258</guid>
      <dc:creator>pibou_Bouvret</dc:creator>
      <dc:date>2017-05-31T17:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a dynamic facet via nuxeo-java-client?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322258#M9259</link>
      <description>&lt;P&gt;nuxeo-java-client 1.x is compatible with LTS 2015.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 17:38:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322258#M9259</guid>
      <dc:creator>Daniel_Viero</dc:creator>
      <dc:date>2017-05-31T17:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a dynamic facet via nuxeo-java-client?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322259#M9260</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;
&lt;P&gt;There's no way to add dynamically a facet on a document through REST in 7.10.&lt;/P&gt;
&lt;P&gt;The method &lt;CODE&gt;Document#setFacets&lt;/CODE&gt; is misleading and should only be used for internal client usage, like specific marshallers.&lt;/P&gt;
&lt;P&gt;You can easily create your own operation to do that, you can also copy &lt;A href="https://github.com/nuxeo/nuxeo/blob/master/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/operations/document/AddFacet.java"&gt;AddFacet&lt;/A&gt; operation and deploy it to your Nuxeo Server.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 16:27:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322259#M9260</guid>
      <dc:creator>Kevin_Leturc</dc:creator>
      <dc:date>2017-06-01T16:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a dynamic facet via nuxeo-java-client?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322260#M9261</link>
      <description>&lt;P&gt;Thanks for the confirmation, Kevin. We've already copied the AddFacet operation, but I really expected the full document creation to be available as an atomic operation in the client API. If I have to do 3 or 4 call to fully create one document, and something fails in the last step (a dynamic facet's attribute validation, for instance), I will have to run undo/compensation operations manually, unless I do server-side programming. It doesn't sound OK for me, since my applications are just clients. I hope Nuxeo client API evolve. Thanks anyway.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 19:45:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322260#M9261</guid>
      <dc:creator>Daniel_Viero</dc:creator>
      <dc:date>2017-06-01T19:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a dynamic facet via nuxeo-java-client?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322261#M9262</link>
      <description>&lt;P&gt;You can also use &lt;A href="https://doc.nuxeo.com/nxdoc/automation-chain/"&gt;automation chain&lt;/A&gt; to perform this operation atomically.&lt;/P&gt;
&lt;P&gt;For example the following chain creates a document, adds a facet and updates properties.&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt; &amp;lt;component&amp;gt; &amp;lt;extension target="org.nuxeo.ecm.core.operation.OperationServiceComponent" point="chains"&amp;gt; &amp;lt;chain id="create-doc-attach-facet"&amp;gt; &amp;lt;param type="string" name="docType" /&amp;gt; &amp;lt;param type="string" name="name" /&amp;gt; &amp;lt;param type="properties" name="properties" /&amp;gt; &amp;lt;param type="string" name="facet" /&amp;gt; &amp;lt;!-- This operation needs parent as input, we could use DocRef in java client to provide its parent --&amp;gt; &amp;lt;operation id="Document.Create"&amp;gt; &amp;lt;param type="string" name="type"&amp;gt;expr:ChainParameters['docType']&amp;lt;/param&amp;gt; &amp;lt;param type="string" name="name"&amp;gt;expr:ChainParameters['name']&amp;lt;/param&amp;gt; &amp;lt;/operation&amp;gt; &amp;lt;!-- Add facet --&amp;gt; &amp;lt;operation id="Document.AddFacet"&amp;gt; &amp;lt;param type="string" name="facet"&amp;gt;expr:ChainParameters['facet']&amp;lt;/param&amp;gt; &amp;lt;/operation&amp;gt; &amp;lt;operation id="Document.Update"&amp;gt; &amp;lt;param type="properties" name="properties"&amp;gt;expr:ChainParameters['properties']&amp;lt;/param&amp;gt; &amp;lt;/operation&amp;gt; &amp;lt;/chain&amp;gt; &amp;lt;/extension&amp;gt; &amp;lt;/component&amp;gt; &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;And then you use it with nuxeo java client:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt; public void itCanAnswer() { Document doc = nuxeoClient.automation("create-doc-attach-facet") .param("docType", "File") .param("name", "file-test") .param("properties", Collections.singletonMap("dc:description", "description for test")) .param("facet", "NotFulltextIndexable") .input(new DocRef(("/"))) .execute(); assertNotNull(doc); assertTrue(doc.getFacets().contains("NotFulltextIndexable")); assertEquals("description for test", doc.getPropertyValue("dc:description")); } &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;If something went wrong during the chain execution, the transaction is rollback.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 21:26:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322261#M9262</guid>
      <dc:creator>Kevin_Leturc</dc:creator>
      <dc:date>2017-06-01T21:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a dynamic facet via nuxeo-java-client?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322262#M9263</link>
      <description>&lt;P&gt;That looks great! I was trying to avoid server-side development, but this is a pretty generic solution. I suggest it to be incorporated as a native operation in Nuxeo, since it looks like a basic functionality to me. Thank you very much.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 18:52:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/how-to-add-a-dynamic-facet-via-nuxeo-java-client/m-p/322262#M9263</guid>
      <dc:creator>Daniel_Viero</dc:creator>
      <dc:date>2017-06-02T18:52:39Z</dc:date>
    </item>
  </channel>
</rss>

