Example #1
0
        /// <summary>
        /// Creates and saves a default tracking profile
        /// </summary>
        /// <returns></returns>
        private TrackingProfile BuildDefaultProfile()
        {
            //return a default profile that tracks all possible
            //workflow events and activity status values
            TrackingProfile profile = new TrackingProfile();

            //
            //create a workflow track point and location
            //
            WorkflowTrackPoint workflowPoint
                = new WorkflowTrackPoint();
            //add all possible workflow events
            List <TrackingWorkflowEvent> workflowEvents
                = new List <TrackingWorkflowEvent>();

            workflowEvents.AddRange(
                Enum.GetValues(typeof(TrackingWorkflowEvent))
                as IEnumerable <TrackingWorkflowEvent>);
            WorkflowTrackingLocation workflowLocation
                = new WorkflowTrackingLocation(workflowEvents);

            workflowPoint.MatchingLocation = workflowLocation;
            profile.WorkflowTrackPoints.Add(workflowPoint);

            //
            //create an activity track point and location
            //
            ActivityTrackPoint activityPoint
                = new ActivityTrackPoint();
            //add all possible activity execution status values
            List <ActivityExecutionStatus> activityStatus
                = new List <ActivityExecutionStatus>();

            activityStatus.AddRange(
                Enum.GetValues(typeof(ActivityExecutionStatus))
                as IEnumerable <ActivityExecutionStatus>);
            ActivityTrackingLocation activityLocation
                = new ActivityTrackingLocation(
                      typeof(Activity), true, activityStatus);

            activityPoint.MatchingLocations.Add(activityLocation);
            profile.ActivityTrackPoints.Add(activityPoint);

            //
            //create a user track point and location
            //
            UserTrackPoint       userPoint = new UserTrackPoint();
            UserTrackingLocation userLocation
                = new UserTrackingLocation(
                      typeof(Object), typeof(Activity));

            userLocation.MatchDerivedActivityTypes = true;
            userLocation.MatchDerivedArgumentTypes = true;
            userPoint.MatchingLocations.Add(userLocation);
            profile.UserTrackPoints.Add(userPoint);

            //set the profile version
            profile.Version = new Version(1, 0, 0);
            return(profile);
        }
Example #2
0
        /// <summary>
        /// Loads create a Default profile
        /// </summary>
        /// <returns></returns>
        private static TrackingProfile GetDefaultProfile(Type workflowType)
        {
            TrackingProfile profile = new TrackingProfile();

            profile.Version = new Version(1, 0, 0, 0);

            // all activity events
            ActivityTrackPoint             atp = new ActivityTrackPoint();
            List <ActivityExecutionStatus> executionStatusLists = new List <ActivityExecutionStatus>();

            foreach (ActivityExecutionStatus status in Enum.GetValues(typeof(ActivityExecutionStatus)))
            {
                executionStatusLists.Add(status);
            }
            ActivityTrackingLocation activityTrackingLocation = new ActivityTrackingLocation(typeof(Activity), true, executionStatusLists);

            atp.MatchingLocations.Add(activityTrackingLocation);


            WorkflowDataTrackingExtract we = new WorkflowDataTrackingExtract("SetupId");

            atp.Extracts.Add(we);

            profile.ActivityTrackPoints.Add(atp);

            // all user TrackData events
            UserTrackPoint utp = new UserTrackPoint();

            UserTrackingLocation userTrackingLocation = new UserTrackingLocation();

            userTrackingLocation.ActivityType = typeof(Activity);
            //userTrackingLocation.MatchDerivedActivityTypes = true;
            userTrackingLocation.ArgumentType = typeof(object);
            //userTrackingLocation.MatchDerivedArgumentTypes = true;
            utp.MatchingLocations.Add(userTrackingLocation);

            profile.UserTrackPoints.Add(utp);

            // all workflow events
            WorkflowTrackPoint wftp = new WorkflowTrackPoint();

            foreach (TrackingWorkflowEvent evt in Enum.GetValues(typeof(TrackingWorkflowEvent)))
            {
                wftp.MatchingLocation.Events.Add(evt);
            }
            profile.WorkflowTrackPoints.Add(wftp);

            return(profile);
        }
        // Profile creation
        private static TrackingProfile GetProfile()
        {
            // Create a Tracking Profile
            TrackingProfile profile = new TrackingProfile();

            profile.Version = new Version("3.0.0");

            // Add a TrackPoint to cover all activity status events
            ActivityTrackPoint       activityTrackPoint = new ActivityTrackPoint();
            ActivityTrackingLocation activityLocation   = new ActivityTrackingLocation(typeof(Activity));

            activityLocation.MatchDerivedTypes = true;
            WorkflowTrackingLocation wLocation = new WorkflowTrackingLocation();

            IEnumerable <ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable <ActivityExecutionStatus>;

            foreach (ActivityExecutionStatus status in statuses)
            {
                activityLocation.ExecutionStatusEvents.Add(status);
            }

            activityTrackPoint.MatchingLocations.Add(activityLocation);
            profile.ActivityTrackPoints.Add(activityTrackPoint);

            // Add a TrackPoint to cover all workflow status events
            WorkflowTrackPoint workflowTrackPoint = new WorkflowTrackPoint();

            workflowTrackPoint.MatchingLocation = new WorkflowTrackingLocation();
            foreach (TrackingWorkflowEvent workflowEvent in Enum.GetValues(typeof(TrackingWorkflowEvent)))
            {
                workflowTrackPoint.MatchingLocation.Events.Add(workflowEvent);
            }
            profile.WorkflowTrackPoints.Add(workflowTrackPoint);

            // Add a TrackPoint to cover all user track points
            UserTrackPoint       userTrackPoint = new UserTrackPoint();
            UserTrackingLocation userLocation   = new UserTrackingLocation();

            userLocation.ActivityType = typeof(Activity);
            userLocation.MatchDerivedActivityTypes = true;
            userLocation.ArgumentType = typeof(object);
            userLocation.MatchDerivedArgumentTypes = true;
            userTrackPoint.MatchingLocations.Add(userLocation);
            profile.UserTrackPoints.Add(userTrackPoint);

            return(profile);
        }
Example #4
0
        static TrackingProfile GetProfileWithUserTrackPoint()
        {
            TrackingProfile trackingProfile = new TrackingProfile();

            trackingProfile.Version = new Version("1.0.0");

            // Add a TrackPoint to cover all user track points
            UserTrackPoint       userTrackPoint = new UserTrackPoint();
            UserTrackingLocation userLocation   = new UserTrackingLocation();

            userLocation.ActivityType = typeof(Activity);
            userLocation.MatchDerivedActivityTypes = true;
            userLocation.ArgumentType = typeof(object);
            userLocation.MatchDerivedArgumentTypes = true;
            userTrackPoint.MatchingLocations.Add(userLocation);
            trackingProfile.UserTrackPoints.Add(userTrackPoint);

            return(trackingProfile);
        }
Example #5
0
        private static void CreateAndInsertTrackingProfile()
        {
            TrackingProfile profile = new TrackingProfile();

            ActivityTrackPoint       trackPoint = new ActivityTrackPoint();
            ActivityTrackingLocation location   = new ActivityTrackingLocation(typeof(Activity));

            location.MatchDerivedTypes = true;

            IEnumerable <ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable <ActivityExecutionStatus>;

            foreach (ActivityExecutionStatus status in statuses)
            {
                location.ExecutionStatusEvents.Add(status);
            }

            trackPoint.MatchingLocations.Add(location);
            profile.ActivityTrackPoints.Add(trackPoint);
            profile.Version = new Version("3.0.0.0");


            // Adding a user track point to the tracking profile
            UserTrackPoint utp = new UserTrackPoint();

            // Adding a user location to the track point
            UserTrackingLocation ul = new UserTrackingLocation(typeof(string), typeof(CodeActivity));

            ul.MatchDerivedActivityTypes = true;
            utp.MatchingLocations.Add(ul);
            profile.UserTrackPoints.Add(utp);


            // Serialize the profile
            TrackingProfileSerializer serializer = new TrackingProfileSerializer();
            StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);

            serializer.Serialize(writer, profile);
            string trackingprofile = writer.ToString();

            InsertTrackingProfile(trackingprofile);
        }
Example #6
0
        // Profile creation
        private static TrackingProfile GetProfile()
        {
            // Create a Tracking Profile that covers all user track points.
            TrackingProfile profile = new TrackingProfile();

            profile.Version = new Version("1.0.0");

            // Add a TrackPoint to cover all user track points.
            // We want to receive user events generated by any Activity, with any argument type.
            // We could restrict the ActivityType to be PolicyActivity and
            // ArgumentType to be RuleActionTrackingEvent if we wanted to only get
            // tracking events from policy execution.
            UserTrackPoint       userTrackPoint = new UserTrackPoint();
            UserTrackingLocation userLocation   = new UserTrackingLocation();

            userLocation.ActivityType = typeof(Activity);
            userLocation.MatchDerivedActivityTypes = true;
            userLocation.ArgumentType = typeof(object);
            userLocation.MatchDerivedArgumentTypes = true;
            userTrackPoint.MatchingLocations.Add(userLocation);
            profile.UserTrackPoints.Add(userTrackPoint);

            return(profile);
        }