AnsweredAssumed Answered

v2.1 extractor problem on Office document custom property

Question asked by col_edinburgh on Jul 4, 2011
Latest reply on Jul 4, 2011 by col_edinburgh
I am trying to get the extractor to scrape a custom property called 'customerid' from a MS Word file.
I can't get my custom extractor to work, any help would be appreciated. Here are the steps i have taken:

1. created custom aspect in 'customModel.xml file
<?xml version="1.0" encoding="UTF-8"?>

<!– Custom Model –>

<!– Note: This model is pre-configured to load at startup of the Repository.  So, all custom –>
<!–       types and aspects added here will automatically be registered –>

<model name="custom:customModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <!– Optional meta-data about the model –>
   <description>Custom Model</description>
   <author></author>
   <version>1.0</version>

   <imports>
          <!– Import Alfresco Dictionary Definitions –>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <!– Import Alfresco Content Domain Model Definitions –>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>

   <!– Introduction of new namespaces defined by this model –>
   <!– NOTE: The following namespace custom.model should be changed to reflect your own namespace –>
   <namespaces>
      <namespace uri="custom.model" prefix="custom"/>
   </namespaces>
<aspects>
<!– Definition of new Content Aspect: Customer Details –>

<aspect name="custom:CustomerDetails">
<title>Customer Details</title>
<properties>
<property name="custom:CustomerName">
<title>Customer Name</title>
<type>d:text</type>
  <protected>false</protected>
  <mandatory>false</mandatory>
  <multiple>false</multiple>
  </property>
  </properties>
  </aspect>
  </aspects>
</model>

2. added new aspect to 'web-client-config-custom.xml'
<!– Lists the custom aspect in business rules Action wizard –>
<config evaluator="string-compare" condition="Action Wizards">
<aspects>
<aspect name="custom:CustomerDetails"/>
</aspects> 
</config>
<!– Displays the properties in view details page –>
<config evaluator="aspect-name" condition="custom:CustomerDetails">
<property-sheet>
<separator name="sepCust1" display-label="Customer Details" component-generator="HeaderSeparatorGenerator" />
<show-property name="custom:CustomerName"/>
</property-sheet>
</config>
</alfresco-config>
3. added property to 'custom-metadata-extrators-context.xml'
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<!–
       This sample show how to modify the mappings properties of the new V2.1 Metadata Extractors.
       In this example, in addition to the default mappings, the field 'user1' is mapped to
       'cm:description'.  The available source properties is described on the Javadocs of the
       extracter class.
–>
<beans>
<bean id="extracter.Office" class="org.alfresco.repo.content.metadata.OfficeMetadataExtracter" parent="baseMetadataExtracter" >
<property name="inheritDefaultMapping">
<value>true</value>
</property>
<property name="mappingProperties">
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location">
<value>classpath:alfresco/extension/custom-office-document-extractor-mappings.properties</value>
</property>
</bean>
</property>
</bean>
</beans>
custom-office-document-extractor-mappings.properties
namespace.prefix.custom=custom.model
customerid=custom:CustomerName

I have added two content rules to the space: 1. add the custom aspect to all items and 2. extract common metadata field to all items

The aspect is added to the new content item but the new custom property is always blank.

Outcomes