Example usage for org.springframework.batch.core.repository JobInstanceAlreadyCompleteException getMessage

List of usage examples for org.springframework.batch.core.repository JobInstanceAlreadyCompleteException getMessage

Introduction

In this page you can find the example usage for org.springframework.batch.core.repository JobInstanceAlreadyCompleteException 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 restart(ActionEvent evt) {

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

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

        try {/*  w ww .  j  a va  2 s. c o  m*/
            getPsiMIJobManager().restartJob(executionId);

            addInfoMessage("Job restarted", "Execution ID: " + executionId);
        } catch (JobInstanceAlreadyCompleteException e) {
            addErrorMessage("Job is already complete " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (NoSuchJobExecutionException e) {
            addErrorMessage("Job execution does not exist" + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (NoSuchJobException e) {
            addErrorMessage("Job does not exist" + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (JobRestartException e) {
            addErrorMessage("Problem restarting job" + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (JobParametersInvalidException e) {
            addErrorMessage("Job parameters are invalid" + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        }
    }
}

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

public void restart(ActionEvent evt) {

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

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

        try {//from  ww w . j ava 2 s. com
            getPsiMIJobManager().restartJob(executionId);

            addInfoMessage("Job restarted", "Execution ID: " + executionId);
            // remove old job instance
            getBatchJobService().deleteJob(executionId);

        } catch (JobInstanceAlreadyCompleteException e) {
            addErrorMessage("Job is already complete " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (NoSuchJobExecutionException e) {
            addErrorMessage("Job execution does not exist " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (NoSuchJobException e) {
            addErrorMessage("Job does not exist " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (JobRestartException e) {
            addErrorMessage("Problem restarting job " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        } catch (JobParametersInvalidException e) {
            addErrorMessage("Job parameters are invalid " + e.getMessage(), "Execution ID: " + executionId);
            e.printStackTrace();
        }
    }
}

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

@ResponseBody
@ExceptionHandler//ww  w  . ja v a  2 s  .c  o  m
@ResponseStatus(HttpStatus.BAD_REQUEST)
public VndErrors onJobInstanceAlreadyCompleteException(JobInstanceAlreadyCompleteException e) {
    String logref = logDebug(e);
    return new VndErrors(logref, e.getMessage());
}