Changeset 26756


Ignore:
Timestamp:
2013-01-19T22:49:04+13:00 (11 years ago)
Author:
davidb
Message:

Adjusted code for import agent so that it searches the appropriate GS collection's export for a frameset stored in its own subdirectory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • other-projects/GlamED/trunk/src/org/honours/agents/ImportCollections.java

    r26701 r26756  
    7070   
    7171    /**
    72      * TODO: Change this method so we only display the full name of the collection and the collection's description (the first 10 words).
     72     * Import any collection framesets found in Greenstone into GlamED.
    7373     * @param children
    7474     * @throws Exception
     
    9090           
    9191            if(dir.isDirectory()){
    92                 File exports = getExportDirectory(filename);
    93                
    94                 if(exports != null){
    95                     //Search exports folder for 0.exp, 1.exp & frame.inf
    96                     String[] filesToMove = getFiles(exports);
     92               
     93                File outputDir = new File(filename + File.separator + "export" + File.separator + collectionName);
     94               
     95                if(outputDir.isDirectory()){
     96                   
     97                    String[] filesToMove = getFiles(outputDir);
    9798                   
    9899                    if(filesToMove == null){
    99                         String errorMsg = "Failed to import collection " + collectionName;
     100                        String errorMsg = "Failed to import collection: " + collectionName;
    100101                        MessageBay.errorMessage("ERROR: " + errorMsg);
    101102                        throw new Exception(errorMsg);
     
    103104                   
    104105                    File matchingFrameset = matchingFrameset(collectionName);
    105                    
     106
    106107                    //Obtain first free frame for displaying collection row with links
    107108                    Object[] freeFrameInfo = findFreeFrame();
     
    118119                   
    119120                    //Import collection into Expeditee.
    120                     importIntoExpeditee(matchingFrameset,exports,collectionName,tempCollections);
    121                    
     121                    importIntoExpeditee(matchingFrameset,outputDir,collectionName,tempCollections);
    122122                }
    123123            }
     
    182182            }else{
    183183                tempCollections.add(collect);
    184             }
    185            
    186            
    187         }
    188 
     184            }           
     185        }
    189186    }
    190187   
     
    349346       
    350347        for(int j = 0; j < newChildren.length; j++){
    351             if(newChildren[j].equals("export"))
    352                     return new File(filename + File.separator + "export");
     348            if(newChildren[j].equals("export")){
     349                    String exportDir = filename + File.separator + "export";
     350                    System.err.println(exportDir);
     351                    return new File(exportDir);
     352            }
    353353        }
    354354       
Note: See TracChangeset for help on using the changeset viewer.