public MaestroEvent toMaestroEvent()

in maestro-engine/src/main/java/com/netflix/maestro/engine/jobevents/WorkflowVersionUpdateJobEvent.java [149:211]


  public MaestroEvent toMaestroEvent(String clusterName) {
    if (versionId != null) {
      if (snapshotId != null) {
        return WorkflowDefinitionChangeEvent.builder()
            .workflowId(workflowId)
            .workflowName(workflowName)
            .author(author)
            .versionId(versionId)
            .snapshotId(snapshotId)
            .currentActiveVersionId(ObjectHelper.valueOrDefault(currentActiveVersion, 0L))
            .previousActiveVersionId(ObjectHelper.valueOrDefault(previousActiveVersion, 0L))
            .clusterName(clusterName)
            .eventTime(eventTime)
            .syncTime(syncTime)
            .sendTime(System.currentTimeMillis())
            .build();
      } else {
        return WorkflowVersionChangeEvent.builder()
            .workflowId(workflowId)
            .workflowName(workflowName)
            .author(author)
            .versionId(versionId)
            .currentActiveVersionId(ObjectHelper.valueOrDefault(currentActiveVersion, 0L))
            .previousActiveVersionId(ObjectHelper.valueOrDefault(previousActiveVersion, 0L))
            .clusterName(clusterName)
            .eventTime(eventTime)
            .syncTime(syncTime)
            .sendTime(System.currentTimeMillis())
            .build();
      }
    } else if (snapshotId != null) {
      return WorkflowPropertiesChangeEvent.builder()
          .workflowId(workflowId)
          .author(author)
          .snapshotId(snapshotId)
          .clusterName(clusterName)
          .eventTime(eventTime)
          .syncTime(syncTime)
          .sendTime(System.currentTimeMillis())
          .build();
    } else if (currentActiveVersion != null) {
      return WorkflowActivationChangeEvent.builder()
          .workflowId(workflowId)
          .author(author)
          .currentActiveVersionId(currentActiveVersion)
          .previousActiveVersionId(previousActiveVersion)
          .clusterName(clusterName)
          .eventTime(eventTime)
          .syncTime(syncTime)
          .sendTime(System.currentTimeMillis())
          .build();
    } else {
      return WorkflowDeactivationChangeEvent.builder()
          .workflowId(workflowId)
          .author(author)
          .previousActiveVersionId(previousActiveVersion)
          .clusterName(clusterName)
          .eventTime(eventTime)
          .syncTime(syncTime)
          .sendTime(System.currentTimeMillis())
          .build();
    }
  }