Search in sources :

Example 11 with FetchExternalTasksExtendedDto

use of org.camunda.bpm.engine.rest.dto.externaltask.FetchExternalTasksExtendedDto in project camunda-bpm-platform by camunda.

the class FetchAndLockHandlerImpl method tryFetchAndLock.

protected FetchAndLockResult tryFetchAndLock(FetchAndLockRequest request) {
    ProcessEngine processEngine = request.getProcessEngine();
    IdentityService identityService = processEngine.getIdentityService();
    FetchAndLockResult result;
    try {
        identityService.setAuthentication(request.getAuthentication());
        FetchExternalTasksExtendedDto fetchingDto = request.getDto();
        List<LockedExternalTaskDto> lockedTasks = executeFetchAndLock(fetchingDto, processEngine);
        result = FetchAndLockResult.successful(lockedTasks);
    } catch (ProcessEngineException e) {
        result = FetchAndLockResult.failed(e);
    } finally {
        identityService.clearAuthentication();
    }
    return result;
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) FetchExternalTasksExtendedDto(org.camunda.bpm.engine.rest.dto.externaltask.FetchExternalTasksExtendedDto) LockedExternalTaskDto(org.camunda.bpm.engine.rest.dto.externaltask.LockedExternalTaskDto) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 12 with FetchExternalTasksExtendedDto

use of org.camunda.bpm.engine.rest.dto.externaltask.FetchExternalTasksExtendedDto in project camunda-bpm-platform by camunda.

the class FetchAndLockRequest method getTimeoutTimestamp.

public long getTimeoutTimestamp() {
    FetchExternalTasksExtendedDto dto = getDto();
    long requestTime = getRequestTime().getTime();
    long asyncResponseTimeout = dto.getAsyncResponseTimeout();
    return requestTime + asyncResponseTimeout;
}
Also used : FetchExternalTasksExtendedDto(org.camunda.bpm.engine.rest.dto.externaltask.FetchExternalTasksExtendedDto)

Aggregations

FetchExternalTasksExtendedDto (org.camunda.bpm.engine.rest.dto.externaltask.FetchExternalTasksExtendedDto)12 AbstractRestServiceTest (org.camunda.bpm.engine.rest.AbstractRestServiceTest)8 Test (org.junit.Test)8 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 InOrder (org.mockito.InOrder)3 IdentityService (org.camunda.bpm.engine.IdentityService)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 Authentication (org.camunda.bpm.engine.impl.identity.Authentication)1 LockedExternalTaskDto (org.camunda.bpm.engine.rest.dto.externaltask.LockedExternalTaskDto)1 Ignore (org.junit.Ignore)1