Adding new Entries to Nuxeo Vocabulary

View: New views
3 Messages — Rating Filter:   Alert me  

Adding new Entries to Nuxeo Vocabulary

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

I would like to know if it is possible to add new entries to Nuxeo Vocabulary at execution time (not with an extension point as I have read in Nuxeo Book).

I explain better:

We have several types of documents (File) stored at Nuxeo, and I would like to add these type names to Nuxeo Vocabulary. As you can imagine the number of these type names is variable, so defining an extension point seems to be insuficient (if I'm wrong, please tell me). I have looked at vocabularyActionsBean class in  Nuxeo Code, and have tried to inject it to a test Class but I always get a null.

Any help? Is there any service or package I would have to watch for this?

Thanks in advance,
Francisco
--
Posted by "franciscogonzalez" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2985#8765>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Adding new Entries to Nuxeo Vocabulary

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you can add entry to a vocabulary in the vocabulary link at the top of the application. Did you add create=true in your component injection ?
--
Posted by "arussel" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2985#8778>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm

Re: Adding new Entries to Nuxeo Vocabulary

by jiveforums-ecm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

you can add entry to a vocabulary in the vocabulary link at the top of the application

Yes, but I wanted to do it automatically.

At last I think I have got it (I am still working on it)

I have created an extension point defining a directory which schema is "vocabulary" and which default values would be in a csv file:

*<directory name="documents_type_vocabulary">*
      *<schema>vocabulary</schema>*
      *<dataSource>java:/nxsqldirectory</dataSource>*
      *<table>documents_type_vocabulary</table>*
      *<idField>id</idField>*
      *<autoincrementIdField>false</autoincrementIdField>*
      *<dataFile>directories2/documents_type_vocabulary.csv</dataFile>*
      *<createTablePolicy>on_missing_columns</createTablePolicy>*
  *</directory>*

Then with the +org.nuxeo.ecm.directory.Session+ class and the DirectoryService Service I can access to its values and modify it:

*try{*
*org.nuxeo.ecm.directory.Session dir = null;*
*DirectoryService dirService = Framework.getLocalService(DirectoryService.class);*
* *
*dir = dirService.open("documents_type_vocabulary");*
*DocumentModel entry = dir.getEntry(docType);      --> docType is the String value of the document Type.*
* *
*if(entry!=null){    --> if not null, the entry exists. Else, the entry does not exists.*
            *..................*
*}*
*...........*

Thanks a lot
--
Posted by "franciscogonzalez" at Nuxeo Discussions <http://nuxeo.org/discussions>
View the complete thread: <http://www.nuxeo.org/discussions/thread.jspa?threadID=2985#8785>
_______________________________________________
ECM mailing list
ECM@...
http://lists.nuxeo.com/mailman/listinfo/ecm
To unsubscribe, go to http://lists.nuxeo.com/mailman/options/ecm