Changeset 4649 for TI01-discovery


Ignore:
Timestamp:
15/12/08 16:47:08 (11 years ago)
Author:
sdonegan
Message:

Updated and tested - also works for EDP results too now!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/branches/ws-Discovery2-upgrade/src/ndg/common/discovery/Utilities.java

    r4631 r4649  
    7171        } 
    7272         
     73         
     74        /** 
     75         * Returns the original format deduced from the original document filename as held in the postgres db 
     76         * (Needed for new system of matching sql xml recs to filename) 
     77         *  
     78         * @param filename - original document filename   
     79         * @return string representing the orignal format 
     80         */ 
     81        public static String getOriginalFormatFromFilename(String filename) { 
     82 
     83                String originalFormat = ""; 
     84                 
     85                // i.e. dassh.ac.uk__MDIP__MRMLN001000000EB.xml or badc.nerc.ac.uk__DIF__badc.nerc.ac.uk-DIF-dataent_12282343659427027.xml 
     86                 
     87                //get index of first "__"                
     88                Integer firstIndex = filename.indexOf("__"); 
     89                Integer secondIndex = filename.indexOf("__", firstIndex + 2); 
     90                //logger.info("firstindex = " + firstIndex.toString() + " second Index = " + secondIndex.toString()); 
     91                 
     92                //extract the format 
     93                originalFormat = filename.substring(firstIndex + 2, secondIndex); 
     94                                 
     95                return originalFormat; 
     96        } 
     97         
    7398        /** 
    7499         * Returns the closing element to be used with the regex depending on requestedFormat 
     
    94119                } 
    95120                 
    96         return closingElement; 
     121                return closingElement; 
    97122        } 
    98123         
Note: See TracChangeset for help on using the changeset viewer.