Ejemplo n.º 1
0
        public History Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            History history = new History();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("events", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <HistoryEvent, HistoryEventUnmarshaller>(
                        HistoryEventUnmarshaller.GetInstance());
                    history.Events = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("nextPageToken", targetDepth))
                {
                    history.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(history);
        }
Ejemplo n.º 2
0
 public static HistoryEventUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new HistoryEventUnmarshaller();
     }
     return(instance);
 }
Ejemplo n.º 3
0
        public History Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            History history = new History();



            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("events", targetDepth))
                {
                    context.Read();
                    history.Events = new List <HistoryEvent>();
                    HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        history.Events.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("nextPageToken", targetDepth))
                {
                    context.Read();
                    history.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return(history);
                }
            }


            return(history);
        }
Ejemplo n.º 4
0
        public History Unmarshall(JsonUnmarshallerContext context)
        {
            History history = new History();

            history.Events = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("Events", targetDepth))
                    {
                        history.Events = new List <HistoryEvent>();
                        HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                history.Events.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("NextPageToken", targetDepth))
                    {
                        history.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(history);
                }
            }


            return(history);
        }
        public DecisionTask Unmarshall(JsonUnmarshallerContext context)
        {
            DecisionTask decisionTask = new DecisionTask();

            decisionTask.Events = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("TaskToken", targetDepth))
                    {
                        decisionTask.TaskToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("StartedEventId", targetDepth))
                    {
                        decisionTask.StartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("WorkflowExecution", targetDepth))
                    {
                        decisionTask.WorkflowExecution = WorkflowExecutionUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("WorkflowType", targetDepth))
                    {
                        decisionTask.WorkflowType = WorkflowTypeUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Events", targetDepth))
                    {
                        decisionTask.Events = new List <HistoryEvent>();
                        HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                decisionTask.Events.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("NextPageToken", targetDepth))
                    {
                        decisionTask.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("PreviousStartedEventId", targetDepth))
                    {
                        decisionTask.PreviousStartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(decisionTask);
                }
            }


            return(decisionTask);
        }
        public DecisionTask Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            DecisionTask decisionTask = new DecisionTask();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("taskToken", targetDepth))
                {
                    decisionTask.TaskToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("startedEventId", targetDepth))
                {
                    decisionTask.StartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("workflowExecution", targetDepth))
                {
                    decisionTask.WorkflowExecution = WorkflowExecutionUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("workflowType", targetDepth))
                {
                    decisionTask.WorkflowType = WorkflowTypeUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("events", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <HistoryEvent, HistoryEventUnmarshaller>(
                        HistoryEventUnmarshaller.GetInstance());
                    decisionTask.Events = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("nextPageToken", targetDepth))
                {
                    decisionTask.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("previousStartedEventId", targetDepth))
                {
                    decisionTask.PreviousStartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(decisionTask);
        }
        public DecisionTask Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            DecisionTask decisionTask = new DecisionTask();



            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("taskToken", targetDepth))
                {
                    context.Read();
                    decisionTask.TaskToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("startedEventId", targetDepth))
                {
                    context.Read();
                    decisionTask.StartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("workflowExecution", targetDepth))
                {
                    context.Read();
                    decisionTask.WorkflowExecution = WorkflowExecutionUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("workflowType", targetDepth))
                {
                    context.Read();
                    decisionTask.WorkflowType = WorkflowTypeUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("events", targetDepth))
                {
                    context.Read();
                    decisionTask.Events = new List <HistoryEvent>();
                    HistoryEventUnmarshaller unmarshaller = HistoryEventUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        decisionTask.Events.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

                if (context.TestExpression("nextPageToken", targetDepth))
                {
                    context.Read();
                    decisionTask.NextPageToken = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("previousStartedEventId", targetDepth))
                {
                    context.Read();
                    decisionTask.PreviousStartedEventId = LongUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return(decisionTask);
                }
            }


            return(decisionTask);
        }