Alfresco list constraint that can get available values from an external service

In an on-going project that I am involved in right now, we are using/extending Alfresco as a Content Management System. One of the challenges we have faced is that we have integrate it with an internal CV (Controlled Vocabulary).

CV holds the references of all domain specific entities and the relationships between them. We need the list of values from the CV to show in the user interface, there are two ways to do this.

We can completely do this integration in GUI layer, however if we do this the only place to validate the values is the GUI layer.

Instead we decided to create a generic constraint that can get it’s values from the CV and drive the front-end from the repository. Simply the GUI widget will be populated using the constraint instead of calling the service itself. This way we can do validation on both layers; GUI and repository.

It is possible to create custom constraints in Alfresco, all you have to is to implement Constraint interface and do your magic. The constraint takes parameters like; service_url, enable_caching, time_to_live, etc. I included constraint definition below to give you an idea.

<constraint name="all:colors" type="VCLIST">
    <parameter name="service_url">
        <value>http://integration.octopus.sony.com/collections/cv/lists/color</value>
    </parameter>
    <parameter name="enable_caching"><value>true</value></parameter>
    <parameter name="time_to_live"><value>1000sec</value></parameter>
 </constraint>

Since the constraint is generic, parameters are used to configure it. You can create different constraints that can hold different list-of-values.

  • service_url: Service url to call to get the list of values, constraint itself uses proper converter according to the mime type of the response. Currently it only supports XML and JSON. However it naturally expects a certain format either it is XML or JSON.
  • enable_caching: If caching is enabled the constraint stores the list of values temporarily instead of calling the service ever time.
  • time_to_live: TTL for the cache.

Read More Post

STAY CONNECTED

Most Popular

Why Serviced Apartments Are the Perfect Choice for Long-Term Stays in Singapore – Everything You Need to Know
17 Dec

Why Serviced Apartments Are the Perfect Choice for Long-Term Stays in Singapore – Everything You Need to Know

If you’re heading to Singapore for a few weeks or many months, maybe for work or study or just to

Manifesting Your Dream Career: Finding Your Passion And Purpose
01 Aug

Manifesting Your Dream Career: Finding Your Passion And Purpose

Are you passionate about finding your dream career? Manifesting can help you align your career with your passions and purpose.

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service
27 Feb

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service

Finding a reliable auto service provider is paramount in the bustling world of vehicle maintenance and repair. That's where Carolina

Floratam: The Robust Grass Solution From Council Growers SOD
25 Jan

Floratam: The Robust Grass Solution From Council Growers SOD

Floratam grass, a popular St. Augustine variety, has become a go-to choice for homeowners and landscapers seeking a lush, durable

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair
25 Jan

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair

For vehicle owners, the braking system is among the most critical components for safety and performance. Carolina Mobile Autoservice, a

Safeguarding Your Property: Expert Water Damage Services By MBC Capital
24 Jan

Safeguarding Your Property: Expert Water Damage Services By MBC Capital

Water damage can significantly impact homes and businesses, often leaving a trail of destruction and disruption in its wake. Understanding