Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static CallTaskDtoLegacy callTaskDto(CallTask callTask, String zoneOffset) {
- long createdSec = callTask.getCreated();
- long createdMillis = createdSec * 1000;
- String createdFormatted = TimeFormatService.formattedDateTimeFromMillis(createdMillis, zoneOffset);
- Optional<Long> taskFinishedTimestampMillis;
- if (callTask.getState() == CallTask.State.PERFORMED || callTask.getState() == CallTask.State.FAILED) {
- long performedTimestampSec = callTask.getPerformedTimestamp();
- taskFinishedTimestampMillis = Optional.of(performedTimestampSec * 1000);
- } else {
- taskFinishedTimestampMillis = Optional.empty();
- }
- String taskFinishedFormatted = taskFinishedTimestampMillis
- .map(t -> TimeFormatService.formattedDateTimeFromMillis(t, zoneOffset))
- .orElse(null);
- Optional<Long> callAnsweredTimestampMillis = callAnsweredTimestampMillis(callTask);
- String callAnsweredFormatted = callAnsweredTimestampMillis
- .map(t -> TimeFormatService.formattedDateTimeFromMillis(t, zoneOffset))
- .orElse(null);
- return new CallTaskDtoLegacy(callTask.getId(),
- callTask.getPhone(),
- READABLE_STATES.get(callTask.getState()),
- callTask.getState(),
- createdMillis,
- createdFormatted,
- callAnsweredTimestampMillis.orElse(null),
- callAnsweredFormatted,
- taskFinishedTimestampMillis.orElse(null),
- taskFinishedFormatted,
- zoneOffset,
- combineParametersAndReportParameters(callTask),
- outgoingCalls(callTask.getOutgoingCalls(), zoneOffset),
- results(callTask.getScenarioResult()),
- logs(callTask),
- callTask.getFailComment(),
- combineParametersAndReportParameters(callTask),
- callTask.getTalkMillis()
- );
- }
- private static List<CallTaskDtoLegacy.CallDto> outgoingCalls(List<OutgoingCall> calls, String zoneOffset) {
- return calls.stream()
- .map(c -> from(c, zoneOffset))
- .collect(Collectors.toList());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement