Ejemplo n.º 1
0
        public static void RemoveMonitor(SPChangeMonitor monitor)
        {
            CommonHelper.ConfirmNotNull(monitor, "monitor");
            SPChangeQueryExecutor instance = factory.GetInstance(monitor.SiteId, () => new SPChangeQueryExecutor(monitor.SiteId));

            instance.monitors.Remove(monitor);
        }
Ejemplo n.º 2
0
        private void Execute()
        {
            DateTime now = DateTime.Now;

            if (monitors.Count > 0)
            {
                using (SPSite site = new SPSite(siteId, SPUserToken.SystemAccount)) {
                    List <SPChange>    collection = new List <SPChange>();
                    SPChangeQuery      query      = CreateQuery(lastCheckTime);
                    SPChangeCollection result     = site.GetChanges(query);
                    while (result.Count > 0)
                    {
                        collection.AddRange(result.OfType <SPChange>());
                        query.ChangeTokenStart = result.LastChangeToken;
                        result = site.GetChanges(query);
                    }
                    if (collection.Count > 0)
                    {
                        Dictionary <Tuple <Type, object>, SPAggregatedChange> dictionary = new Dictionary <Tuple <Type, object>, SPAggregatedChange>();
                        foreach (SPChange item in collection)
                        {
                            SPAggregatedChange record = dictionary.EnsureKeyValue(Tuple.Create(item.GetType(), SPChangeMonitor.GetUniqueKey(item)));
                            record.Add(item);
                        }
                        foreach (SPChangeMonitor monitor in monitors)
                        {
                            monitor.ProcessChanges(dictionary.Values);
                        }
                    }
                }
            }
            lastCheckTime = now;
        }
Ejemplo n.º 3
0
 private static bool IsSet(ulong bitmask, SPChangeObjectType value)
 {
     return((bitmask & SPChangeMonitor.GetBitmaskValue(value)) != 0);
 }