コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSetRemovalTime_Response()
        public virtual void shouldSetRemovalTime_Response()
        {
            SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder builderMock = mock(typeof(SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder), RETURNS_DEEP_STUBS);

            when(historyServiceMock.setRemovalTimeToHistoricDecisionInstances()).thenReturn(builderMock);

            Batch batchEntity = MockProvider.createMockBatch();

            when(builderMock.executeAsync()).thenReturn(batchEntity);

            Response response = given().contentType(ContentType.JSON).body(Collections.emptyMap()).then().expect().statusCode(Status.OK.StatusCode).when().post(SET_REMOVAL_TIME_HISTORIC_DECISION_INSTANCES_ASYNC_URL);

            verifyBatchJson(response.asString());
        }
コード例 #2
0
        public virtual BatchDto setRemovalTimeAsync(SetRemovalTimeToHistoricDecisionInstancesDto dto)
        {
            HistoryService historyService = processEngine.HistoryService;

            HistoricDecisionInstanceQuery historicDecisionInstanceQuery = null;

            if (dto.HistoricDecisionInstanceQuery != null)
            {
                historicDecisionInstanceQuery = dto.HistoricDecisionInstanceQuery.toQuery(processEngine);
            }

            SetRemovalTimeSelectModeForHistoricDecisionInstancesBuilder builder = historyService.setRemovalTimeToHistoricDecisionInstances();

            if (dto.CalculatedRemovalTime)
            {
                builder.calculatedRemovalTime();
            }

            DateTime removalTime = dto.AbsoluteRemovalTime;

            if (dto.AbsoluteRemovalTime != null)
            {
                builder.absoluteRemovalTime(removalTime);
            }

            if (dto.ClearedRemovalTime)
            {
                builder.clearedRemovalTime();
            }

            builder.byIds(dto.HistoricDecisionInstanceIds);
            builder.byQuery(historicDecisionInstanceQuery);

            if (dto.Hierarchical)
            {
                builder.hierarchical();
            }

            Batch batch = builder.executeAsync();

            return(BatchDto.fromBatch(batch));
        }