All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.uber.cadence.workflow.WorkflowInterceptorBase Maven / Gradle / Ivy

/*
 *  Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 *  Modifications copyright (C) 2017 Uber Technologies, Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not
 *  use this file except in compliance with the License. A copy of the License is
 *  located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 *  or in the "license" file accompanying this file. This file is distributed on
 *  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 *  express or implied. See the License for the specific language governing
 *  permissions and limitations under the License.
 */

package com.uber.cadence.workflow;

import com.uber.cadence.WorkflowExecution;
import com.uber.cadence.activity.ActivityOptions;
import com.uber.cadence.activity.LocalActivityOptions;
import com.uber.cadence.workflow.Functions.Func;
import com.uber.cadence.workflow.Functions.Func1;
import java.lang.reflect.Type;
import java.time.Duration;
import java.util.Optional;
import java.util.Random;
import java.util.UUID;
import java.util.function.BiPredicate;
import java.util.function.Supplier;

/** Convenience base class for WorkflowInterceptor implementations. */
public class WorkflowInterceptorBase implements WorkflowInterceptor {

  private final WorkflowInterceptor next;

  public WorkflowInterceptorBase(WorkflowInterceptor next) {
    this.next = next;
  }

  @Override
  public  Promise executeActivity(
      String activityName,
      Class resultClass,
      Type resultType,
      Object[] args,
      ActivityOptions options) {
    return next.executeActivity(activityName, resultClass, resultType, args, options);
  }

  @Override
  public  Promise executeLocalActivity(
      String activityName,
      Class resultClass,
      Type resultType,
      Object[] args,
      LocalActivityOptions options) {
    return next.executeLocalActivity(activityName, resultClass, resultType, args, options);
  }

  @Override
  public  WorkflowResult executeChildWorkflow(
      String workflowType,
      Class resultClass,
      Type resultType,
      Object[] args,
      ChildWorkflowOptions options) {
    return next.executeChildWorkflow(workflowType, resultClass, resultType, args, options);
  }

  @Override
  public Random newRandom() {
    return next.newRandom();
  }

  @Override
  public Promise signalExternalWorkflow(
      WorkflowExecution execution, String signalName, Object[] args) {
    return next.signalExternalWorkflow(execution, signalName, args);
  }

  @Override
  public Promise cancelWorkflow(WorkflowExecution execution) {
    return next.cancelWorkflow(execution);
  }

  @Override
  public void sleep(Duration duration) {
    next.sleep(duration);
  }

  @Override
  public boolean await(Duration timeout, String reason, Supplier unblockCondition) {
    return next.await(timeout, reason, unblockCondition);
  }

  @Override
  public void await(String reason, Supplier unblockCondition) {
    next.await(reason, unblockCondition);
  }

  @Override
  public Promise newTimer(Duration duration) {
    return next.newTimer(duration);
  }

  @Override
  public  R sideEffect(Class resultClass, Type resultType, Func func) {
    return next.sideEffect(resultClass, resultType, func);
  }

  @Override
  public  R mutableSideEffect(
      String id, Class resultClass, Type resultType, BiPredicate updated, Func func) {
    return next.mutableSideEffect(id, resultClass, resultType, updated, func);
  }

  @Override
  public int getVersion(String changeID, int minSupported, int maxSupported) {
    return next.getVersion(changeID, minSupported, maxSupported);
  }

  @Override
  public void continueAsNew(
      Optional workflowType, Optional options, Object[] args) {
    next.continueAsNew(workflowType, options, args);
  }

  @Override
  public void registerQuery(String queryType, Type[] argTypes, Func1 callback) {
    next.registerQuery(queryType, argTypes, callback);
  }

  @Override
  public UUID randomUUID() {
    return next.randomUUID();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy