[Q&A Friday] Does Nuxeo Studio support definition of new document types?


Fri 16 November 2012 By Laurent Doguin


 Does Studio support definition of new document types? Does Studio support definition of new document types?

Hi, here's a Nuxeo Studio question for you: Does Studio support definition of new document types that extend a custom base document type defined in a custom Marketplace package? The short answer is yes, you have to use Registries. Let me give you some details.

Nuxeo Studio has a set of built-in document types, operations, events, etc. These built-in sets were created with the most common elements. Some have been updated/removed/added since then and we might have forgotten to add them. And even if we did add them, that still does not fix today's question. You need to be able to add your own and the registries are made for that. Here's the exhaustive list we currently have (Studio 2.0.8):


Nuxeo Studio registries Nuxeo Studio registries

Adding something to a registry is as simple as writing a small amount of JSON to define your new element. Let's use the Document Facets registry as an example:

[javascript]
{facets: [
{ id: "MyFirstFacet", description: "This is my first facet", },
{ id: "MySecondFacet", label: "My Second Facet", description: "This is my second facet", ["schemas_defined_for_facets"], }
]
}
[/javascript]

Don't worry, there's a JSON example for every registry.

Something else worth knowing is that Automation Operations definition can be generated automatically. All you have to do is an HTTP GET on your operation. Take the Query operation for instance, with ID Document.query. If you go to http://localhost:8080/nuxeo/site/automation/Document.Query, you'll have your JSON definition:

[javascript]
{ "category" : "Fetch",
"description" : "Perform a query on the repository. The query result will become the input for the next operation.",
"id" : "Document.Query",
"label" : "Query",
"params" : [ { "name" : "query",
"order" : 0,
"required" : true,
"type" : "string",
"values" : [ ],
"widget" : null
},
{ "name" : "language",
"order" : 0,
"required" : false,
"type" : "string",
"values" : [ "NXQL",
"CMISQL"
],
"widget" : "Option"
}
],
"requires" : null,
"signature" : [ "void",
"documents"
],
"url" : "Document.Query"
}
[/javascript]

This is actually how Nuxeo IDE exports locally defined operations to Nuxeo Studio. I'm hoping we'll get more automatic JSON generation from Nuxeo IDE in the next releases. Anyway, you can expect more integration between those two in the future.


Category: Product & Development
Tagged: Nuxeo Studio, Q&A