Nuxeo/Blogs

Industry Insight, Product & Development, Updates.

Archive for the ‘Friday Q&A’ tag

[Q&A Thursday] Configuring Automatic Video Conversions on The Nuxeo Platform

without comments

Today we have a question from Hugues. He asks how to have automatic video conversion based on a pre-defined transcoding profile.

Right now when you upload a video to Nuxeo, it’s converted first to MP4 with a maximum height of 480, then to WebM with the same height. It’s automatic, you don’t have to click on anything. You just have to create a Video document. On the summary tab you will also see a button to convert the video to OGG format with a maximum height of 480.

This is the default behavior and as usual it’s configurable through extension points. If you go on the Nuxeo Platform Explorer and type ‘video’ in the filter, you’ll be left with two extension points: automaticVideoConversions and videoConversions.

First, let’s talk about videoConversions. It defines all the conversions available on the summary tab of a document. The default contribution looks …

Written by

March 20th, 2014 at 11:32 am

[Q&A Friday] How to Write a JSF Validator for a Nuxeo Studio Widget Field

without comments

Here’s a question from zod who asks how to write a custom validator method.

The first thing to know before we proceed further is that a Nuxeo Studio widget is rendered using JSF. So the question is how to write a JSF validator. And since we are using the SEAM Framework to leverage JSF, the complete question is how to write a JSF/SEAM validator.

Let’s take a simple example. I created a String field called email. I want to make sure that this field is filled correctly. For the purpose of this blog I will only check if the email address has an ‘@‘ character.

Let’s write a Java class that has a validation method and is a SEAM component:

As you can see, the SEAM component is named businessValidatorSample and the validation method, validateEmail. This means that in Nuxeo Studio, during the widget configuration, we’ll …

Written by

March 7th, 2014 at 11:26 am

[Q&A Friday] How to Manage Users with the REST API

without comments

Today we have a question from Christian who asks how to create a user using the REST API. Using this API, you’ll have access to several resources endpoints (document, user, group, automation) as well as several adapters (children, search, page provider, ACL, audit, business objects..).

So here’s how to use the user endpoint.

Get a User

If I want to get information about a particular user, I can simply go to the following URL: http://localhost:8080/nuxeo/api/v1/user/ldoguin

This will return a JSON answer looking like this:

Take a close look at the object returned, it’s important for what’s coming next. What’s interesting here is the entity-type property set to user.

Create a User

To create a new user, you have to send a POST request with the following data to this URL:

http://localhost:8080/nuxeo/api/v1/user/

Using curl, it would look like this:

curl -X POST -H "Content-Type: application/json" -u Administrator:Administrator -d "{

Written by

February 28th, 2014 at 11:30 am

[Q&A Friday] How to Send Multiple Document Links in an Automation Notification Email

without comments

Today we have a question from nicoespinoza who asks how to send selected multiple document links from an email notification template. When you use the Send E-Mail operation, it will send an email for each document given as input. So if you want to send only one email containing several document links, you can’t give all the selected documents as input. So the first thing to do here is put your selected documents in a context variable and give only one document as input to the Send E-Mail operation. Here’s how I did it:

I use the Fetch Document operation with the ‘/’ parameter to have only one document as the input of the Send E-Mail operation. The ‘/’ parameter identifies the root document of your repository.

Operation Chain

The next question would be how to get the document links in the email template. A very simple email template displaying only …

Written by

February 14th, 2014 at 11:30 am

[Q&A Friday] How to Download Files Attached to Documents Using the REST API

without comments

Today we have a question from Christian who asks how to read document files using the REST API. This is the perfect question considering that last week I answered how to actually upload them. Antoine started by answering something very practical: use the Nuxeo download URL. Which I will now translate for you.

Urls have to be in the following form:

http://<server>:<port>/nuxeo/nxbigfile/default/<doc_id>/files:files/<file_index>/file/<file_name>

Which would, for instance, give something like

http://my.server.com:8080/nuxeo/nxbigfile/default/b54c8b41-86c9-4c9b-bfe0-e6b1ca01313f/files:files/1/file/NUXEO_User%20stories.pdf

Note that here we use nxbigfile instead of nxfile (classically used from the webapp) because it’s more efficient on big files download. Beware, the index of the first file is 1, second is 2, etc…

But this is not the only solution available. As usual there are many.

You can still use the REST API and the operation adapter. First you need to get the Document URL. It could be something like http://localhost:8080/nuxeo/api/v1/id/5c911f4d-4627-4587-9ead-9b0cd1bc3dbc/. When you have a …

Written by

February 7th, 2014 at 10:59 am

Posted in Product & Development

Tagged with , ,

[Q&A Friday] How to Remove Tabs, Buttons, Links Under a Specific Path

without comments

Today we have a question from guian who asks how to remove the notification tab in the administration panel for each folder inside: /default-domain/workspaces/myWorkspace/aSpecialFolder/.

To answer that question, the first thing you need to know is that a tab is what we call an Action. An action can also be a link (a tab is basically a link styled as a tab) or a button, anything clickable in fact. And as stated in the documentation, you can filter theses actions. Take a look at the filter extension point in Nuxeo Explorer. As you can see there are several ways to filter actions.

Let’s say that the documents where we want to hide the notification tabs are all of a special document type. We could add a filter like this:

The action associated with this filter would not be displayed if the current document type was SpecialDocType. …

Written by

November 29th, 2013 at 12:02 pm

[Q&A Friday] How to Create a Nuxeo Studio Defined Document on File Drag and Drop

without comments

Today we have a question from carlosrg and vjoussot who ask how to use a document type defined in Studio when a file is dragged and dropped in Nuxeo. A classic approach would be to override the classic Document Type like File, Picture, Audio or Video. But what happens when you want to keep the original document type? Well, you have to modify the way files are imported on drag and drop.

And the cool thing about this answer is that it comes from brian, another active community member. Here’s what he has to say:

Say you have document types SampleCustomPicture, CustomVideo, and CustomAudio — under “Projects>Advanced Settings>XML Extensions” do “+New” and create an extension with this content:

https://gist.github.com/tingletech/7574407

Kudos to Brian for providing the answer. Now how does it work? Well, when you drag and drop a file in Nuxeo, the plugins extension point is used. It …

Written by

November 22nd, 2013 at 1:25 pm

[Q&A Friday] How to get logger from within a MVEL script in Nuxeo Studio?

without comments

Today we have a question from regular Nuxeo Answers user Antoine. He asks how to get logger from within a MVEL script in Nuxeo Studio.

If you are not familiar with MVEL, it’s the script language that we use in Studio. It gives a lot of flexibility when writing operation chains.

When writing those scripts, you have access to certain variables:

  • CurrentDate: wrapper for a Calendar instance
  • Context: the operation context
  • This: the operation input
  • Session: the CoreSession
  • CurrentUser: Principal wrapper around the user running the chain
  • currentUser: CurrentUser alias
  • Env: the Framework properties
  • Fn: wrapper to the CoreFunctions class
  • Document only if the input is a document, wrap the input in a DocumentWrapper
  • CurrentDocument: alias to Document
  • Documents: only if the input is a list of documents if, wrap them in a DocumentWrapper.
  • WorkflowVariables: Available only in a workflow context
  • NodeVariables: available only in a workflow

Written by

November 15th, 2013 at 3:33 pm

[Q&A Friday] How to Add JavaScript or CSS Resources to Your Pages

without comments

Today we have a question from jvinai who asks how he can add jQuery UI resources into his project.

To do this you need to know a little bit about the theme engine:

The theme is in charge of the global layout or structure of a page (composition of the header, footer, left menu, main area…), as well as its branding or styling using CSS. It also handles additional resources like JavaScript and CSS files.

As usual, this works with extension points. The first thing to do is declare your resource. It can be a CSS or a JavaScript file.

The next step is to state where you want your resource to be loaded. You need to choose the fragment where you want to have it (a page is made of fragments). If you want it to be loaded in every page, I would suggest you put your resource …

Written by

October 25th, 2013 at 1:46 pm

[Q&A Friday] How to Retrieve a Video Storyboard Through the REST API

with one comment

Today we have a question from maumig who asks if there is a way to get a video storyboard through Client Automation or REST API. And as you know the focus on our latest release has been on the REST API. So I’m going to answer today’s question using some of the new features we’ve introduced in this release.

So the first thing I want to show you is how to get a document. We’ve added a bunch of endpoints for resources like document, group, user, operation, and directory, so if you want to retrieve a document, you can either use its ID or path:


GET /nuxeo/api/id/{idOfTheDoc}
GET /nuxeo/api/path/{pathOfTheDoc}

This will return a JSON object looking like this:

As you can see we have no information concerning the storyboard. But we do have an empty contextParameters object. It can be filled with other objects using a new extension point:

The …

Written by

September 27th, 2013 at 10:15 am