<?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 in Java - Following Blob Upload Example in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/automation-in-java-following-blob-upload-example/m-p/317729#M4730</link>
    <description>&lt;P&gt;By default, when you delete a document into the Nuxeo interface, you change the lifecycle state to delete =&amp;gt; the document is not deleted. Into a Folderish document you can just create one document with a given name (I don't talk about &lt;STRONG&gt;title&lt;/STRONG&gt; but the &lt;STRONG&gt;name&lt;/STRONG&gt; the one you give at the creation time).&lt;/P&gt;
&lt;P&gt;To delete definitively the document, you can do it through the UI you go to nearest workspace with the administrator account and you go to management tab &amp;gt; trash and remove it definitively.&lt;/P&gt;
&lt;P&gt;Names are used to generate the path of your document (ex: /default-domain/workspaces/....).&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;default-domain&lt;/STRONG&gt; is the name of the &lt;STRONG&gt;Default Domain&lt;/STRONG&gt; document&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;workspaces&lt;/STRONG&gt; is the name of the Workspaces document&lt;/LI&gt;
&lt;LI&gt;etc.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you create 2 documents with the same name nuxeo will automatically generate a different name during the creation time based of the wish name.&lt;/P&gt;
&lt;P&gt;So in your case if there is already a document with a name "myfile", nuxeo will create your document with a name "myfile.28374627346". Like that your document will have an unique name. In your case the best way would be to catch the document returned by this line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; Document doc = (Document) session.newRequest("Document.Create").setInput(root).set("type", "File").set(
            "name", "myfile").set("properties", "dc:title=My File").execute();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and get the name for the rest of your code or simply get the reference.&lt;/P&gt;
&lt;P&gt;Hope this will answer to you.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2012 10:08:10 GMT</pubDate>
    <dc:creator>Benjamin_Jalon1</dc:creator>
    <dc:date>2012-04-10T10:08:10Z</dc:date>
    <item>
      <title>Automation in Java - Following Blob Upload Example</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-in-java-following-blob-upload-example/m-p/317727#M4728</link>
      <description>&lt;P&gt;Hello,
I was trying to follow the upload example listed here (http://doc.nuxeo.com/display/NXDOC/Using+Nuxeo+Automation+Client) and for the life of me I can not get the file to attach. I can get the document created, but when I browse to the created document, there's no attached files.&lt;/P&gt;
&lt;P&gt;I've basically copied and pasted the code with a few modifications. I create the file using newFile method instead of the getFileToUpload method.&lt;/P&gt;
&lt;P&gt;The newFile method, I believe I grabbed from unit test and was modified as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;static File newFile(String content) throws IOException {
	            File file = File.createTempFile("automation-test-", ".xml");
	            file.deleteOnExit();
	            FileUtils.writeFile(file, content);
	            return file;
	        }

        Document root = (Document) session.newRequest("Document.Fetch").set(
                "value", "/").execute();
        session.newRequest("Document.Create").setInput(root).set("type", "File").set(
                "name", "myfile").set("properties", "dc:title=My File").execute();

        File file = newFile("&amp;lt;doc&amp;gt;mydoc&amp;lt;/doc&amp;gt;");
        FileBlob fb = new FileBlob(file);
        fb.setMimeType("text/xml");
        session.newRequest("Blob.Attach").setHeader(
                Constants.HEADER_NX_VOIDOP, "true").setInput(fb)
                .set("document", "/myfile").execute();
 
 
        // Get the file document where blob was attached
        Document doc = (Document) session.newRequest(
                "Document.Fetch").setHeader(
                Constants.HEADER_NX_SCHEMAS, "*").set("value", "/myfile").execute();
        // get the file content property
        PropertyMap map = doc.getProperties().getMap("file:content");
        // get the data URL
        String path = map.getString("data");
        System.out.println(path);
        client.shutdown();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The output of the path does returns: files/84980d28-07e1-41e6-845f-6e72128307e0?path=%2Fcontent&lt;/P&gt;
&lt;P&gt;Since I am able to retrieve file properties, does that mean the file is there? If so, how do I view it and why is not attached to the document? Am I missing something? Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2012 15:42:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-in-java-following-blob-upload-example/m-p/317727#M4728</guid>
      <dc:creator>foley_</dc:creator>
      <dc:date>2012-04-06T15:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Automation in Java - Following Blob Upload Example</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-in-java-following-blob-upload-example/m-p/317728#M4729</link>
      <description>&lt;P&gt;Update&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2012 19:34:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-in-java-following-blob-upload-example/m-p/317728#M4729</guid>
      <dc:creator>foley_</dc:creator>
      <dc:date>2012-04-09T19:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Automation in Java - Following Blob Upload Example</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-in-java-following-blob-upload-example/m-p/317729#M4730</link>
      <description>&lt;P&gt;By default, when you delete a document into the Nuxeo interface, you change the lifecycle state to delete =&amp;gt; the document is not deleted. Into a Folderish document you can just create one document with a given name (I don't talk about &lt;STRONG&gt;title&lt;/STRONG&gt; but the &lt;STRONG&gt;name&lt;/STRONG&gt; the one you give at the creation time).&lt;/P&gt;
&lt;P&gt;To delete definitively the document, you can do it through the UI you go to nearest workspace with the administrator account and you go to management tab &amp;gt; trash and remove it definitively.&lt;/P&gt;
&lt;P&gt;Names are used to generate the path of your document (ex: /default-domain/workspaces/....).&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRONG&gt;default-domain&lt;/STRONG&gt; is the name of the &lt;STRONG&gt;Default Domain&lt;/STRONG&gt; document&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;workspaces&lt;/STRONG&gt; is the name of the Workspaces document&lt;/LI&gt;
&lt;LI&gt;etc.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;If you create 2 documents with the same name nuxeo will automatically generate a different name during the creation time based of the wish name.&lt;/P&gt;
&lt;P&gt;So in your case if there is already a document with a name "myfile", nuxeo will create your document with a name "myfile.28374627346". Like that your document will have an unique name. In your case the best way would be to catch the document returned by this line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; Document doc = (Document) session.newRequest("Document.Create").setInput(root).set("type", "File").set(
            "name", "myfile").set("properties", "dc:title=My File").execute();
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and get the name for the rest of your code or simply get the reference.&lt;/P&gt;
&lt;P&gt;Hope this will answer to you.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2012 10:08:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-in-java-following-blob-upload-example/m-p/317729#M4730</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-04-10T10:08:10Z</dc:date>
    </item>
  </channel>
</rss>

