Changeset 22361

Show
Ignore:
Timestamp:
07.07.2010 11:42:20 (10 years ago)
Author:
kjdon
Message:

handle collect groups when making the list of collections to export

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/gui/WriteCDImagePrompt.java

    r20924 r22361  
    440440    // Start at the collect dir. 
    441441    File collect_directory = new File(Gatherer.getCollectDirectoryPath()); 
    442     String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE; 
    443442    if (collect_directory.exists()) { 
    444         // Now for each child directory see if it contains a .col file and 
    445         // if so try to load it.. 
    446         File collections[] = collect_directory.listFiles(); 
    447         ArrayTools.sort(collections); 
    448         for(int i = 0; collections != null && i < collections.length; i++) { 
    449         if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) { 
    450             File config_file = new File(collections[i], file_name); 
    451             if (config_file.exists()) { 
    452             BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 
    453             all_collections.add(config);                 
    454             config = null; 
    455             } 
    456         } 
    457         } 
    458     } 
    459     // Otherwise the collect directory doesn't actually exist, so there ain't much we can do. 
    460     } 
     443      scanForCollectionsInternal(collect_directory); 
     444    } 
     445    } 
     446 
     447  private void scanForCollectionsInternal(File collect_directory) { 
     448     
     449    String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE; 
     450    // For each child directory see if it contains a .cfg file and 
     451    // if so try to load it.. 
     452    File collections[] = collect_directory.listFiles(); 
     453    ArrayTools.sort(collections); 
     454    for(int i = 0; collections != null && i < collections.length; i++) { 
     455      if(collections[i].isDirectory() && !collections[i].getName().equals(StaticStrings.MODEL_COLLECTION_NAME)) { 
     456    File config_file = new File(collections[i], file_name); 
     457    if (config_file.exists()) { 
     458      BasicCollectionConfiguration config = new BasicCollectionConfiguration(config_file); 
     459      if (config.getCollectGroup().equals("true")) { 
     460        scanForCollectionsInternal(collections[i]); 
     461      } else { 
     462        all_collections.add(config);                 
     463        config = null; 
     464      } 
     465    } 
     466      } 
     467    } 
     468  } 
    461469 
    462470