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.
-
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>
-
Open the
context.xml
file in your favorite editor.
-
Create a new XPath Interceptor bean.
-
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>
-
Create a new Alfresco Rdf Property Interceptor bean.
-
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>
-
Save your changes.
-
Test your metadata interceptor with the
com.componize.samples.lab05.MetadataInterceptorTest unit test.
-
Deploy your files to the application server.
-
Once the application server has started, connect to the Alfresco Share
interface.
-
Use the Edit Properties action on the
troubleshooting-sample.dita
file to modify the value of the ts:shortdesc property.
-
Open the
troubleshooting-sample.dita
file in your favorite editor.
The /tsTroubleshooging/abstract/shortdesc element should have been updated with the
modified value.