Alfresco Records Management Custom Metadata

Adding custom metadata to a record can seem like a daunting task, but once you have a good grasp on some RM basics, it’s easily achievable. This tutorial is going to focus on adding custom record data to the dod5015 records management site. This was tested with Alfresco Records Management version 2.2.

Here is an outline of the steps we’ll be taking to make this happen:
1. Create a model
2. Load model
3. Share Configuration
4. Test

Create a Model

Let’s start by creating a model to house our metadata. The properties will be added to an aspect. By using a parent designation we can associate the aspect with Records Management allowing us to add the metadata to content we’re managing in our RM site while maintaining the policies of good record keeping.

alfresco/extension/fikaModel.xml

<?xml version="1.0" encoding="UTF-8"?>
<model name="fika:model" xmlns="http://www.alfresco.org/model/dictionary/1.0">
	<description>Tutorial Model</description>
	<author>Stan Arnold</author>
	<version>1.0</version>
	<!-- Imports are required to allow references to definitions in other models -->
	<imports>
		<!-- Import Alfresco Dictionary Definitions -->
		<import prefix="d" uri="http://www.alfresco.org/model/dictionary/1.0"/>
		<!-- Import Alfresco Content Domain Model Definitions -->
		<import prefix="cm" uri="http://www.alfresco.org/model/content/1.0"/>
		<!-- Import Alfresco Content Domain Model Definitions -->
		<import prefix="sys" uri="http://www.alfresco.org/model/system/1.0"/>
		<!-- Import Alfresco Records Management Model Definitions -->
		<import prefix="rma" uri="http://www.alfresco.org/model/recordsmanagement/1.0"/>
	</imports>
	<!-- Introduction of new namespaces defined by this model -->
	<namespaces>
		<namespace prefix="fika" uri="http://www.fikatechnologies.com/model/content/1.0"/>
	</namespaces>
	<aspects>
		<!-- New Record Metadata Set -->
		<aspect name="fika:recordData">
			<title>Fika Record Data</title>
			<!-- Required -->
			<parent>rma:recordMetaData</parent>
			<properties>
				<property name="fika:recordSource">
					<title>Record Source</title>
					<type>d:text</type>
					<multiple>false</multiple>
					<index enabled="true">
						<atomic>true</atomic>
						<stored>false</stored>
						<tokenised>both</tokenised>
					</index>
				</property>
				<property name="fika:recordContributor">
					<title>Record Contributor</title>
					<type>d:text</type>
					<multiple>false</multiple>
					<index enabled="true">
						<atomic>true</atomic>
						<stored>false</stored>
						<tokenised>both</tokenised>
					</index>
				</property>
			</properties>
			<!-- Required -->
			<mandatory-aspects>
				<aspect>rma:filePlanComponent</aspect>
			</mandatory-aspects>
		</aspect>
	</aspects>
</model>

 

If you’ve created a custom model in Alfresco before most of this probably looks familiar. Here are the key differences to look for:

We are importing the rma namespace for records management dependencies.

		<!-- Import Alfresco Records Management Model Definitions -->
		<import prefix="rma" uri="http://www.alfresco.org/model/recordsmanagement/1.0"/>

The new aspect has an rma parent type.

			<!-- Required -->
			<parent>rma:recordMetaData</parent>

We’ve added a mandatory aspect for file plan components.

			<!-- Required -->
			<mandatory-aspects>
				<aspect>rma:filePlanComponent</aspect>
			</mandatory-aspects>

 

Load model

Whether you are creating a model specifically for RM or just adding new metadata to Alfresco you will need to create a bean to load your model. This is done by created a ‘-context.xml’ file with a bean definition. We can use this file to load our metadata into the dod file plan as well.

alfresco/extension/fika-model-context.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans
  PUBLIC '-//SPRING//DTD BEAN//EN'
  'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
	<!--Registration of new models -->
	<bean depends-on="dictionaryBootstrap" id="fika.dictionaryBootstrap" parent="dictionaryModelBootstrap">
		<property name="models">
			<list>
				<value>alfresco/extension/model/fikaModel.xml</value>
			</list>
		</property>
	</bean>
	<!-- Add metadata to DOD5015 RM site -->
	<bean id="fika.recordMetadataAspectBootstrap" parent="recordMetadataAspectBootstrap">
		<property name="recordMetadataAspects">
			<map>
				<entry key="fika:recordData" value="dod:filePlan"/>
			</map>
		</property>
	</bean>
</beans>

Note <entry key=”fika:recordData” value=”dod:filePlan”/> is used to add our aspect to the dod file plan.

Share Configuration

In order to view our new changes we will need to add the fika:recordData aspect to our share configuration so that Share will know to render the aspect and its metadata fields.

First we add the aspect.

<visible>
 <!--Add our aspect -->
 <aspect name="fika:recordData"/>
</visible>

Now we set up the fields.

<!-- Fika Aspect fields -->
      <config condition="fika:recordData" evaluator="aspect">
         <forms>
            <form>
               <field-visibility>
                  <show id="fika:recordSource" set="rm-metadata-fika-recordData"/>
                  <show id="fika:recordContributor" set="rm-metadata-fika-recordData"/>
               </field-visibility>
               <appearance>
                  <set appearance="panel" id="rm-metadata-fika-recordData"/>
                  <field id="fika:recordSource" set="rm-metadata-fika-recordData"/>
                  <field id="fika:recordContributor" set="rm-metadata-fika-recordData"/>
               </appearance>
            </form>
         </forms>
      </config>

This is all done in alfresco/web-extension/share-config-custom.xml 

Once we have our aspect configured we can add a label for our new set by bootstrapping a properties file in the share war. Normally I would add the label to the share-config for the sake of brevity (and because I don’t expect the need for multi-language support), however using the ‘label=<>’ method did not seem to work for me. So here is how I managed to get my set labeled.

alfresco/web-extension/fika-model-share-context.xml

<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
    <!-- Add Fika messages -->
    <bean id="fika_resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
        <property name="resourceBundles">
            <list>
                <value>alfresco/web-extension/messages/fikaModel</value>
            </list>
        </property>
    </bean>
</beans>

 

Set the label in a properties file.

alfresco/web-extension/messages/fikaModel.properties

label.set.rm-metadata-fika-recordData=Fika Record Metadata

 

Test

We are now ready to test our new changes. Remember we added these changes to the DOD5015 site so be sure to create that specific site sub-type when creating a Records Management site.

Screen Shot 2015-04-08 at 4.18.47 PM

Add content to the file plan then run the ‘Add Record Metadata’ action.

Screen Shot 2015-04-08 at 4.21.07 PM

You should now see your custom data available.

Screen Shot 2015-04-09 at 8.48.40 AM

Files from this tutorial are available for download below. Please leave your feedback, questions, or issues in the comments below. Happy extending!

fika_alfresco_rm

4 Comments

  1. Benson says

    I would like to know what versions of Alfresco and rm you have used. I have tried to replicate your instructions on Alfresco 5.0.d and with both RM alfresco-rm-2.0.1-147 and alfresco-rm-share-2.3.c and failed spectacularly. I have also downgraded to use Alfresco 4.2 with similar problems. Specifically, Alfresco refuses to create the RM sites and in one scenario alfresco breaks down completely and is inaccessible. Specifically what versions of RM and Alfresco should i try. Thanks

    • Stan says

      This was done on Alfresco 5.0.1 using Records Management 2.3. You’ll want to check the supported version for your community version on the wiki. Without further information (logging, steps to reproduce) I’m not sure I can be of much help. If you can’t create the RM site it’s possible the amp was not properly installed.

  2. F says

    Hi, Tanks for this article. But i can’t download the example files, the link is broken. Can you fix it?

Leave a Reply

Your email address will not be published. Required fields are marked *

From our Blog...

Configuring Alfresco SAML SSO Module with Okta IdP

Alfresco recently released a new patch for their SAML Single Sign On solution module. This module allows Alfresco user’s to configure their Alfresco installation with their Single Sign On (SSO) Identity Provider. In this tutorial, I’ll explain the process of configuring Okta to be used with the module. Note: This tutorial is assuming you’ve followed… Read more »

Read More

Content Migration: Being Prepared

Much like negotiating a treaty between two countries who do not share a common language, someone will be faced with the task of translating. If that translator is not properly prepared the outcome might create more problems than it solves.

Read More

Debugging and Integration Testing in Alfresco SDK 3.0

Alfresco has updated its SDK! See our articles here and here about the basics. In its current state, SDK 3.0 doesn’t support unit testing. It does, however, have a robust Integration Testing framework which, in many ways, covers the same ground and then some. In this article I’ll be going into the basics of Integration… Read more »

Read More