IDfFormatRecognizer gives old content type of documents

Mayur_shivs
Mayur_shivs Member
edited January 22, 2013 in Documentum #1

Hello ,

I have a method which gives content type of document

public String getContentType (String strPath){

        String format = "";

        try{

            IDfFormatRecognizer formatRec = clientX.getFormatRecognizer(idfSession, strPath, null);

            if(formatRec.getDefaultSuggestedFileFormat() != null) {

                format = formatRec.getDefaultSuggestedFileFormat();                   

            } else {

                format = "unknown";

            }

        } catch(DfException e){

            e.printStackTrace();

        }

        return format;

    }

in this case if i have a word document with extension as ".doc" it gives me content type as "msw" , instead i want latest and most appropriate

content type ,  when i have checked dm_format  by using DQL query " select distinct name from dm_format"  for doc it gives me

msw                                                          
msw12                                                        
msw12me                                                      
msw12metemplate                                              
msw12template                                                
msw14                                                        
msw14template                                                
msw3                                                         
msw6                                                         
msw6template                                                 
msw8                                                         
msw8template                                                 

list , now if i have file extension with me how can i get the " name " ie latest and most appropriate content type from documentum for

file path which i will provide

Regards

Tagged:

Comments

  • bacham2
    bacham2 Member
    edited January 22, 2013 #2

    You're asking too much of that poor old class

    I suggest you remove the formats that you don't need. Otherwise, you will need to hard-code some formats in your Java code.

  • DCTM_Guru
    DCTM_Guru Member
    edited January 22, 2013 #3

    Alternatively, if you dont want to delete the old format class (b/c they are in use), you can update the description attribute for the old format objects and NULL the value out.  Then in your DQL query, just query for the ones that have description value.

  • Mayur_shivs
    Mayur_shivs Member
    edited January 22, 2013 #4

    Hello johny ,

    I have scenario where i am getting file path from a method now from that file path or file extension , i want to retrieve

    a content type in document so by using query or dfc class other than IDfFormatRecognizer() , how can i do it

    Regards

    Mayur Mitkari

  • DCTM_Guru
    DCTM_Guru Member
    edited January 22, 2013 #5

    Like I said, you need to write your own query.  I'm guess that the IDfFormatRecognizer() class use the file extension (ie doc_extension) value to determine the format.  This is why doc->msw.