コード例 #1
0
  public DecisionTask unmarshall(JsonUnmarshallerContext context) throws Exception {
    DecisionTask decisionTask = new DecisionTask();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("taskToken", targetDepth)) {
          context.nextToken();
          decisionTask.setTaskToken(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("startedEventId", targetDepth)) {
          context.nextToken();
          decisionTask.setStartedEventId(LongJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("workflowExecution", targetDepth)) {
          context.nextToken();
          decisionTask.setWorkflowExecution(
              WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("workflowType", targetDepth)) {
          context.nextToken();
          decisionTask.setWorkflowType(
              WorkflowTypeJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("events", targetDepth)) {
          decisionTask.setEvents(
              new ListUnmarshaller<HistoryEvent>(HistoryEventJsonUnmarshaller.getInstance())
                  .unmarshall(context));
        }
        if (context.testExpression("nextPageToken", targetDepth)) {
          context.nextToken();
          decisionTask.setNextPageToken(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("previousStartedEventId", targetDepth)) {
          context.nextToken();
          decisionTask.setPreviousStartedEventId(
              LongJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }

      token = context.nextToken();
    }

    return decisionTask;
  }
  public ChildWorkflowExecutionFailedEventAttributes unmarshall(JsonUnmarshallerContext context)
      throws Exception {
    ChildWorkflowExecutionFailedEventAttributes childWorkflowExecutionFailedEventAttributes =
        new ChildWorkflowExecutionFailedEventAttributes();

    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("workflowExecution", targetDepth)) {
          context.nextToken();
          childWorkflowExecutionFailedEventAttributes.setWorkflowExecution(
              WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("workflowType", targetDepth)) {
          context.nextToken();
          childWorkflowExecutionFailedEventAttributes.setWorkflowType(
              WorkflowTypeJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("reason", targetDepth)) {
          context.nextToken();
          childWorkflowExecutionFailedEventAttributes.setReason(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("details", targetDepth)) {
          context.nextToken();
          childWorkflowExecutionFailedEventAttributes.setDetails(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("initiatedEventId", targetDepth)) {
          context.nextToken();
          childWorkflowExecutionFailedEventAttributes.setInitiatedEventId(
              LongJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("startedEventId", targetDepth)) {
          context.nextToken();
          childWorkflowExecutionFailedEventAttributes.setStartedEventId(
              LongJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getCurrentDepth() <= originalDepth) break;
      }
      token = context.nextToken();
    }

    return childWorkflowExecutionFailedEventAttributes;
  }
コード例 #3
0
  public ActivityTask unmarshall(JsonUnmarshallerContext context) throws Exception {
    ActivityTask activityTask = new ActivityTask();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("taskToken", targetDepth)) {
          context.nextToken();
          activityTask.setTaskToken(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("activityId", targetDepth)) {
          context.nextToken();
          activityTask.setActivityId(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("startedEventId", targetDepth)) {
          context.nextToken();
          activityTask.setStartedEventId(LongJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("workflowExecution", targetDepth)) {
          context.nextToken();
          activityTask.setWorkflowExecution(
              WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("activityType", targetDepth)) {
          context.nextToken();
          activityTask.setActivityType(
              ActivityTypeJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("input", targetDepth)) {
          context.nextToken();
          activityTask.setInput(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }

      token = context.nextToken();
    }

    return activityTask;
  }
  public WorkflowExecutionCancelRequestedEventAttributes unmarshall(JsonUnmarshallerContext context)
      throws Exception {
    WorkflowExecutionCancelRequestedEventAttributes
        workflowExecutionCancelRequestedEventAttributes =
            new WorkflowExecutionCancelRequestedEventAttributes();

    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.currentToken;
    if (token == null) token = context.nextToken();

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("externalWorkflowExecution", targetDepth)) {
          context.nextToken();
          workflowExecutionCancelRequestedEventAttributes.setExternalWorkflowExecution(
              WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("externalInitiatedEventId", targetDepth)) {
          context.nextToken();
          workflowExecutionCancelRequestedEventAttributes.setExternalInitiatedEventId(
              LongJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("cause", targetDepth)) {
          context.nextToken();
          workflowExecutionCancelRequestedEventAttributes.setCause(
              StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getCurrentDepth() <= originalDepth) break;
      }

      token = context.nextToken();
    }

    return workflowExecutionCancelRequestedEventAttributes;
  }
  public ExternalWorkflowExecutionSignaledEventAttributes unmarshall(
      JsonUnmarshallerContext context) throws Exception {
    ExternalWorkflowExecutionSignaledEventAttributes
        externalWorkflowExecutionSignaledEventAttributes =
            new ExternalWorkflowExecutionSignaledEventAttributes();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("workflowExecution", targetDepth)) {
          context.nextToken();
          externalWorkflowExecutionSignaledEventAttributes.setWorkflowExecution(
              WorkflowExecutionJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("initiatedEventId", targetDepth)) {
          context.nextToken();
          externalWorkflowExecutionSignaledEventAttributes.setInitiatedEventId(
              context.getUnmarshaller(Long.class).unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }
      token = context.nextToken();
    }

    return externalWorkflowExecutionSignaledEventAttributes;
  }