private void AnalyzeWorkitems(EvaluationServiceContext context, List <TimeLog> list, List <TimeLogAnalyzer> analyzers) { if (list != null && list.Count > 0 && analyzers != null && analyzers.Count > 0) { list.ForEach(workitem => { analyzers.ForEach(p => p.Analyze(context, workitem)); //attach workitem to each observation workitem.Observations.ForEach(observation => { observation.WorkitemId = workitem.WorkitemId; observation.Type = ObservationType.Workitem; }); //attach workitem to each tasklevel observation workitem.Tasks .ForEach(task => task.Observations .ForEach(observation => { observation.WorkitemId = workitem.WorkitemId; observation.Type = ObservationType.Task; }) ); }); } }
protected override void Run(ServiceContext context) { Context = context as EvaluationServiceContext; if (Context == null) { throw new Exception("Configuration parameters not found"); } var notificationListeners = PluginService.GetPlugins <NotificationListener>(typeof(NotificationListener).FullName); var dataProvider = PluginService.GetPlugin <TimeLogDataProvider>(typeof(TimeLogDataProvider).FullName); var analyzers = PluginService.GetPlugins <TimeLogAnalyzer>(typeof(TimeLogAnalyzer).FullName); if (analyzers != null && analyzers.Count > 0) { analyzers.Sort(); } var workitems = dataProvider.LoadData(Context); AnalyzeWorkitems(Context, workitems, analyzers); RaiseGlobalNotifications(notificationListeners, workitems); RaiseTeamMemberNotifications(notificationListeners, workitems); }
public abstract List <TimeLog> LoadData(EvaluationServiceContext context);
public abstract void Analyze(EvaluationServiceContext context, TimeLog workitem);