congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DurationReportResult.getAverage
Code IndexAdd Tabnine to your IDE (free)

How to use
getAverage
method
in
org.camunda.bpm.engine.history.DurationReportResult

Best Java code snippets using org.camunda.bpm.engine.history.DurationReportResult.getAverage (Showing top 13 results out of 315)

origin: camunda/camunda-bpm-platform

protected static String convertDurationReportResult(List<ReportResult> reports) {
 StringBuilder buffer = new StringBuilder();
 buffer.append(DURATION_HEADER);
 for (ReportResult report : reports) {
  DurationReportResult durationReport = (DurationReportResult) report;
  buffer.append(NEW_LINE_SEPARATOR);
  buffer.append(durationReport.getPeriod());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getPeriodUnit().toString());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getMinimum());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getMaximum());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getAverage());
 }
 return buffer.toString();
}
origin: camunda/camunda-bpm-platform

protected static String convertDurationReportResult(List<ReportResult> reports) {
 StringBuilder buffer = new StringBuilder();
 buffer.append(DURATION_HEADER);
 for (ReportResult report : reports) {
  DurationReportResult durationReport = (DurationReportResult) report;
  buffer.append(NEW_LINE_SEPARATOR);
  buffer.append(durationReport.getPeriod());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getPeriodUnit().toString());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getMinimum());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getMaximum());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getAverage());
 }
 return buffer.toString();
}
origin: camunda/camunda-bpm-platform

public static DurationReportResultDto fromDurationReportResult(DurationReportResult durationReport) {
 DurationReportResultDto dto = new DurationReportResultDto();
 dto.minimum = durationReport.getMinimum();
 dto.maximum = durationReport.getMaximum();
 dto.average = durationReport.getAverage();
 return dto;
}
origin: camunda/camunda-bpm-platform

public static DurationReportResultDto fromDurationReportResult(DurationReportResult durationReport) {
 DurationReportResultDto dto = new DurationReportResultDto();
 dto.minimum = durationReport.getMinimum();
 dto.maximum = durationReport.getMaximum();
 dto.average = durationReport.getAverage();
 return dto;
}
origin: camunda/camunda-bpm-platform

public static List<DurationReportResult> createMockHistoricProcessInstanceDurationReportByQuarter() {
 DurationReportResult mock = mock(DurationReportResult.class);
 when(mock.getAverage()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_AVG);
 when(mock.getMinimum()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MIN);
 when(mock.getMaximum()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MAX);
 when(mock.getPeriod()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_PERIOD);
 when(mock.getPeriodUnit()).thenReturn(PeriodUnit.QUARTER);
 List<DurationReportResult> mockList = new ArrayList<DurationReportResult>();
 mockList.add(mock);
 return mockList;
}
origin: camunda/camunda-bpm-platform

public static List<DurationReportResult> createMockHistoricProcessInstanceDurationReportByMonth() {
 DurationReportResult mock = mock(DurationReportResult.class);
 when(mock.getAverage()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_AVG);
 when(mock.getMinimum()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MIN);
 when(mock.getMaximum()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_MAX);
 when(mock.getPeriod()).thenReturn(EXAMPLE_HISTORIC_PROC_INST_DURATION_REPORT_PERIOD);
 when(mock.getPeriodUnit()).thenReturn(PeriodUnit.MONTH);
 List<DurationReportResult> mockList = new ArrayList<DurationReportResult>();
 mockList.add(mock);
 return mockList;
}
origin: camunda/camunda-bpm-platform

public static List<DurationReportResult> createMockHistoricTaskInstanceDurationReport(PeriodUnit periodUnit) {
 DurationReportResult mock = mock(DurationReportResult.class);
 when(mock.getAverage()).thenReturn(EXAMPLE_HISTORIC_TASK_INST_DURATION_REPORT_AVG);
 when(mock.getMinimum()).thenReturn(EXAMPLE_HISTORIC_TASK_INST_DURATION_REPORT_MIN);
 when(mock.getMaximum()).thenReturn(EXAMPLE_HISTORIC_TASK_INST_DURATION_REPORT_MAX);
 when(mock.getPeriod()).thenReturn(EXAMPLE_HISTORIC_TASK_INST_DURATION_REPORT_PERIOD);
 when(mock.getPeriodUnit()).thenReturn(periodUnit);
 List<DurationReportResult> mockList = new ArrayList<DurationReportResult>();
 mockList.add(mock);
 return mockList;
}
origin: camunda/camunda-bpm-platform

public void assertReportResults(List<DurationReportResult> actual) {
 assertEquals("Report size", periodToProcessInstancesMap.size(), actual.size());
 for (DurationReportResult reportResult : actual) {
  assertEquals("Period unit", periodUnit, reportResult.getPeriodUnit());
  int period = reportResult.getPeriod();
  Set<String> processInstancesInPeriod = periodToProcessInstancesMap.get(period);
  assertNotNull("Unexpected report for period " + period, processInstancesInPeriod);
  List<HistoricProcessInstance> historicProcessInstances = historyService
    .createHistoricProcessInstanceQuery()
    .processInstanceIds(processInstancesInPeriod)
    .finished()
    .list();
  long max = 0;
  long min = 0;
  long sum = 0;
  for (int i = 0; i < historicProcessInstances.size(); i++) {
   HistoricProcessInstance historicProcessInstance = historicProcessInstances.get(i);
   Long duration = historicProcessInstance.getDurationInMillis();
   sum = sum + duration;
   max = i > 0 ? Math.max(max, duration) : duration;
   min = i > 0 ? Math.min(min, duration) : duration;
  }
  long avg = sum / historicProcessInstances.size();
  assertEquals("maximum", max, reportResult.getMaximum());
  assertEquals("minimum", min, reportResult.getMinimum());
  assertEquals("average", avg, reportResult.getAverage(), 1);
 }
}
origin: camunda/camunda-bpm-platform

@Test
public void testHistoricTaskInstanceDurationReportResults() {
 startAndCompleteProcessInstance(PROCESS_DEFINITION_KEY, 2016, 7, 14, 11, 43);
 startAndCompleteProcessInstance(PROCESS_DEFINITION_KEY, 2016, 7, 14, 11, 43);
 DurationReportResult taskReportResult = historyService
  .createHistoricTaskInstanceReport()
  .duration(PeriodUnit.MONTH).get(0);
 List<HistoricTaskInstance> historicTaskInstances = historyService
  .createHistoricTaskInstanceQuery()
  .processDefinitionKey(PROCESS_DEFINITION_KEY)
  .list();
 long min = 0;
 long max = 0;
 long sum = 0;
 for (int i = 0; i < historicTaskInstances.size(); i++) {
  HistoricTaskInstance historicProcessInstance = historicTaskInstances.get(i);
  Long duration = historicProcessInstance.getDurationInMillis();
  sum = sum + duration;
  max = i > 0 ? Math.max(max, duration) : duration;
  min = i > 0 ? Math.min(min, duration) : duration;
 }
 long avg = sum / historicTaskInstances.size();
 assertEquals("maximum", max, taskReportResult.getMaximum());
 assertEquals("minimum", min, taskReportResult.getMinimum());
 assertEquals("average", avg, taskReportResult.getAverage(), 0);
}
origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

protected static String convertDurationReportResult(List<ReportResult> reports) {
 StringBuffer buffer = new StringBuffer();
 buffer.append(DURATION_HEADER);
 for (ReportResult report : reports) {
  DurationReportResult durationReport = (DurationReportResult) report;
  buffer.append(NEW_LINE_SEPARATOR);
  buffer.append(durationReport.getPeriod());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getPeriodUnit().toString());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getMinimum());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getMaximum());
  buffer.append(DELIMITER);
  buffer.append(durationReport.getAverage());
 }
 return buffer.toString();
}
origin: org.camunda.bpm/camunda-engine-rest-jaxrs2

public static DurationReportResultDto fromDurationReportResult(DurationReportResult durationReport) {
 DurationReportResultDto dto = new DurationReportResultDto();
 dto.minimum = durationReport.getMinimum();
 dto.maximum = durationReport.getMaximum();
 dto.average = durationReport.getAverage();
 return dto;
}
origin: org.camunda.bpm/camunda-engine

public void assertReportResults(List<DurationReportResult> actual) {
 assertEquals("Report size", periodToProcessInstancesMap.size(), actual.size());
 for (DurationReportResult reportResult : actual) {
  assertEquals("Period unit", periodUnit, reportResult.getPeriodUnit());
  int period = reportResult.getPeriod();
  Set<String> processInstancesInPeriod = periodToProcessInstancesMap.get(period);
  assertNotNull("Unexpected report for period " + period, processInstancesInPeriod);
  List<HistoricProcessInstance> historicProcessInstances = historyService
    .createHistoricProcessInstanceQuery()
    .processInstanceIds(processInstancesInPeriod)
    .finished()
    .list();
  long max = 0;
  long min = 0;
  long sum = 0;
  for (int i = 0; i < historicProcessInstances.size(); i++) {
   HistoricProcessInstance historicProcessInstance = historicProcessInstances.get(i);
   Long duration = historicProcessInstance.getDurationInMillis();
   sum = sum + duration;
   max = i > 0 ? Math.max(max, duration) : duration;
   min = i > 0 ? Math.min(min, duration) : duration;
  }
  long avg = sum / historicProcessInstances.size();
  assertEquals("maximum", max, reportResult.getMaximum());
  assertEquals("minimum", min, reportResult.getMinimum());
  assertEquals("average", avg, reportResult.getAverage(), 1);
 }
}
origin: org.camunda.bpm/camunda-engine

@Test
public void testHistoricTaskInstanceDurationReportResults() {
 startAndCompleteProcessInstance(PROCESS_DEFINITION_KEY, 2016, 7, 14, 11, 43);
 startAndCompleteProcessInstance(PROCESS_DEFINITION_KEY, 2016, 7, 14, 11, 43);
 DurationReportResult taskReportResult = historyService
  .createHistoricTaskInstanceReport()
  .duration(PeriodUnit.MONTH).get(0);
 List<HistoricTaskInstance> historicTaskInstances = historyService
  .createHistoricTaskInstanceQuery()
  .processDefinitionKey(PROCESS_DEFINITION_KEY)
  .list();
 long min = 0;
 long max = 0;
 long sum = 0;
 for (int i = 0; i < historicTaskInstances.size(); i++) {
  HistoricTaskInstance historicProcessInstance = historicTaskInstances.get(i);
  Long duration = historicProcessInstance.getDurationInMillis();
  sum = sum + duration;
  max = i > 0 ? Math.max(max, duration) : duration;
  min = i > 0 ? Math.min(min, duration) : duration;
 }
 long avg = sum / historicTaskInstances.size();
 assertEquals("maximum", max, taskReportResult.getMaximum());
 assertEquals("minimum", min, taskReportResult.getMinimum());
 assertEquals("average", avg, taskReportResult.getAverage(), 0);
}
org.camunda.bpm.engine.historyDurationReportResultgetAverage

Javadoc

Returns the average duration of all completed instances, which have been started in the given period.

Popular methods of DurationReportResult

  • getMaximum
    Returns the greatest duration of all completed instances, which have been started in the given perio
  • getMinimum
    Returns the smallest duration of all completed instances, which have been started in the given perio
  • getPeriod
  • getPeriodUnit

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • getApplicationContext (Context)
  • getSystemService (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now