<?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: Java clinet blob in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/java-clinet-blob/m-p/318116#M5117</link>
    <description>&lt;P&gt;its resolved by myself.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2013 09:26:39 GMT</pubDate>
    <dc:creator>sarath_</dc:creator>
    <dc:date>2013-07-31T09:26:39Z</dc:date>
    <item>
      <title>Java clinet blob</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/java-clinet-blob/m-p/318115#M5116</link>
      <description>&lt;P&gt;I am writing a custom bulk importer by using client automation. I created new document but not able to load blobs.&lt;/P&gt;
&lt;P&gt;below is the code.&lt;/P&gt;
&lt;P&gt;import java.io.File;&lt;/P&gt;
&lt;P&gt;import org.nuxeo.ecm.automation.client.Constants;
import org.nuxeo.ecm.automation.client.Session;
import org.nuxeo.ecm.automation.client.adapters.DocumentService;
import org.nuxeo.ecm.automation.client.jaxrs.impl.HttpAutomationClient;
import org.nuxeo.ecm.automation.client.model.Document;
import org.nuxeo.ecm.automation.client.model.FileBlob;
import org.nuxeo.ecm.automation.client.model.PathRef;
import org.nuxeo.ecm.automation.client.model.PropertyMap;&lt;/P&gt;
&lt;P&gt;/**
*
*/&lt;/P&gt;
&lt;P&gt;/**&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;@author kola&lt;/LI&gt;
&lt;LI&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;*/
public class CreateDocument {&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;/**
 * @param args
 */
public static void main(String[] args) {
	HttpAutomationClient client = null;
	try{
		 client=new HttpAutomationClient("http://localhost:8080/nuxeo/site/automation");
		 Session session=client.getSession("Administrator", "Administrator");
		 System.out.println("Session : "+session);	
		 
		 String strPath="/CCM";
		 
		 PathRef pathref=new PathRef(strPath);
		 System.out.println("     "+pathref.toString());
		 
		 Document root = (Document) session.newRequest("Document.Fetch").set(
	                "value", new PathRef(strPath)).execute();
	        session.newRequest("Document.Create").setInput(root).set("type", "File").set(
	                "name", "myfile").set("properties", "dc:title=My File2").execute();

	        File file = new File("C:\\OBND_Comp2_Capability_Operation_Guide-2.1.pdf");
	        FileBlob fb = new FileBlob(file);
	        fb.setMimeType("application/pdf");
	        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(); 
		   
		
	}catch(Exception ex){
		ex.printStackTrace();
		client.shutdown();
	}

}

private static File getTheFileToUpload() {
	File file=new File("&amp;lt;doc&amp;gt;C:\\OBND_Comp2_Capability_Operation_Guide-2.1.pdf&amp;lt;/doc&amp;gt;");
	return file;
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;Not able to preview the document.
any insights appreciates.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2013 17:12:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/java-clinet-blob/m-p/318115#M5116</guid>
      <dc:creator>sarath_</dc:creator>
      <dc:date>2013-07-26T17:12:19Z</dc:date>
    </item>
    <item>
      <title>Re: Java clinet blob</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/java-clinet-blob/m-p/318116#M5117</link>
      <description>&lt;P&gt;its resolved by myself.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2013 09:26:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/java-clinet-blob/m-p/318116#M5117</guid>
      <dc:creator>sarath_</dc:creator>
      <dc:date>2013-07-31T09:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Java clinet blob</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/java-clinet-blob/m-p/318117#M5118</link>
      <description>&lt;P&gt;&lt;A href="https://app.quandora.com/object/85a1612e-327c-4c20-a320-749b8ec1ec32"&gt;sarath&lt;/A&gt;hi sarath
will you please tell how did you resolve this issue ?
Actually i am also searching for same kind of custom java code through which we can bulk import the files in to Nuxeo . Also tell me which external jars you added in the repositery ?
Reply soon please.
I have to implement this ASAP.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2016 11:43:50 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/java-clinet-blob/m-p/318117#M5118</guid>
      <dc:creator>Atul_Aggarwal</dc:creator>
      <dc:date>2016-08-05T11:43:50Z</dc:date>
    </item>
  </channel>
</rss>

