public Injector openAnalysisJob ( final FileObject file ) { final JaxbJobReader reader = new JaxbJobReader ( _configuration ) ; try { final AnalysisJobBuilder ajb = reader . create ( file ) ; return openAnalysisJob ( file , ajb ) ; } catch ( final NoSuchComponentException e ) { final String message ; if ( Version . EDITION_COMMUNITY . equals ( Version . getEdition ( ) ) ) { message = "<html><p>Failed to open job because of a missing component:</p><pre>" + e . getMessage ( ) + "</pre><p>This may happen if the job requires a " + "<a href=\"https://www.quadient.com/products/quadient-datacleaner#get-started-today\">" + "Commercial Edition of DataCleaner</a>, or an extension that you do not have installed.</p>" + "</html>" ; } else { message = "<html>Failed to open job because of a missing component: " + e . getMessage ( ) + "<br/><br/>" + "This may happen if the job requires an extension that you do not have installed.</html>" ; } WidgetUtils . showErrorMessage ( "Cannot open job" , message ) ; return null ; } catch ( final NoSuchDatastoreException e ) { if ( _windowContext == null ) { // This can happen in case of single-datastore + job file // bootstrapping of DC throw e ; } final AnalysisJobMetadata metadata = reader . readMetadata ( file ) ; final int result = JOptionPane . showConfirmDialog ( null , e . getMessage ( ) + "\n\nDo you wish to open this job as a template?" , "Error: " + e . getMessage ( ) , JOptionPane . OK_CANCEL_OPTION , JOptionPane . ERROR_MESSAGE ) ; if ( result == JOptionPane . OK_OPTION ) { final OpenAnalysisJobAsTemplateDialog dialog = new OpenAnalysisJobAsTemplateDialog ( _windowContext , _configuration , file , metadata , Providers . of ( this ) ) ; dialog . setVisible ( true ) ; } return null ; } catch ( final ComponentConfigurationException e ) { final String message ; final Throwable cause = e . getCause ( ) ; if ( cause != null ) { // check for causes of the mis-configuration. If there's a cause // with a message, then show the message first and foremost // (usually a validation error). if ( ! Strings . isNullOrEmpty ( cause . getMessage ( ) ) ) { message = cause . getMessage ( ) ; } else { message = e . getMessage ( ) ; } } else { message = e . getMessage ( ) ; } WidgetUtils . showErrorMessage ( "Failed to validate job configuration" , message , e ) ; return null ; } catch ( final RuntimeException e ) { logger . error ( "Unexpected failure when opening job: {}" , file , e ) ; throw e ; } }
Opens a job file