Defining a new metadata interceptor

Define a metadata interceptor to inject metadata into your XML content automatically from property values stored in Alfresco.

In the following steps you will be creating and/or configuring Spring beans in a Spring context file. A basic knowledge of Spring and the Spring Framework is required.

  1. Open or create a new Spring context file.
  2. Create an XPath Interceptor bean.
    1. Use an existing XML schema filter reference to specify the document types for which the interceptor applies.
    2. Use the fully-qualified name with Clark notation as the key of the entries and the XPath query as the value.
    <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>
  3. Create an Alfresco RDF property interceptor bean.
    <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>
    The Alfresco RDF property interceptor bean will have Componize listen for update events on the specified properties and react by rewriting the content if needed.
  4. Restart the application server for your changes to take effect.

Whenever a property is modified in Alfresco for a document of the specified DTD or XSD, the property value will be automatically injected into the XML content at the defined XPath location.

Note: The injection occurs asynchronously. All policies and content rules are deactivated on the node during injection.