Example usage for org.springframework.batch.core.launch NoSuchJobExecutionException getMessage

List of usage examples for org.springframework.batch.core.launch NoSuchJobExecutionException getMessage

Introduction

In this page you can find the example usage for org.springframework.batch.core.launch NoSuchJobExecutionException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:uk.ac.ebi.intact.editor.controller.admin.AdminJobController.java

public void stop(ActionEvent evt) {
    UIParameter param = (UIParameter) evt.getComponent().getChildren().iterator().next();
    long executionId = (Long) param.getValue();

    try {// w  w w .ja va2s .co m
        getPsiMIJobManager().getJobOperator().stop(executionId);

        addInfoMessage("Job stopped", "Execution ID: " + executionId);
    } catch (NoSuchJobExecutionException e) {
        addErrorMessage("Job does not exist " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    } catch (JobExecutionNotRunningException e) {
        addErrorMessage("Job is not running anymore " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    }
}

From source file:uk.ac.ebi.intact.editor.controller.dbmanager.ImportJobController.java

public void stop(ActionEvent evt) {
    UIParameter param = (UIParameter) evt.getComponent().getChildren().iterator().next();
    long executionId = (Long) param.getValue();

    try {//from  w  w w. j a  v  a2 s  . c o  m
        getPsiMIJobManager().getJobOperator().stop(executionId);

        addInfoMessage("Job stopped", "Execution ID: " + executionId);
    } catch (NoSuchJobExecutionException e) {
        addErrorMessage("Job does not exist: " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    } catch (JobExecutionNotRunningException e) {
        addErrorMessage("Job is not running anymore: " + e.getMessage(), "Execution ID: " + executionId);
        e.printStackTrace();
    }
}

From source file:com.iisigroup.cap.batch.handler.BatchHandler.java

/**
 * /*ww  w. j  ava2s  .co m*/
 * 
 * @param request
 *            IRequest
 * @return IResult
 */
public Result executionStop(Request request) {
    AjaxFormResult result = new AjaxFormResult();
    long jobExecutionId = Long.parseLong(request.get("jobExeId"));
    try {
        JobExecution jobExecution = jobService.stop(jobExecutionId);
        new JobExecutionInfo(jobExecution, TimeZone.getDefault());
    } catch (NoSuchJobExecutionException e) {
        throw new CapMessageException("msg.job.noSuchJob", getClass());
    } catch (JobExecutionNotRunningException e) {
        JobExecution jobExecution;
        try {
            jobExecution = jobService.getJobExecution(jobExecutionId);
            new JobExecutionInfo(jobExecution, TimeZone.getDefault());
        } catch (NoSuchJobExecutionException e1) {
            e1.getMessage();
        }
        throw new CapMessageException("msg.job.noRunnigJob", getClass())
                .setExtraInformation(new Object[] { jobExecutionId });
    }
    return result;
}

From source file:uk.ac.ebi.intact.editor.controller.dbmanager.ImportJobController.java

public void stopAndDiscardImport(ActionEvent evt) {

    if (!evt.getComponent().getChildren().isEmpty()) {
        UIParameter param = (UIParameter) evt.getComponent().getChildren().iterator().next();

        long executionId = (Long) param.getValue();

        try {//  ww w .  j  a va2s . co m
            getPsiMIJobManager().getJobOperator().stop(executionId);

            addInfoMessage("Job stopped", "Execution ID: " + executionId);
        } catch (NoSuchJobExecutionException e) {
            addErrorMessage("Job does not exist: " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (JobExecutionNotRunningException e) {
            addErrorMessage("Job is not running anymore: " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        }

        JobExecution execution = getJobExplorer().getJobExecution(executionId);

        if (execution != null) {
            JobParameters params = execution.getJobParameters();
            if (params != null) {
                String jobId = params.getString("MIJobId");

                try {
                    getDbImportService().deleteImportedFeatures(jobId);

                    getDbImportService().deleteImportedParticipants(jobId);

                    getDbImportService().deleteImportedInteractions(jobId);

                    getDbImportService().deleteImportedExperiments(jobId);

                    getDbImportService().deleteImportedPublications(jobId);

                    getDbImportService().deleteImportedOrganisms(jobId);

                    getDbImportService().deleteImportedSources(jobId);

                    getDbImportService().deleteImportedCvs(jobId);

                    getBatchJobService().deleteJob(executionId);

                    addInfoMessage("Job cleared, import objects deleted", "Execution ID: " + executionId);
                } catch (Throwable e) {
                    addErrorMessage("Cannot clear job import " + e.getMessage(),
                            "Execution ID: " + executionId + ", " + ExceptionUtils.getFullStackTrace(e));
                }

                String errorFileName = params.getString("error.file");
                String fileName = params.getString("input.file");

                File file = new File(fileName);
                if (file.exists()) {
                    file.delete();
                }
                File errorFile = new File(errorFileName);
                if (errorFile.exists()) {
                    errorFile.delete();
                }
            }
        }
    }
}

From source file:org.springframework.batch.admin.web.RestControllerAdvice.java

@ResponseBody
@ExceptionHandler/*from  ww w.j  a  va 2  s  .  c  om*/
@ResponseStatus(HttpStatus.NOT_FOUND)
public VndErrors onNoSuchJobExecutionException(NoSuchJobExecutionException e) {
    String logref = logDebug(e);
    return new VndErrors(logref, e.getMessage());
}