예제 #1
0
 @Override
 public ConnectionState execute(Connection connection, ApplicationConfiguration configuration) {
   if (connection.getInputQueue().hasAny()) {
     String path = connection.getInputQueue().pop();
     if (path.isEmpty()) {
       return connectionStateProvider.get(AdministrationMenu.class);
     }
     File file = FileUtils.getFile(path);
     if (file.exists()) {
       ImportConfiguration importConfiguration = new ImportConfiguration();
       importConfiguration.setFile(file);
       databaseImportLauncher.launchWith(importConfiguration);
       return connectionStateProvider.get(AdministrationMenu.class);
     } else {
       String text =
           textMaker.getText(
               TextName.FileNotFound, connection.getLocale(), ImmutableMap.of("file path", path));
       connection.getOutputQueue().push(text);
       return connectionStateProvider.get(ImportPathPrompt.class);
     }
   }
   return this;
 }