At this first step, we will create a new document type called
documentationItem. This documentation item will be the main document type we will be using in our project.
We recommend you first take a look at the Repository Concepts page if you are not yet familiar with the Nuxeo Platform.
As stated in the introduction of the project, the goal is to manage all kinds of documents like procedures or notices. We will use one document type called
documentationItem. And we will use the Nature metadata to differentiate the different kinds of documentation items. See the page Several Document Types vs One Document Type with a Nature Metadata for more information.
To create the documentationItem document type:
- In Nuxeo Studio, go in Content Model > Document Types.
- Click on New.
- Type a feature ID (i.e. the document type name in Studio):
- Choose what document type it extends. Here we need to have something holding a binary file with metadata, life cycle, version and validation. This is very similar to the "File" document type. So let's extend this one to have the same facets and schemas (it is still possible to add new schemas later).
- Type a label for the end user in the Nuxeo Platform:
Technical documentation item.
- Click on Next.
documentationItemdocument type is created.
- Click on the Save button.
Check your changes on the Nuxeo Platform:
- Go to your Nuxeo Platform and deploy your project.
- On the Nuxeo Platform interface, go in a workspace and click on New.
You should see "Technical Document item" in the Miscellaneous category.
The new document type is created, it is now time to customize it.
Let's define some properties of the
- In Studio go back on the
- Select the category Document. The category is where the document type will be shown in the Nuxeo Platform UI when a user clicks on the New button. Default is Miscellaneous, but Document is a good idea in this case.
- Choose icons.
- Leave the default life cycle for now. We will change it later.
- Container type are the spaces in which the document can be created. For now Folder and Workspace are fine.
- Take a look at the facets. The ones we are interested in are already selected and grayed out: versionable, can be published. This is because the
DocumentationIteminherits the File doc type facets.
- Leave the inherited schemas for now, we will come back to it later
- Click on Save.
The documentation item is now available in the correct category and it has some icons. But it does not hold the needed informations (process, nature, binary...).
To be able to describe and find the document, the following metadata should be available on the document:
- A nature: a simple and limited list of choices
- A process: a two level list of choices. Since there can be many processes we will group them by category.
- The usual descriptive information (title, description, creation date, creator...)
- A binary file (Word, PDF...): the attachment that will be the actual content. On the Nuxeo Platform, binary files are "just another metadata" with a specific type (blob).
In the Nuxeo Platform metadata are always grouped by schemas. A schema is a set of metadata that make sense together. A document very often has several schemas of metadata. In Studio, look at the bottom of the Definition tab: there are already several inherited schemas. Once again, this is because
uidare schemas used by the system.
fileis a schema defined to hold a binary file. This exactly what we need.
filesenables to hold other binaries (like attached files). This could be useful for the annexes of the
dublincoreis a standard schema that holds descriptive information like title, creator... One of them is "nature" which is perfect for our needs. There is no need to redefine a nature metadata as it is already available.
In the end the only metadata that is not already available is the "process". So let's create a new metadata in Studio.
In Studio, each document type has its own dedicated schema. It can be found in the Schema tab, next to the Definition tab. The "process" metadata can be a generic metadata in a technical documentation management app. So let's create a generic schema in the Schemas item on the menu of Nuxeo Studio.
- Click on Content Model > Schemas.
- Click on the New button.
- Name the schema
qualityas processes are often managed by quality departments. The idea here to have a schema that could have several metadata of the same domain.
- Choose a shorter name for the prefix:
- Click on Next to validate the schema creation. The schema is created. It is empty for now.
Now you add this new schema to the
DocumentationItem document type:
- Go back to the Definition tab of the document type.
- Scroll down to the bottom of the tab.
- Expend Add extra schemas to this document type.
- In the left list select the
- Add it to the right list.
- Click on Save. The schema is now available on the document type. So every metadata added to the schema will automatically be added to the document.
- In Studio, go to the
- Add a new field and name it
- Select the String type.
- A document is only related to one process, so we do not check Multi-Valued.
- Click on Save.
Nuxeo makes a difference between the content model (what are the document types and metadata?) and the user interface. The metadata is available on the document but we haven't defined how to fill in this metadata.
Metadata are displayed in form layouts. A form layout can be generic and reused by several documents or it can be specific to a document type. In our example, we will change the specific layouts of our document type.
- Go on the
DocumentationItemdefinition. Four layout tabs are available. Each layout corresponds to a way to access the document: creation, view, edition. You can then control what can be seen and modified. The header layout is what you see on the top of the document. We will leave it empty, and it will take the default layout that displays the title of the document.
- Click on the Creation Layout tab. You can see that the layout is already filled with a minimum set of metadata.
- Click on the icon of the WARNING row and confirm deletion.
- Select the
qualityschema in the right drop down list.
- Drag the
processmetadata from the list and drop it on a row of the layout. The widget edition pop-up displays several options for the widget you just dropped.
- Leave the default values for now, and click on Save.
- Click on the Add Row button to add two new rows to the layout.
- In the
dublincoreschema, drag and drop the
Naturemetadata on a row and save default values.
- In the
fileschema, drag and drop the
contentmetadata and save default values. In the end you should have a creation layout looking like:
If we look back at what we wanted on the document, we have all the information we wanted but not how we wanted them. Nature and Process should be lists of choices and not simple text boxes.
In the Nuxeo Platform lists of choices are called vocabularies. A specific section is available in Studio for them.
- In Studio, go in the Vocabularies section.
- Create a new vocabulary: call it it
qualNat, and select Simple Vocabulary.
- Add a few entries (ids are for the system, labels will be displayed to the final user).
In the end, you should have something like:
- Create a new vocabulary: call it
procQualand select the type Hierarchical Vocabulary. We need a two-level vocabulary as they are processes and sub-processes.
- By default, you already have two levels. You can add several roots (processes) and children for each roots (sub-subprocesses).
In the end, you can have something like that (please note that these are dummy processes):
Now that you have the two vocabularies, you still have to bind them to the metadata so that the user can select them. This is where we will customize each metadata widget in the creation layout from a simple text to list of choices.
- Go back to the creation layout of
- Edit the
Naturemetadata widget by clicking on the icon .
- In the Layout Widget Editor, select the widget type Vocabulary.
- In the Edit properties part, select the vocabulary
- You can make the nature field required if you want to by selecting Yes in the Required drop down list.
- Click on Save.
- Edit the
- In the Layout Widget Editor, select the widget type Chained vocabulary.
- Select the vocabulary
- Click on Save. The Creation Layout is now fully configured.
- Click on the View Layout tab, and click on Import Layout > Import 'create' layout.
It imports what you did on the creation layout, so that you are able to see on the Summary tab the metadata of your document.
- Do the same thing on the Edit Layout tab.
- Click on Save.
- Redeploy your customization the server.
- Create a new Technical Documentation Item.
You should see:
To sum up, what we saw:
- A document type can have metadata of several types (String, Integer...).
- Metadata are grouped in schemas. Of course, one document can have several schemas.
- The content model is different from the user interface. When you add a metadata to a document (through its schemas), you have to add the metadata in the layouts of the document.
- You can control how the metadata are filled in directly from the layouts of the document by changing the widget type.
The next step is to adapt where the documents are created and how they are displayed when browsing.