cancel
Showing results for 
Search instead for 
Did you mean: 

Extract OpenOffice metadata to custom property

cedomir
Champ in-the-making
Champ in-the-making
Hi,

I'm trying to add custom property to document meta data and during the add content action to store the value from openoffice document custom property to it.  There is no errors but custom property remains empty. If I change custom property (my:refno) to standard one (cm:description) in extractor xml, everything works fine.

Any help will be appreciated.

Cedomir

My files are as follows

model-context.xml :
<beans>
    <bean id="extension.dictionaryBootstrap" parent="dictionaryModelBootstrap" depends-on="dictionaryBootstrap">
        <property name="models">
            <list>
                <value>alfresco/extension/mojmodel.xml</value>
            </list>
        </property>
    </bean>
</beans>

mojmodel.xml

<?xml version="1.0" encoding="UTF-8"?>

<model name="my:mynewmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Primer modela</description>
   <author>Ceda</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>

   <namespaces>
      <namespace uri="my.new.model" prefix="my"/>
   </namespaces>

   <types>
      <type name="my:predmet">
         <title>Predmet</title>
         <parent>cm:content</parent>
         <properties>
            <property name="my:refno">
               <type>d:text</type>
            </property>
         </properties>
      </type>
   </types>
</model>


custom-metadata-extractors-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>
<bean id="extracter.OpenDocument" class="org.alfresco.repo.content.metadata.OpenDocumentMetadataExtracter" parent="baseMetadataExtracter" >

        <property name="inheritDefaultMapping">
            <value>true</value>
        </property>

        <property name="mappingProperties">
            <props>
      <prop key="namespace.prefix.cm">http://www.alfresco.org/model/content/1.0</prop>
                <prop key="user1">my:refno</prop>
            </props>
        </property>
</bean>



3 REPLIES 3

dhalupa
Champ on-the-rise
Champ on-the-rise
Not sure, but I think you have to map prefix of your newly created namespace


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

<beans>
<bean id="extracter.OpenDocument" class="org.alfresco.repo.content.metadata.OpenDocumentMetadataExtracter" parent="baseMetadataExtracter" >

        <property name="inheritDefaultMapping">
            <value>true</value>
        </property>

        <property name="mappingProperties">
            <props>
               <prop key="namespace.prefix.cm">http://www.alfresco.org/model/content/1.0</prop>
               <prop key="namespace.prefix.my">my.new.model</prop>
                <prop key="user1">my:refno</prop>
            </props>
        </property>
</bean>

cedomir
Champ in-the-making
Champ in-the-making
That solved the problem, thank You very much.

Cedomir

pilerou
Champ in-the-making
Champ in-the-making
Hello,

I looked this page http://wiki.alfresco.com/wiki/Metadata_Extraction in order to manage custom properties.

I have custom metadata in my Openoffice documents.
I can see it in the meta.xml inside my odt file.

<?xml version="1.0" encoding="UTF-8" ?> 
- <office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2" grddl:transformation="http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl">
<office:meta>
  <meta:initial-creator>Pierre Le Roux</meta:initial-creator>
  <meta:creation-date>2010-10-06T17:28:46</meta:creation-date>
  <dc:date>2010-10-09T16:08:50.48</dc:date>
  <dc:creator>Pierre Le Roux</dc:creator>
  <meta:editing-duration>PT04H04M50S</meta:editing-duration>
  <meta:editing-cycles>2</meta:editing-cycles>
  <meta:generator>OpenOffice.org/3.2$Win32 OpenOffice.org_project/320m18$Build-9502</meta:generator>
  <meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="1" meta:word-count="1" meta:character-count="18" />
  <meta:user-defined meta:name="doctype" meta:value-type="float">20</meta:user-defined>
  <meta:user-defined meta:name="idctr" meta:value-type="float">45</meta:user-defined>
  <meta:user-defined meta:name="idnum" meta:value-type="float">30</meta:user-defined>
  </office:meta>
  </office:document-meta>

I would like to manage the user-defined meta data in Alfresco in order to search and organize documents in Alfresco.

I changed the content-services-context.xml in order to manage new data :


   <bean id="extracter.OpenDocument"  class="org.alfresco.repo.content.metadata.OpenDocumentMetadataExtracter"  parent="baseMetadataExtracter" >
        <property name="inheritDefaultMapping">
            <value>true</value>
        </property>
        <property name="mappingProperties">
            <props>
                <prop key="namespace.prefix.my">urn:oasis:names:tc:opendocument:xmlns:meta:1.0</prop>
                <prop key="idctr">my:idctr</prop>
                <prop key="idnum">my:idnum</prop>
                <prop key="idnumtoto">idnum</prop>
            </props>
        </property>
   </bean>

It doesn't work and i understand why. I haven't understood how to use specific metadata.

Could you tell me if i'm far or not to the result ?

Regards