コード例 #1
0
 /**
  * This method builds a state object which can be used to submit a stage progress self-patch.
  *
  * @param stage Supplies the stage that the current service instance is moving to.
  * @param errorResponse Supplies the {@link ServiceErrorResponse} response object
  * @return Returns a patch state object that the current service instance is moving to.
  */
 private State buildPatch(
     TaskState.TaskStage stage, @Nullable ServiceErrorResponse errorResponse) {
   State state = new State();
   state.taskState = new TaskState();
   state.taskState.stage = stage;
   state.taskState.failure = errorResponse;
   return state;
 }
コード例 #2
0
  /**
   * This method applies a patch to a state object.
   *
   * @param startState Supplies the start state object.
   * @param patchState Supplies the patch state object.
   */
  private State applyPatch(State startState, State patchState) {
    if (patchState.taskState != null) {
      if (patchState.taskState.stage != startState.taskState.stage) {
        ServiceUtils.logInfo(this, "Moving to stage %s", patchState.taskState.stage);
      }

      startState.taskState = patchState.taskState;
    }

    return startState;
  }
コード例 #3
0
  @VisibleForTesting
  protected State buildPatch(TaskState.TaskStage stage, @Nullable Throwable t) {
    State patchState = new State();
    patchState.taskState = new TaskState();
    patchState.taskState.stage = stage;

    if (null != t) {
      patchState.taskState.failure = Utils.toServiceErrorResponse(t);
    }

    return patchState;
  }
コード例 #4
0
  private State applyPatch(State currentState, State patchState) {
    if (patchState.taskState.stage != currentState.taskState.stage) {
      ServiceUtils.logInfo(this, "Moving to stage %s", patchState.taskState.stage);
      currentState.taskState = patchState.taskState;
    }

    if (patchState.tenantServiceLink != null) {
      currentState.tenantServiceLink = patchState.tenantServiceLink;
    }

    return currentState;
  }