static HistoryEvent historyEvent()

in src/main/java/com/uber/cadence/internal/compatibility/thrift/HistoryMapper.java [159:427]


  static HistoryEvent historyEvent(com.uber.cadence.api.v1.HistoryEvent e) {
    if (e == null || e == com.uber.cadence.api.v1.HistoryEvent.getDefaultInstance()) {
      return null;
    }
    HistoryEvent event = new HistoryEvent();
    event.setEventId(e.getEventId());
    event.setTimestamp(timeToUnixNano(e.getEventTime()));
    event.setVersion(e.getVersion());
    event.setTaskId(e.getTaskId());

    if (e.getWorkflowExecutionStartedEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionStartedEventAttributes.getDefaultInstance()) {
      event.setEventType(WorkflowExecutionStarted);
      event.setWorkflowExecutionStartedEventAttributes(
          workflowExecutionStartedEventAttributes(e.getWorkflowExecutionStartedEventAttributes()));
    } else if (e.getWorkflowExecutionCompletedEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionCompletedEventAttributes.getDefaultInstance()) {
      event.setEventType(WorkflowExecutionCompleted);
      event.setWorkflowExecutionCompletedEventAttributes(
          workflowExecutionCompletedEventAttributes(
              e.getWorkflowExecutionCompletedEventAttributes()));
    } else if (e.getWorkflowExecutionFailedEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionFailedEventAttributes.getDefaultInstance()) {
      event.setEventType(WorkflowExecutionFailed);
      event.setWorkflowExecutionFailedEventAttributes(
          workflowExecutionFailedEventAttributes(e.getWorkflowExecutionFailedEventAttributes()));
    } else if (e.getWorkflowExecutionTimedOutEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionTimedOutEventAttributes.getDefaultInstance()) {
      event.setEventType(WorkflowExecutionTimedOut);
      event.setWorkflowExecutionTimedOutEventAttributes(
          workflowExecutionTimedOutEventAttributes(
              e.getWorkflowExecutionTimedOutEventAttributes()));
    } else if (e.getDecisionTaskScheduledEventAttributes()
        != com.uber.cadence.api.v1.DecisionTaskScheduledEventAttributes.getDefaultInstance()) {
      event.setEventType(DecisionTaskScheduled);
      event.setDecisionTaskScheduledEventAttributes(
          decisionTaskScheduledEventAttributes(e.getDecisionTaskScheduledEventAttributes()));
    } else if (e.getDecisionTaskStartedEventAttributes()
        != com.uber.cadence.api.v1.DecisionTaskStartedEventAttributes.getDefaultInstance()) {
      event.setEventType(DecisionTaskStarted);
      event.setDecisionTaskStartedEventAttributes(
          decisionTaskStartedEventAttributes(e.getDecisionTaskStartedEventAttributes()));
    } else if (e.getDecisionTaskCompletedEventAttributes()
        != com.uber.cadence.api.v1.DecisionTaskCompletedEventAttributes.getDefaultInstance()) {
      event.setEventType(DecisionTaskCompleted);
      event.setDecisionTaskCompletedEventAttributes(
          decisionTaskCompletedEventAttributes(e.getDecisionTaskCompletedEventAttributes()));
    } else if (e.getDecisionTaskTimedOutEventAttributes()
        != com.uber.cadence.api.v1.DecisionTaskTimedOutEventAttributes.getDefaultInstance()) {
      event.setEventType(DecisionTaskTimedOut);
      event.setDecisionTaskTimedOutEventAttributes(
          decisionTaskTimedOutEventAttributes(e.getDecisionTaskTimedOutEventAttributes()));
    } else if (e.getDecisionTaskFailedEventAttributes()
        != com.uber.cadence.api.v1.DecisionTaskFailedEventAttributes.getDefaultInstance()) {
      event.setEventType(DecisionTaskFailed);
      event.setDecisionTaskFailedEventAttributes(
          decisionTaskFailedEventAttributes(e.getDecisionTaskFailedEventAttributes()));
    } else if (e.getActivityTaskScheduledEventAttributes()
        != com.uber.cadence.api.v1.ActivityTaskScheduledEventAttributes.getDefaultInstance()) {
      event.setEventType(ActivityTaskScheduled);
      event.setActivityTaskScheduledEventAttributes(
          activityTaskScheduledEventAttributes(e.getActivityTaskScheduledEventAttributes()));
    } else if (e.getActivityTaskStartedEventAttributes()
        != com.uber.cadence.api.v1.ActivityTaskStartedEventAttributes.getDefaultInstance()) {
      event.setEventType(ActivityTaskStarted);
      event.setActivityTaskStartedEventAttributes(
          activityTaskStartedEventAttributes(e.getActivityTaskStartedEventAttributes()));
    } else if (e.getActivityTaskCompletedEventAttributes()
        != com.uber.cadence.api.v1.ActivityTaskCompletedEventAttributes.getDefaultInstance()) {
      event.setEventType(ActivityTaskCompleted);
      event.setActivityTaskCompletedEventAttributes(
          activityTaskCompletedEventAttributes(e.getActivityTaskCompletedEventAttributes()));
    } else if (e.getActivityTaskFailedEventAttributes()
        != com.uber.cadence.api.v1.ActivityTaskFailedEventAttributes.getDefaultInstance()) {
      event.setEventType(ActivityTaskFailed);
      event.setActivityTaskFailedEventAttributes(
          activityTaskFailedEventAttributes(e.getActivityTaskFailedEventAttributes()));
    } else if (e.getActivityTaskTimedOutEventAttributes()
        != com.uber.cadence.api.v1.ActivityTaskTimedOutEventAttributes.getDefaultInstance()) {
      event.setEventType(ActivityTaskTimedOut);
      event.setActivityTaskTimedOutEventAttributes(
          activityTaskTimedOutEventAttributes(e.getActivityTaskTimedOutEventAttributes()));
    } else if (e.getTimerStartedEventAttributes()
        != com.uber.cadence.api.v1.TimerStartedEventAttributes.getDefaultInstance()) {
      event.setEventType(TimerStarted);
      event.setTimerStartedEventAttributes(
          timerStartedEventAttributes(e.getTimerStartedEventAttributes()));
    } else if (e.getTimerFiredEventAttributes()
        != com.uber.cadence.api.v1.TimerFiredEventAttributes.getDefaultInstance()) {
      event.setEventType(TimerFired);
      event.setTimerFiredEventAttributes(
          timerFiredEventAttributes(e.getTimerFiredEventAttributes()));
    } else if (e.getActivityTaskCancelRequestedEventAttributes()
        != com.uber.cadence.api.v1.ActivityTaskCancelRequestedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ActivityTaskCancelRequested);
      event.setActivityTaskCancelRequestedEventAttributes(
          activityTaskCancelRequestedEventAttributes(
              e.getActivityTaskCancelRequestedEventAttributes()));
    } else if (e.getRequestCancelActivityTaskFailedEventAttributes()
        != com.uber.cadence.api.v1.RequestCancelActivityTaskFailedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(RequestCancelActivityTaskFailed);
      event.setRequestCancelActivityTaskFailedEventAttributes(
          requestCancelActivityTaskFailedEventAttributes(
              e.getRequestCancelActivityTaskFailedEventAttributes()));
    } else if (e.getActivityTaskCanceledEventAttributes()
        != com.uber.cadence.api.v1.ActivityTaskCanceledEventAttributes.getDefaultInstance()) {
      event.setEventType(ActivityTaskCanceled);
      event.setActivityTaskCanceledEventAttributes(
          activityTaskCanceledEventAttributes(e.getActivityTaskCanceledEventAttributes()));
    } else if (e.getTimerCanceledEventAttributes()
        != com.uber.cadence.api.v1.TimerCanceledEventAttributes.getDefaultInstance()) {
      event.setEventType(TimerCanceled);
      event.setTimerCanceledEventAttributes(
          timerCanceledEventAttributes(e.getTimerCanceledEventAttributes()));
    } else if (e.getCancelTimerFailedEventAttributes()
        != com.uber.cadence.api.v1.CancelTimerFailedEventAttributes.getDefaultInstance()) {
      event.setEventType(CancelTimerFailed);
      event.setCancelTimerFailedEventAttributes(
          cancelTimerFailedEventAttributes(e.getCancelTimerFailedEventAttributes()));
    } else if (e.getMarkerRecordedEventAttributes()
        != com.uber.cadence.api.v1.MarkerRecordedEventAttributes.getDefaultInstance()) {
      event.setEventType(MarkerRecorded);
      event.setMarkerRecordedEventAttributes(
          markerRecordedEventAttributes(e.getMarkerRecordedEventAttributes()));
    } else if (e.getWorkflowExecutionSignaledEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionSignaledEventAttributes.getDefaultInstance()) {
      event.setEventType(WorkflowExecutionSignaled);
      event.setWorkflowExecutionSignaledEventAttributes(
          workflowExecutionSignaledEventAttributes(
              e.getWorkflowExecutionSignaledEventAttributes()));
    } else if (e.getWorkflowExecutionTerminatedEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionTerminatedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(WorkflowExecutionTerminated);
      event.setWorkflowExecutionTerminatedEventAttributes(
          workflowExecutionTerminatedEventAttributes(
              e.getWorkflowExecutionTerminatedEventAttributes()));
    } else if (e.getWorkflowExecutionCancelRequestedEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionCancelRequestedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(WorkflowExecutionCancelRequested);
      event.setWorkflowExecutionCancelRequestedEventAttributes(
          workflowExecutionCancelRequestedEventAttributes(
              e.getWorkflowExecutionCancelRequestedEventAttributes()));
    } else if (e.getWorkflowExecutionCanceledEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionCanceledEventAttributes.getDefaultInstance()) {
      event.setEventType(WorkflowExecutionCanceled);
      event.setWorkflowExecutionCanceledEventAttributes(
          workflowExecutionCanceledEventAttributes(
              e.getWorkflowExecutionCanceledEventAttributes()));
    } else if (e.getRequestCancelExternalWorkflowExecutionInitiatedEventAttributes()
        != com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionInitiatedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(RequestCancelExternalWorkflowExecutionInitiated);
      event.setRequestCancelExternalWorkflowExecutionInitiatedEventAttributes(
          requestCancelExternalWorkflowExecutionInitiatedEventAttributes(
              e.getRequestCancelExternalWorkflowExecutionInitiatedEventAttributes()));
    } else if (e.getRequestCancelExternalWorkflowExecutionFailedEventAttributes()
        != com.uber.cadence.api.v1.RequestCancelExternalWorkflowExecutionFailedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(RequestCancelExternalWorkflowExecutionFailed);
      event.setRequestCancelExternalWorkflowExecutionFailedEventAttributes(
          requestCancelExternalWorkflowExecutionFailedEventAttributes(
              e.getRequestCancelExternalWorkflowExecutionFailedEventAttributes()));
    } else if (e.getExternalWorkflowExecutionCancelRequestedEventAttributes()
        != com.uber.cadence.api.v1.ExternalWorkflowExecutionCancelRequestedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ExternalWorkflowExecutionCancelRequested);
      event.setExternalWorkflowExecutionCancelRequestedEventAttributes(
          externalWorkflowExecutionCancelRequestedEventAttributes(
              e.getExternalWorkflowExecutionCancelRequestedEventAttributes()));
    } else if (e.getWorkflowExecutionContinuedAsNewEventAttributes()
        != com.uber.cadence.api.v1.WorkflowExecutionContinuedAsNewEventAttributes
            .getDefaultInstance()) {
      event.setEventType(WorkflowExecutionContinuedAsNew);
      event.setWorkflowExecutionContinuedAsNewEventAttributes(
          workflowExecutionContinuedAsNewEventAttributes(
              e.getWorkflowExecutionContinuedAsNewEventAttributes()));
    } else if (e.getStartChildWorkflowExecutionInitiatedEventAttributes()
        != com.uber.cadence.api.v1.StartChildWorkflowExecutionInitiatedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(StartChildWorkflowExecutionInitiated);
      event.setStartChildWorkflowExecutionInitiatedEventAttributes(
          startChildWorkflowExecutionInitiatedEventAttributes(
              e.getStartChildWorkflowExecutionInitiatedEventAttributes()));
    } else if (e.getStartChildWorkflowExecutionFailedEventAttributes()
        != com.uber.cadence.api.v1.StartChildWorkflowExecutionFailedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(StartChildWorkflowExecutionFailed);
      event.setStartChildWorkflowExecutionFailedEventAttributes(
          startChildWorkflowExecutionFailedEventAttributes(
              e.getStartChildWorkflowExecutionFailedEventAttributes()));
    } else if (e.getChildWorkflowExecutionStartedEventAttributes()
        != com.uber.cadence.api.v1.ChildWorkflowExecutionStartedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ChildWorkflowExecutionStarted);
      event.setChildWorkflowExecutionStartedEventAttributes(
          childWorkflowExecutionStartedEventAttributes(
              e.getChildWorkflowExecutionStartedEventAttributes()));
    } else if (e.getChildWorkflowExecutionCompletedEventAttributes()
        != com.uber.cadence.api.v1.ChildWorkflowExecutionCompletedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ChildWorkflowExecutionCompleted);
      event.setChildWorkflowExecutionCompletedEventAttributes(
          childWorkflowExecutionCompletedEventAttributes(
              e.getChildWorkflowExecutionCompletedEventAttributes()));
    } else if (e.getChildWorkflowExecutionFailedEventAttributes()
        != com.uber.cadence.api.v1.ChildWorkflowExecutionFailedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ChildWorkflowExecutionFailed);
      event.setChildWorkflowExecutionFailedEventAttributes(
          childWorkflowExecutionFailedEventAttributes(
              e.getChildWorkflowExecutionFailedEventAttributes()));
    } else if (e.getChildWorkflowExecutionCanceledEventAttributes()
        != com.uber.cadence.api.v1.ChildWorkflowExecutionCanceledEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ChildWorkflowExecutionCanceled);
      event.setChildWorkflowExecutionCanceledEventAttributes(
          childWorkflowExecutionCanceledEventAttributes(
              e.getChildWorkflowExecutionCanceledEventAttributes()));
    } else if (e.getChildWorkflowExecutionTimedOutEventAttributes()
        != com.uber.cadence.api.v1.ChildWorkflowExecutionTimedOutEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ChildWorkflowExecutionTimedOut);
      event.setChildWorkflowExecutionTimedOutEventAttributes(
          childWorkflowExecutionTimedOutEventAttributes(
              e.getChildWorkflowExecutionTimedOutEventAttributes()));
    } else if (e.getChildWorkflowExecutionTerminatedEventAttributes()
        != com.uber.cadence.api.v1.ChildWorkflowExecutionTerminatedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ChildWorkflowExecutionTerminated);
      event.setChildWorkflowExecutionTerminatedEventAttributes(
          childWorkflowExecutionTerminatedEventAttributes(
              e.getChildWorkflowExecutionTerminatedEventAttributes()));
    } else if (e.getSignalExternalWorkflowExecutionInitiatedEventAttributes()
        != com.uber.cadence.api.v1.SignalExternalWorkflowExecutionInitiatedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(SignalExternalWorkflowExecutionInitiated);
      event.setSignalExternalWorkflowExecutionInitiatedEventAttributes(
          signalExternalWorkflowExecutionInitiatedEventAttributes(
              e.getSignalExternalWorkflowExecutionInitiatedEventAttributes()));
    } else if (e.getSignalExternalWorkflowExecutionFailedEventAttributes()
        != com.uber.cadence.api.v1.SignalExternalWorkflowExecutionFailedEventAttributes
            .getDefaultInstance()) {
      event.setEventType(SignalExternalWorkflowExecutionFailed);
      event.setSignalExternalWorkflowExecutionFailedEventAttributes(
          signalExternalWorkflowExecutionFailedEventAttributes(
              e.getSignalExternalWorkflowExecutionFailedEventAttributes()));
    } else if (e.getExternalWorkflowExecutionSignaledEventAttributes()
        != com.uber.cadence.api.v1.ExternalWorkflowExecutionSignaledEventAttributes
            .getDefaultInstance()) {
      event.setEventType(ExternalWorkflowExecutionSignaled);
      event.setExternalWorkflowExecutionSignaledEventAttributes(
          externalWorkflowExecutionSignaledEventAttributes(
              e.getExternalWorkflowExecutionSignaledEventAttributes()));
    } else if (e.getUpsertWorkflowSearchAttributesEventAttributes()
        != com.uber.cadence.api.v1.UpsertWorkflowSearchAttributesEventAttributes
            .getDefaultInstance()) {
      event.setEventType(UpsertWorkflowSearchAttributes);
      event.setUpsertWorkflowSearchAttributesEventAttributes(
          upsertWorkflowSearchAttributesEventAttributes(
              e.getUpsertWorkflowSearchAttributesEventAttributes()));
    } else {
      throw new IllegalArgumentException("unknown event type");
    }
    return event;
  }