03-23-2012 08:29 AM
I would to know if there is any way that nuxeo upload the files placed in a specific folder.
Thanks.
03-23-2012 09:21 AM
You can write a custom listener that runs on a timed basis. The listener scans the directory and ingests the files it finds in the directory.
For example...
// events contribution - this one runs once a day, but it could run on any schedule you need (e.g. every 5 minutes)
<schedule id="concena_directoryimport">
<eventId>importFromDirectory</eventId>
<eventCategory>default</eventCategory>
<cronExpression>0 30 6 * * ?</cronExpression>
</schedule>
// listener contribution
<listener name="concena_directoryimportlistener" async="true" postCommit="false"
class="com.concena.core.directoryimport.DirectoryImportListener" priority="165">
<event>importFromDirectory</event>
</listener>
// listener snippet
protected void handleDirectoryImportEvent(Event event) {
:
// 2. collect up files in the template import directory
// read through the specified directory and load file names into an array
File directory = null;
String[] files = null;
directory = new File(getImportDirectory());
files = directory.list(new ImportTemplateFileFilter()); // filter limits collection to Office Word and Excel templates
:
// etc. - get a CoreSession, walk through the files, create documents from files, log results, etc.
03-23-2012 09:21 AM
You can write a custom listener that runs on a timed basis. The listener scans the directory and ingests the files it finds in the directory.
For example...
// events contribution - this one runs once a day, but it could run on any schedule you need (e.g. every 5 minutes)
<schedule id="concena_directoryimport">
<eventId>importFromDirectory</eventId>
<eventCategory>default</eventCategory>
<cronExpression>0 30 6 * * ?</cronExpression>
</schedule>
// listener contribution
<listener name="concena_directoryimportlistener" async="true" postCommit="false"
class="com.concena.core.directoryimport.DirectoryImportListener" priority="165">
<event>importFromDirectory</event>
</listener>
// listener snippet
protected void handleDirectoryImportEvent(Event event) {
:
// 2. collect up files in the template import directory
// read through the specified directory and load file names into an array
File directory = null;
String[] files = null;
directory = new File(getImportDirectory());
files = directory.list(new ImportTemplateFileFilter()); // filter limits collection to Office Word and Excel templates
:
// etc. - get a CoreSession, walk through the files, create documents from files, log results, etc.
03-23-2012 10:25 AM
Thanks bruce, but I'm new in Nuxeo and I'm really lost. I will look at listeners documentation because I don't know where to start.
03-24-2012 08:43 AM
Hi,
Laurent Doguin from Nuxeo recently posted an article about it on the Nuxeo blog, here is a link to it : http://dev.blogs.nuxeo.com/2012/03/monday-dev-heaven-multithreaded-transactional-documents-import-nu...
Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.