- Timestamp:
- 2020-07-04T06:34:20+12:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r34235 r34246 68 68 import org.greenstone.gatherer.metadata.MetadataSetManager; 69 69 import org.greenstone.gatherer.metadata.MetadataXMLFileManager; 70 import org.greenstone.gatherer.metadata.MetadataElement; 71 import org.greenstone.gatherer.metadata.MetadataValue; 70 72 import org.greenstone.gatherer.metadata.ProfileXMLFileManager; 71 73 import org.greenstone.gatherer.remote.RemoteGreenstoneServer; … … 153 155 } 154 156 } 155 156 157 158 /** helper methods to export metadata for collection files to csv */ 159 public TreeMap<File, ArrayList> getAllAssignedMetadataForAllFiles() { 160 TreeMap<File, ArrayList> files_with_meta = new TreeMap<File, ArrayList>(); 161 162 ArrayList<File> files = listFilesInCollection(); 163 Iterator<File> i = files.iterator(); 164 165 while(i.hasNext()) { 166 File f = i.next(); 167 ArrayList file_meta = MetadataXMLFileManager.getMetadataAssignedToFile(f); 168 files_with_meta.put(f, file_meta); 169 170 // debugging display 171 System.err.println("Meta for file: " + f.getAbsolutePath()); 172 Iterator it = file_meta.iterator(); 173 while(it.hasNext()) { 174 MetadataValue meta = (MetadataValue)it.next(); 175 String metaVal = meta.getValue(); 176 MetadataElement metaEl = meta.getMetadataElement(); 177 String metaName = metaEl.getFullName(); 178 System.err.println(" field: " + metaName); 179 System.err.println(" value: " + metaVal); 180 } 181 182 } 183 184 return files_with_meta; 185 } 186 187 public ArrayList<File> listFilesInCollection() { 188 ArrayList<File> files = new ArrayList<File>(); 189 if(collection_tree_model != null) { 190 collection_tree_model.getFileListing(files); 191 } 192 return files; 193 } 194 157 195 static public void addCollectionContentsChangedListener(CollectionContentsChangedListener listener) 158 196 { … … 1307 1345 File external_metadata_set_file = external_metadata_set.getMetadataSetFile(); 1308 1346 File metadata_set_file = new File(getLoadedCollectionMetadataDirectoryPath(), external_metadata_set_file.getName()); 1347 1309 1348 // If we're using a remote Greenstone server, upload the metadata file 1310 1349 if (Gatherer.isGsdlRemote) { 1311 1350 Gatherer.remoteGreenstoneServer.uploadCollectionFile(collection.getGroupQualifiedName(false), metadata_set_file); 1312 1351 } 1313 } 1314 catch (Exception exception) { 1315 DebugStream.printStackTrace(exception); 1316 } 1352 1353 // It's not enough that the local collection's mds file in gli user location 1354 // (e.g. AppData/Roaming/Greenstone/GLI/collect/<collname>/metadata gets updated, 1355 // Need to also update local GS3's installation's gli/metadatacopy of the .mds file 1356 if (metadata_set_file.exists()) { 1357 System.err.println("@@@ Replacing: " + metadata_set_file); 1358 System.err.println("@@@ With: " + external_metadata_set_file); 1359 1360 // delete GLI's copy and replace 1361 //if(metadata_set_file.delete()) { // only if deletion was sucessful, try to replace 1362 //Gatherer.f_man.getQueue().copyFile(external_metadata_set_file, metadata_set_file, true);// true for overwrite 1363 //} 1364 1365 } 1366 } catch (Exception exception) { 1367 DebugStream.printStackTrace(exception); 1368 } 1317 1369 } 1318 1370
Note:
See TracChangeset
for help on using the changeset viewer.