Return to Builder Network Home

Getting started with Content Modeling

Content modeling is a fundamental building block of Alfresco Content Services that provides a foundation for structuring and working with content.

A content model allows you to define relevant metadata that is applied to your content which can later be used for your business requirements such as Content Rules, Search and much more.

The purpose of this tutorial is to show you some of the powerful modeling capabilities in the Alfresco Platform. To achieve this we will use a basic Contract Management solution as an example, but keep in mind that this is only an example, content models come in all shapes and sizes depending on your business requirements and use case.

At the end of this tutorial you will have created a content model for a contract which will specialize uploaded documents as contracts and add metadata depending on the type of contract.



Prerequisites

To complete this you need to have the latest Alfresco Content Services up and running. We suggest to spin up an online trial or download the 30 day trial.



Glossary

As we advance into the Alfresco platform it’s easy to lose track of all the different moving parts. Here’s a cheat sheet with the different product areas and namings we will be using moving forward:

  • ACS = Alfresco Content Services
  • ADW = Alfresco Digital Workspace
  • Share = Web application that offers some configuration and administration features


Creating your first Content Model

Now that you have ACS running, you need to log in to “Share”. If you are running an online trial the link to Share will be in the email you received along with the login credentials.

If you’re running the download trial using Docker, you can most likely access Share through http://localhost:8080/share - the default credentials are admin / admin.

Once you’re logged in click on “Admin Tools” at the top of the screen, then find “Model Manager” in the sidebar.

createModel

Now click “Create Model” and give your model a namespace: For this tutorial let’s use “http://www.example.com”. Also you have to give your Model a name and prefix, type in “Contracts” and “ct” for that.


createModelNaming

After naming your Content Model let’s fill it with a Custom Type and some Aspects.


… a quick note on Types and Aspects
A Custom Type is a set of properties every document of a specific category must have. If you think of documents as vehicles, a Custom Type could be “Car”, the properties every car has are an engine, wheels, and a steering wheel.

Aspects are also a set of properties, but are not bound to one type. To use the metaphor again: After you declared your vehicle a car it has an engine, wheels and a steering wheel. An Aspect could be “Deluxe Package”, which would add heated seats, air conditioning and memory seats. This Aspect could also be used for other Custom Types like Bus or Boat.


But let’s get back to your Content Model: Click on the name of your model, select “Create Custom Type” and give it a name and display label like this:


customType

For future reference: It is good form to use camelCase for "name".


After you created the Custom Type click on its name to display its properties, since you didn’t add any so far this site should be empty. Let’s change that. Click on “Create Property” and type in:

ctId


Click "Create and Start Another".


PropertyValue
Nameid
Display LabelID
Data TypeLong
RequirementMandatory

PropertyValue
NamedraftDate
Display LabelDraft Date
Data TypeDate
RequirementMandatory

PropertyValue
NamereviewDate
Display LabelReview Date
Data TypeDate
RequirementOptional

PropertyValue
NamedateOfApproval
Display LabelDate of Approval
Data TypeDate
RequirementOptional

PropertyValue
Namestatus
Display LabelStatus
Data TypeText
RequirementMandatory
Default ValueNew
ConstraintList of Values
List of ValuesNew
Review
Approved

Now that you have the basic properties for every contract, let’s create some more specified properties with Aspects. Head back to “Custom Types and Aspects” and click “Create Aspect”, then type the following:


aspEmp


PropertyValue
Nameemployee
Display LabelEmployee

Click “Create” and do another one.


PropertyValue
Namevendor
Display LabelVendor

Now you have two unpopulated Aspects. Hit the name of “employee” and click “Create Property” on the following screen. Then create the following Properties:


PropertyValue
Namedepartment
Display LabelDepartment
Data TypeText
RequirementMandatory
Default Value---
ConstraintList of Values
List of ValuesIT
HR
Sales
Legal

Tick “List Alphanumerically”


PropertyValue
NameemployeeMail
Display LabelEmployee Mail
Data TypeText
RequirementMandatory

PropertyValue
NameemployeeId
Display LabelEmpoyee ID
Data TypeLong
RequirementMandatory

PropertyValue
NameemployeeName
Display LabelEmployee Name
Data TypeText
RequirementMandatory
ConstraintMinimum/ Maximum Length
Minimum Length1
Maximum Length60

PropertyValue
NameisSeniorLevel
Display LabelSenior Level Employee
Data TypeBoolean
RequirementOptional
Default ValueFalse

PropertyValue
NamestartingDate
Display LabelStarting Date
Data TypeDate
RequirementMandatory
Default Value1/1/2020

Note that you could use these properties on every document concerning an employee and that is what really sets Aspects apart: their versatility.


Head back and click on “vendor” and add the following properties:


PropertyValue
NamecontactPerson
Display LabelContact Person
Data TypeText
RequirementMandatory

PropertyValue
NamecontactMail
Display LabelContact Mail
Data TypeText
RequirementMandatory

PropertyValue
Nameregion
Display LabelRegion
Data TypeText
RequirementMandatory
Default Value---
ConstraintList of Values
List of ValuesEurope
Africa
Asia
South America
North America
Australia

Tick “Sort Alphanumerically”


PropertyValue
NamevatNumber
Display LabelVAT Number
Data TypeFloat
RequirementMandatory

PropertyValue
NamevendorName
Display LabelVendor Name
Data TypeText
RequirementMandatory

Now that you have a working Model let’s give it an interface for filling out your contracts metadata. To do that go back to “Custom Types and Aspects” and open the “Actions” dropdown menu in the “contract” line, then click “Layout Designer”.


navigateLayoutDesigner


Here you can find several layout- templates at the top of the screen, just drag and drop any template you like into the “Layout Area” and fill them with the properties you created (also by drag and drop). This is how your layout could look like:


layout


If you want to rename a template just click on it and change the “Display Label” in the “Edit Properties” pop- up as shown in the screenshot above. After you have created your layout don’t forget to hit “Save”.

Do the same for “employee” and “vendor”.

Now that your Content Model is complete you can activate it by heading all the way back to “Show Content Models”, opening the “Actions” dropdown menu and clicking “Activate”:

Lastly, let’s test your newly built Model. Open the drop- down menu under “Sites” in the Top- bar and click “Create Site”. Give your site a name like “myInc” and it will be copied into the “Site ID” as well. Leave everything else as is and hit “Create”.


createSite


Now go to your “Document Library” in the top right corner and choose “Create Folder”. Call it “Contracts” and create three more folders within it called “New”, “Review” and “Approved” (Those will become more important in future tutorials). Access the “New” folder, click “Upload” and choose any document you want.


createFolder


uploadFile


Once it’s uploaded click on it to open up the document preview and choose “Change Type” on the right. In the drop down menu choose “Contract” and proceed by clicking “Manage Aspects”, again on the right side of the screen. Here you actually have a lot more options than the two Aspects you’ve already created, but ignore them for now and either click “employee” or “vendor” then hit “Apply Changes”.


changeTypeAndAddAspect


If you now go to “Edit Properties” you can fill in all the properties of the Custom Type “Contract” and your chosen Aspect as you see fit.



Summary

At this point you should have successfully created a content model, which lets you specify a document as Contract and add metadata accordingly. Also your Model is able to further narrow down the scope of your Contract by providing specific sets of properties or “Aspects”.

If you’re interested in learning more details about Content Modeling we suggest the following resources:



Next Steps

This is the first tutorial in a series of five. Checkout the tutorials below to to continue your journey:

© 2023 Alfresco Software, Inc. All Rights Reserved.