Lab 5 - Configure a metadata interceptor

During the lab, you will be defining a metadata interceptor to inject the the troubleshooting short description (ts:shortdesc) property into troubleshooting topics.

We will be using the Namespace and QName beans already configured in a previous lab.
  1. In the lab folder, create a new Spring context file named context.xml.
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    </beans>
  2. Open the context.xml file in your favorite editor.
  3. Create a new XPath Interceptor bean.
  4. Add the following properties to the XPath Interceptor bean as required:
    Property Type Mandatory Description
    xmlSchemaFilter XmlSchemaFilter Required A filter for which the bean applies.
    xpathQueries Map <QName,String> Required Map defining the XPath expressions to used for each predicate. Use a fully-qualified name with Clark notation as the key of the entry.
    <bean id="samples.interceptor.troubleshooting.xpath" parent="rdf.interceptor.xpath.abstract">
      <property name="xmlSchemaFilter" ref="samples.dtd.troubleshooting" />
      <property name="xpathQueries">
        <map>
          <entry key="{http://www.componize.com/model/samples/troubleshooting/1.0/}shortdesc" value="/tsTroubleshooting/abstract/shortdesc" />
        </map>
      </property>
    </bean>
  5. Create a new Alfresco Rdf Property Interceptor bean.
  6. Add the following properties to the Alfresco Rdf Property Interceptor bean as required:
    Property Type Mandatory Description
    property QName Required QName identifying a property. Use a fully-qualified name with Clark notation as the key of the entry.
    properties Collection <QName> Required Collection of QNames identifying properties. Use a fully-qualified name with Clark notation as the key of the entry.
    <bean id="samples.propertyInterceptor.troubleshooting" parent="alfresco.rdf.propertyInterceptor.abstract">
      <property name="property" value="{http://www.componize.com/model/samples/troubleshooting/1.0/}shortdesc" />
    </bean>
  7. Save your changes.
  8. Test your metadata interceptor with the com.componize.samples.lab05.MetadataInterceptorTest unit test.
  9. Deploy your files to the application server.
  10. Once the application server has started, connect to the Alfresco Share interface.
  11. Use the Edit Properties action on the troubleshooting-sample.dita file to modify the value of the ts:shortdesc property.
  12. Open the troubleshooting-sample.dita file in your favorite editor.
The /tsTroubleshooging/abstract/shortdesc element should have been updated with the modified value.