Search in sources :

Example 61 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceTest method testQueryByInvalidTaskDefinitionKeys.

public void testQueryByInvalidTaskDefinitionKeys() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    query.taskDefinitionKeyIn("invalid");
    assertEquals(0, query.count());
    try {
        query.taskDefinitionKeyIn(null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (NotValidException e) {
    }
    try {
        query.taskDefinitionKeyIn((String) null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (NotValidException e) {
    }
    try {
        String[] values = { "a", null, "b" };
        query.taskDefinitionKeyIn(values);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 62 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceDurationReportTest method testReportByInvalidStartedBefore.

public void testReportByInvalidStartedBefore() {
    HistoricProcessInstanceReport report = historyService.createHistoricProcessInstanceReport();
    try {
        report.startedBefore(null);
        fail();
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) HistoricProcessInstanceReport(org.camunda.bpm.engine.history.HistoricProcessInstanceReport)

Example 63 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceDurationReportTest method testReportByInvalidStartedAfter.

public void testReportByInvalidStartedAfter() {
    HistoricProcessInstanceReport report = historyService.createHistoricProcessInstanceReport();
    try {
        report.startedAfter(null);
        fail();
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) HistoricProcessInstanceReport(org.camunda.bpm.engine.history.HistoricProcessInstanceReport)

Example 64 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class AbstractReportDto method executeReport.

public List<? extends ReportResult> executeReport(ProcessEngine engine) {
    T reportQuery = createNewReportQuery(engine);
    applyFilters(reportQuery);
    try {
        return executeReportQuery(reportQuery);
    } catch (NotValidException e) {
        throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Example 65 with NotValidException

use of org.camunda.bpm.engine.exception.NotValidException in project camunda-bpm-platform by camunda.

the class CaseDefinitionResourceImpl method getCaseDefinitionCmmnXml.

@Override
public CaseDefinitionDiagramDto getCaseDefinitionCmmnXml() {
    InputStream caseModelInputStream = null;
    try {
        caseModelInputStream = engine.getRepositoryService().getCaseModel(caseDefinitionId);
        byte[] caseModel = IoUtil.readInputStream(caseModelInputStream, "caseModelCmmnXml");
        return CaseDefinitionDiagramDto.create(caseDefinitionId, new String(caseModel, "UTF-8"));
    } catch (NotFoundException e) {
        throw new InvalidRequestException(Status.NOT_FOUND, e, e.getMessage());
    } catch (NotValidException e) {
        throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
    } catch (ProcessEngineException e) {
        throw new RestException(Status.INTERNAL_SERVER_ERROR, e);
    } catch (UnsupportedEncodingException e) {
        throw new RestException(Status.INTERNAL_SERVER_ERROR, e);
    } finally {
        IoUtil.closeSilently(caseModelInputStream);
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) InputStream(java.io.InputStream) RestException(org.camunda.bpm.engine.rest.exception.RestException) NotFoundException(org.camunda.bpm.engine.exception.NotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Aggregations

NotValidException (org.camunda.bpm.engine.exception.NotValidException)121 Test (org.junit.Test)28 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)24 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)24 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)18 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)17 Deployment (org.camunda.bpm.engine.test.Deployment)12 CaseDefinitionQuery (org.camunda.bpm.engine.repository.CaseDefinitionQuery)10 DecisionDefinitionQuery (org.camunda.bpm.engine.repository.DecisionDefinitionQuery)10 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)10 CaseService (org.camunda.bpm.engine.CaseService)9 NotAllowedException (org.camunda.bpm.engine.exception.NotAllowedException)9 RestException (org.camunda.bpm.engine.rest.exception.RestException)8 CaseExecutionCommandBuilder (org.camunda.bpm.engine.runtime.CaseExecutionCommandBuilder)8 CaseInstanceQuery (org.camunda.bpm.engine.runtime.CaseInstanceQuery)8 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)6 HashMap (java.util.HashMap)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 InputStream (java.io.InputStream)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3