Changeset 5712
- Timestamp:
- 2003-10-23T10:48:34+13:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/msm/parsers/GreenstoneMetadataParser.java
r5589 r5712 93 93 /** Locate and import any metadata parsed by this metadata parser given the file involved and its previous incarnation. */ 94 94 public boolean process(FileNode destination, FileNode origin, boolean folder_level, boolean dummy_run) { 95 ///atherer.println("GreenstoneMetadataParser: Process " + origin + ": ");95 Gatherer.println("GreenstoneMetadataParser: Process " + origin + ": "); 96 96 int counter = 0; 97 97 dialog_cancelled = false; … … 114 114 if(possible_cfg_file.exists() && (possible_gimport_directory.exists() || possible_import_directory.exists())) { 115 115 found = true; 116 ///ystem.err.println("Found greenstone collection at " + collection_dir.getAbsolutePath());116 Gatherer.println("Found greenstone collection at " + collection_dir.getAbsolutePath()); 117 117 } 118 118 else { … … 131 131 132 132 // 2. If a collection configuration file was found, attempt to merge in any mdses and make note of those that are successfully imported (by removing reference from collect.cfg). 133 ///ystem.err.print("2");133 Gatherer.println("Merging in any metadata sets found."); 134 134 if(collect_cfg != null) { 135 135 ArrayList mdses = collect_cfg.getMetadataSets(); … … 143 143 144 144 // 3. Locate all of the metadata.xml files that may have an affect on the origin file. Make sure the metadata.xml closest to the origin files directory is last (to ensure property inheritance regarding accumulate/overwrite). 145 ///ystem.err.print("3");145 Gatherer.println("Searching for metadata.xml files"); 146 146 ArrayList search_files = new ArrayList(); 147 147 File file = origin.getFile(); … … 176 176 for(int i = 0; i < search_files.size(); i++) { 177 177 MetadataXMLFileSearch a_search = (MetadataXMLFileSearch) search_files.get(i); 178 ///ystem.err.println("Search " + a_search.file.getAbsolutePath() + " for " + (a_search.filename != null ? a_search.filename : ".*")); 178 Gatherer.println("Search " + a_search.file.getAbsolutePath() + " for " + (a_search.filename != null ? a_search.filename : ".*")); 179 Gatherer.println("Search at the " + (folder_level ? "Folder" : "Filename") + " level"); 179 180 // Retrieve the document 180 181 BasicGDMDocument document = getDocument(a_search.file); … … 193 194 search_files = null; 194 195 // Finally assign the metadata 195 ///ystem.err.println("Found " + metadata.size() + " pieces of metadata for " + destination);196 Gatherer.println("Found " + metadata.size() + " pieces of metadata for " + destination); 196 197 if(metadata.size() > 0) { 197 198 addMetadata(origin, destination, metadata, collection_dir, collect_cfg, dummy_run); … … 281 282 ///atherer.println("Assigning metadatum."); 282 283 if(metadatum != null) { 283 // 6c. Try to add metadata. If there is no matching metadata element: 284 ElementWrapper element = Gatherer.c_man.getCollection().msm.getElement(metadatum.element, true); 285 // Arg. The element returned may come from the Greenstone dls, which of course should never be involved during importing. To solve check the namespace isn't "" and if it is nullify the element. Nullify. NULLIFY, Bwuhahahaha... 286 if(element != null && element.getNamespace().equals("")) { 287 element = null; 288 } 284 ElementWrapper element = null; 285 // 6c. Try to add metadata. 286 // If we just happen to be importing files from our base collection, then we can assume that any non-namespaced elements are actually extracted metadata 287 if(Utility.isParentFolderOf(Gatherer.c_man.getCollection().getBaseCollection(), origin.getFile().getParentFile())) { 288 element = Gatherer.c_man.getCollection().msm.getElement(metadatum.element);// Perfect Match not required 289 } 290 // Typical case 291 else { 292 element = Gatherer.c_man.getCollection().msm.getElement(metadatum.element, true); // Perfect match 293 } 294 295 ///ystem.err.println("Closest match: " + element); 289 296 // 6ci. If no match exists, prompt the user to add/merge with specific metadata element. The user can also choose to ignore this metadata. 290 297 if(element == null) {
Note:
See TracChangeset
for help on using the changeset viewer.