Ejemplo n.º 1
0
        static TrackingProfile GetProfileWithWorkflowDataExtract()
        {
            //Create Tracking Profile
            TrackingProfile trackingProfile = new TrackingProfile();
            trackingProfile.Version = new Version("1.0.0");

            //Create Activity Track Point
            ActivityTrackPoint activityTrackPoint = new ActivityTrackPoint();

            //Create matchingActivityTrackingLocation 
            ActivityTrackingLocation matchingActivityTrackingLocation = new ActivityTrackingLocation();
            //Set ActivityName = "activityName"
            matchingActivityTrackingLocation.ActivityTypeName = "activityName";
            //Add all possible ActivityExecutionStatus to the matchingActivityTrackingLocation Events
            IEnumerable<ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable<ActivityExecutionStatus>;
            foreach (ActivityExecutionStatus status in statuses)
            {
                matchingActivityTrackingLocation.ExecutionStatusEvents.Add(status);
            }

            //Create matchingActivityTrackingCondition where memberName = memberValue
            ActivityTrackingCondition matchingActivityTrackingCondition = new ActivityTrackingCondition("memberName", "memberValue");
            matchingActivityTrackingCondition.Operator = ComparisonOperator.Equals;

            //Add matchingActivityTrackingCondition to activityTrackingLocation
            matchingActivityTrackingLocation.Conditions.Add(matchingActivityTrackingCondition);

            //Add matchingActivityTrackingCondition to the matching locations for activityTrackPoint
            activityTrackPoint.MatchingLocations.Add(matchingActivityTrackingLocation);

            //Create excludedActivityTrackingLocation 
            ActivityTrackingLocation excludedActivityTrackingLocation = new ActivityTrackingLocation();
            //Set ActivityName = "activityName"
            excludedActivityTrackingLocation.ActivityTypeName = "activityName";
            //Add Compensating ActivityExecutionStatus to the excludedActivityTrackingLocation Events
            excludedActivityTrackingLocation.ExecutionStatusEvents.Add(ActivityExecutionStatus.Compensating);

            //Add excludedActivityTrackingCondition to the excluded locations for activityTrackPoint
            activityTrackPoint.ExcludedLocations.Add(excludedActivityTrackingLocation);

            //Create workflowDataTrackingExtract to extract Workflow data "Name"
            WorkflowDataTrackingExtract workflowDataTrackingExtract = new WorkflowDataTrackingExtract();
            workflowDataTrackingExtract.Member = "Name";

            //Add workflowDataTrackingExtract to activityTrackPoint
            activityTrackPoint.Extracts.Add(workflowDataTrackingExtract);

            //Annotate activityTrackPoint with 
            activityTrackPoint.Annotations.Add("Track Point Annotations");

            //Add ActivityTrackPoints to trackingProfile 
            trackingProfile.ActivityTrackPoints.Add(activityTrackPoint);

            return trackingProfile;
        }
        private void CreateConditions(XmlReader reader, TrackingConditionCollection conditions)
        {
            if (null == reader)
                throw new ArgumentNullException("reader");

            if (null == conditions)
                throw new ArgumentNullException("conditions");

            if (0 != string.Compare("Conditions", reader.Name, StringComparison.Ordinal))
                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidPosition + "Conditions.");

            if (reader.IsEmptyElement)
                return;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (0 == string.Compare(reader.Name, "ActivityTrackingCondition", StringComparison.Ordinal))
                        {
                            ActivityTrackingCondition condition = new ActivityTrackingCondition();
                            CreateCondition(reader, condition);
                            conditions.Add(condition);
                        }
                        //
                        // Xsd validation will catch unknown elements

                        break;
                    case XmlNodeType.EndElement:
                        if (0 == string.Compare(reader.Name, "Conditions", StringComparison.Ordinal))
                            return;
                        break;
                }
            }
            //
            // Only valid exit is on an EndElement that matches the element that is passed in.
            throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + "Conditions.");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Saves a tracking condition for an activity
 /// </summary>
 /// <param name="activity"></param>
 /// <param name="key"></param>
 /// <param name="member"></param>
 /// <param name="op"></param>
 /// <param name="value"></param>
 internal void SaveTrackingCondition(Activity activity, ref ActivityTrackingCondition key, string member, ComparisonOperator op, string value)
 {
     ActivityTrackPoint trackPoint = GetTrackPointForActivity(activity);
     if (trackPoint != null)
     {
         if (key == null)
         {
             key = new ActivityTrackingCondition();
             trackPoint.MatchingLocations[0].Conditions.Add(key);
         }
         key.Member = member;
         key.Value = value;
         key.Operator = op;
     }
 }
        private void CreateConditions(XmlReader reader, TrackingConditionCollection conditions)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (conditions == null)
            {
                throw new ArgumentNullException("conditions");
            }
            if (string.Compare("Conditions", reader.Name, StringComparison.Ordinal) != 0)
            {
                throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationInvalidPosition + "Conditions.");
            }
            if (!reader.IsEmptyElement)
            {
                while (true)
                {
                    if (!reader.Read())
                    {
                        throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + "Conditions.");
                    }
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (string.Compare(reader.Name, "ActivityTrackingCondition", StringComparison.Ordinal) == 0)
                            {
                                ActivityTrackingCondition condition = new ActivityTrackingCondition();
                                this.CreateCondition(reader, condition);
                                conditions.Add(condition);
                            }
                            break;

                        case XmlNodeType.EndElement:
                            if (string.Compare(reader.Name, "Conditions", StringComparison.Ordinal) == 0)
                            {
                                return;
                            }
                            break;
                    }
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Deletes a tracking condition for an activity
 /// </summary>
 /// <param name="activity"></param>
 /// <param name="condition"></param>
 internal void DeleteTrackingCondition(Activity activity, ActivityTrackingCondition condition)
 {
     ActivityTrackPoint trackPoint = GetTrackPointForActivity(activity);
     if (trackPoint != null)
     {
         trackPoint.MatchingLocations[0].Conditions.Remove(condition);
     }
 }