Hi,
I am in the process of creating a document using Nuxeo. I am using the EJB
Remote API.
Following is the method that i use to do the create document.
CoreSession session = getDocumentManager();
DocumentModel ws = session.getDocument(new PathRef(
"/default-domain/workspaces/test"));
String name = "TestEJBAPI_demo3";
DocumentModel dm = new DocumentModelImpl(ws.getPathAsString(), name, "File");
dm.setProperty("dublincore", "title", name);
dm.setProperty("file", "filename", name);
File file = new File("c:/test.doc");
InputStreamSource src = new InputStreamSource(new FileInputStream(file));
StreamingBlob streamingBlob = new StreamingBlob(src,
"application/msword");
dm.setProperty("file", "content", streamingBlob);
session.createDocument(dm);
session.save();
But while executing this i am getting exceptions at each setproperty step as
mentioned below:
java.lang.NullPointerException
at org.nuxeo.runtime.api.Framework.getLocalService(Framework.java:181)
at org.nuxeo.ecm.core.schema.TypeRef.load(TypeRef.java:102)
at org.nuxeo.ecm.core.schema.TypeRef.get(TypeRef.java:74)
at
org.nuxeo.ecm.core.api.impl.DocumentModelImpl.hasSchema(DocumentModelImpl.java:707)
at
org.nuxeo.ecm.core.api.impl.DocumentModelImpl.loadDataModel(DocumentModelImpl.java:459)
at
org.nuxeo.ecm.core.api.impl.DocumentModelImpl.getDataModel(DocumentModelImpl.java:499)
at
org.nuxeo.ecm.core.api.impl.DocumentModelImpl.setProperty(DocumentModelImpl.java:697)
at
com.nuxeo.test.SampleEJB3Client.createDocument(SampleEJB3Client.java:189)
at com.nuxeo.test.SampleEJB3Client.main(SampleEJB3Client.java:175)
Also i want to know on how to add custom properties to a Document.
Thanks in advance.
Regards
Ajai G
--
Posted by "ajaiking" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread:
<http://www.nuxeo.org/discussions/thread.jspa?threadID=2599#7323>
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm