- Timestamp:
- 2006-12-01T14:23:45+13:00 (17 years ago)
- Location:
- trunk/gli/src/org/greenstone/gatherer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/CollectionManager.java
r13398 r13399 414 414 415 415 // Import default metadata sets, if any 416 for (int i = 0; metadata_sets != null && i < metadata_sets.size(); i++) {417 418 }416 // for (int i = 0; metadata_sets != null && i < metadata_sets.size(); i++) { 417 // importMetadataSet((MetadataSet) metadata_sets.get(i)); 418 // } 419 419 420 420 ProfileXMLFileManager.loadProfileXMLFile(new File(collection_directory_path + "metadata")); … … 452 452 } 453 453 454 // Always import the extracted metadata set if we didn't already455 if (MetadataSetManager.getMetadataSet(MetadataSetManager.EXTRACTED_METADATA_NAMESPACE) == null) {456 File extracted_metadata_set_file = new File(Gatherer.getGLIMetadataDirectoryPath() + MetadataSetManager.EXTRACTED_METADATA_NAMESPACE + StaticStrings.METADATA_SET_EXTENSION); 457 importMetadataSet(new MetadataSet(extracted_metadata_set_file));458 }454 // Load the default metadata sets 455 addDefaultMetadataSets(); 456 457 // Make sure we always have the extracted metadata set 458 addRequiredMetadataSets(); 459 459 460 460 collection.cdm = new CollectionDesignManager(new File(getCollectionConfigFilePath())); … … 793 793 } 794 794 } 795 catch (Exception ex ) {796 ex.printStackTrace();795 catch (Exception exception) { 796 DebugStream.printStackTrace(exception); 797 797 } 798 798 … … 860 860 } 861 861 862 boolean non_gli_collection = false;863 864 862 // Check we have actually been given a .col file. 865 863 if (!location.endsWith(".col")) { … … 895 893 896 894 // Special case of a user trying to open an old greenstone collection. 895 boolean non_gli_collection = false; 897 896 File collection_metadata_directory = new File(collection_directory, "metadata"); 898 897 if (!collection_metadata_directory.exists()) { … … 960 959 MetadataSetManager.loadMetadataSets(collection_metadata_directory); 961 960 961 // Make sure we always have the extracted metadata set 962 addRequiredMetadataSets(); 963 962 964 ProfileXMLFileManager.loadProfileXMLFile(collection_metadata_directory); 963 965 964 // If this is a non-GLI (legacy) collection, load the 965 // default metadata 966 // If this is a non-GLI (legacy) collection, load the default metadata sets 966 967 if (non_gli_collection) { 967 addDefaultMetadataSets( collection_directory);968 968 addDefaultMetadataSets(); 969 969 970 // Recurse the import folder tree, backing up the metadata.xml files before they are edited 970 971 LegacyCollectionImporter.backupMetadataXMLFiles(collection_directory); … … 1261 1262 1262 1263 /** I started giving the user the choice of using an existing meta set or creating a new one. The second option being so that they didn't have to add/merge/ignore each element, they could all be added automatically. However, I am not sure where the merge prompt gets called from, and it is not essential, so I am leaving it for now - it should be added back in and finished. [kjdon] */ 1263 private boolean addDefaultMetadataSets(File collection_dir) { 1264 1265 1264 private void addDefaultMetadataSets() 1265 { 1266 1266 // Add dublin core which is the default metadata set. The user 1267 1267 // can change this later … … 1270 1270 importMetadataSet(new MetadataSet(dc_file)); 1271 1271 } 1272 1272 } 1273 1274 1275 private void addRequiredMetadataSets() 1276 { 1273 1277 // Always import the extracted metadata set 1274 1278 File extracted_metadata_set_file = new File(Gatherer.getGLIMetadataDirectoryPath() + MetadataSetManager.EXTRACTED_METADATA_NAMESPACE + StaticStrings.METADATA_SET_EXTENSION); 1275 1279 importMetadataSet(new MetadataSet(extracted_metadata_set_file)); 1276 1277 return true;1278 1280 } 1279 1281 -
trunk/gli/src/org/greenstone/gatherer/gui/GUIManager.java
r13393 r13399 745 745 // Create the collection details prompt from new collection prompt 746 746 NewCollectionDetailsPrompt ncd_prompt = new NewCollectionDetailsPrompt(); 747 // dc metadata set is the default 748 ArrayList metadata_sets = new ArrayList(); 749 File dc_file = new File(Gatherer.getGLIMetadataDirectoryPath()+"dublin.mds"); 750 if (dc_file.exists()) { 751 metadata_sets.add(new MetadataSet(dc_file)); 752 } 747 753 748 // Create the new collection (if not cancelled) in a new thread. 754 749 if (!ncd_prompt.isCancelled()) { … … 759 754 760 755 // Create new collection. 761 Gatherer.c_man.createCollection(ncd_prompt.getDescription(), Configuration.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), ncd_prompt.getBase(), metadata_sets);756 Gatherer.c_man.createCollection(ncd_prompt.getDescription(), Configuration.getEmail(), ncd_prompt.getName(), ncd_prompt.getTitle(), ncd_prompt.getBase(), new ArrayList()); 762 757 ncd_prompt.dispose(); 763 758 }
Note:
See TracChangeset
for help on using the changeset viewer.