public WorkflowOptions validateBuildWithDefaults()

in src/main/java/com/uber/cadence/client/WorkflowOptions.java [244:294]


    public WorkflowOptions validateBuildWithDefaults() {
      if (executionStartToCloseTimeout == null) {
        throw new IllegalStateException(
            "Required property executionStartToCloseTimeout is not set");
      }
      if (taskList == null) {
        throw new IllegalArgumentException("Required property taskList is not set");
      }
      WorkflowIdReusePolicy policy = workflowIdReusePolicy;
      if (policy == null) {
        policy = WorkflowIdReusePolicy.AllowDuplicateFailedOnly;
      }
      if (retryOptions != null) {
        if (retryOptions.getInitialInterval() == null) {
          throw new IllegalArgumentException(
              "RetryOptions missing required initialInterval property");
        }
        if (retryOptions.getExpiration() == null && retryOptions.getMaximumAttempts() == 0) {
          throw new IllegalArgumentException(
              "RetryOptions must specify either expiration or maximum attempts");
        }
      }

      if (!Strings.isNullOrEmpty(cronSchedule)) {
        CronDefinition cronDefinition = CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
        CronParser parser = new CronParser(cronDefinition);
        Cron cron = parser.parse(cronSchedule);
        cron.validate();
      }

      if (delayStart != null) {
        if (delayStart.getSeconds() < 0) {
          throw new IllegalArgumentException(
              "Delay start (in seconds) value cannot be lower than zero");
        }
      }

      return new WorkflowOptions(
          workflowId,
          policy,
          roundUpToSeconds(executionStartToCloseTimeout),
          roundUpToSeconds(
              taskStartToCloseTimeout, OptionsUtils.DEFAULT_TASK_START_TO_CLOSE_TIMEOUT),
          taskList,
          retryOptions,
          cronSchedule,
          memo,
          searchAttributes,
          contextPropagators,
          delayStart);
    }