cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Extractor problem

nabilblk
Champ in-the-making
Champ in-the-making
Hi every body  ,

I have some problem with my custom extractor :
This is my code :

One class MyExtracter :


public class MyExtracter extends AbstractMappingMetadataExtracter {

   private static final String KEY_CUSTOM = "N_CMDE";
      
   public static String[] SUPPORTED_MIMETYPES = new String[] {
         MimetypeMap.MIMETYPE_TEXT_PLAIN
        };

    
  
   public BWTExtracter() {
       super(new HashSet<String>(Arrays.asList(SUPPORTED_MIMETYPES)));
   }

@Override
protected Map<String, Serializable> extractRaw(ContentReader reader)
      throws Throwable {
      Map<String, Serializable> rawProperties = newRawMap();
                   InputStream in=reader.getContentInputStream();     
      String myString = IOUtils.toString(in, "UTF-8");
                   putRawValue(KEY_CUSTOM, myString, rawProperties);
                   in.close();
      
       return rawProperties;
}
}
My properties file :


# Namespaces
namespace.prefix.company=http://www.company.com/model/content/1.0
# Mappings
N_CMDE=company:N_CMDE

Change the <WEB-INF>/classes/alfresco/content-services-context.xml file :


<bean id="fr.company.MyExtracter"
class="fr.company.MyExtracter"
parent="baseMetadataExtracter" />


when i run this and add a custom content that correspond this extraction , the method extractRaw are executed (I verify this with a debugger from eclipse) and the method return a Map with the custom properties and here value .


But the value of custom property in the screen is always blanc ..

Do you have any idea ??

Thanks
3 REPLIES 3

nabilblk
Champ in-the-making
Champ in-the-making
More information :

the rawProperties Object containt  :

(java.util.HashMap<K,V>) {N_CMDE=PVBDBDB}

nabilblk
Champ in-the-making
Champ in-the-making
I add a logger  :


log4j.logger.org.alfresco.repo.content.metadata=DEBUG

and there is no error :


   extracter: fr.company.MyExtracter@1c7aa1d
14:15:01,588 User:admin DEBUG [content.metadata.AbstractMappingMetadataExtracter
] Converted extracted raw values to system values:
   Raw Properties:    {N_CMDE=PVBDBDB, author=Nabil Belakbir}
   System Properties: {{http://www.company.com/model/content/1.0}N_CMDE=PVBDBDB, {htt
p://www.alfresco.org/model/content/1.0}author=Nabil Belakbir}
14:15:01,590 User:admin DEBUG [content.metadata.AbstractMappingMetadataExtracter
] Completed metadata extraction:
   reader:    ContentAccessor[ contentUrl=store://C:\Projects\AlfrescoPlatform\t
omcat\temp\Alfresco\alfresco38822.upload, mimetype=text/plain, size=7, encoding=
UTF-8, locale=en_US]
   extracter: fr.company.BWTExtracter@1c7aa1d
   changed:   {{http://www.company.com/model/content/1.0}N_CMDE=HAHAHA, {http://www.
alfresco.org/model/content/1.0}author=Nabil Belakbir}

But in this example i add in my class one test line just for testing properties of document of type : cm:content:


        putRawValue(KEY_AUTHOR, "Nabil Belakbir", rawProperties);

And the result is :

Autor = Nabil Belakbir
N_CMDE =

My property is always blanc in the web client after extraction …

please can you help ???

nabilblk
Champ in-the-making
Champ in-the-making
No one can help ??