/// <summary> /// A list of TopicChanges to a topic since a given date [sorted by date] /// </summary> /// <param name="topic">A given date</param> /// <param name="stamp">A non-null timestamp; changes before this time won't be included in the answer </param> /// <param name="rule">A composite cache rule to fill with rules that represented accumulated dependencies (or null)</param> /// <returns>Enumeration of TopicChanges</returns> public override TopicChangeCollection AllChangesForTopicSince(UnqualifiedTopicName topic, DateTime stamp) { TopicChangeCollection answer = new TopicChangeCollection(); SqlInfoForTopic[] infos = _sqlHelper.GetSqlTopicInfosForTopicSince(Namespace, topic.LocalName, stamp); ArrayList sortable = new ArrayList(); foreach (SqlInfoForTopic each in infos) { sortable.Add(new SqlInfoTopicData(each, Namespace)); } sortable.Sort(new TimeSort()); foreach (TopicData each in sortable) { if (each.LastModificationTime < stamp) { continue; } QualifiedTopicRevision name = new QualifiedTopicRevision(topic.LocalName, Namespace); name.Version = each.Version; TopicChange change = TopicChangeFromName(name); answer.Add(change); } return answer; }
public override TopicChangeCollection AllChangesForTopicSince(UnqualifiedTopicName topicName, DateTime stamp) { _allChangesForTopicSinceCalled = true; MockTopic topic = GetTopic(topicName, ExistencePolicy.ExistingOnly); // If the topicName does not exist, return a null list if (topic == null) { return null; } TopicChangeCollection changes = new TopicChangeCollection(); foreach (MockTopicRevision topicHistory in topic.History) { if (topicHistory.Created >= stamp) { QualifiedTopicRevision namespaceQualifiedTopic = new QualifiedTopicRevision(topicName.LocalName, Namespace); namespaceQualifiedTopic.Version = TopicRevision.NewVersionStringForUser(topicHistory.Author, topicHistory.Created); changes.Insert(0, new TopicChange(namespaceQualifiedTopic, topicHistory.Created, topicHistory.Author)); } } return changes; }
// Properties // Methods public override TopicChangeCollection AllChangesForTopicSince(UnqualifiedTopicName topic, DateTime stamp) { TopicChangeCollection changes = Next.AllChangesForTopicSince(topic, stamp); if (IsBuiltInTopic(topic)) { // All the built-in topics have a default revision at DateTime.MinValue. If the // timestamp is later than that, we don't report back the default revision. if (stamp == DateTime.MinValue) { if (changes == null) { changes = new TopicChangeCollection(); } changes.Insert(0, new TopicChange( new QualifiedTopicRevision( topic.LocalName, NamespaceManager.Namespace, QualifiedTopicRevision.NewVersionStringForUser(c_builtInAuthor, DateTime.MinValue)), DateTime.MinValue, c_builtInAuthor)); } } return changes; }
// Methods /// <summary> /// A list of TopicChanges to a topic since a given date [sorted by date] /// </summary> /// <param name="stamp">Specifies that we are only interested in changes after this date.</param> /// <param name="stamp">A non-null timestamp; changes before this time won't be included in the answer </param> /// <returns>Enumeration of TopicChanges</returns> /// <remarks>Returns a collection with zero elements in it when the topic name does not exist, or has been deleted, /// or if the calling user does not have the <see cref="Permission.Read"/> permission.</remarks> public override TopicChangeCollection AllChangesForTopicSince(UnqualifiedTopicName topic, DateTime stamp) { TopicChangeCollection answer = new TopicChangeCollection(); FileInformationCollection infos = FileInfosForTopic(topic.LocalName); ArrayList sortable = new ArrayList(); foreach (IFileInformation each in infos) { sortable.Add(new FileInfoTopicData(each, Namespace)); } sortable.Sort(new TimeSort()); foreach (TopicData each in sortable) { if (each.LastModificationTime < stamp) { continue; } QualifiedTopicRevision name = new QualifiedTopicRevision(topic.ResolveRelativeTo(Namespace)); name.Version = each.Version; // Version might be null if we grabbed the .wiki file instead of a .awiki file if (each.Version == null) { answer.Add(new TopicChange(name, each.LastModificationTime, "")); } else { TopicChange change = TopicChangeFromName(name); answer.Add(change); } } return answer; }
// Methods /// <summary> /// A list of TopicChanges to a topic since a given date [sorted by date] /// </summary> /// <param name="stamp">Specifies that we are only interested in changes after this date.</param> /// <param name="stamp">A non-null timestamp; changes before this time won't be included in the answer </param> /// <returns>Enumeration of TopicChanges</returns> /// <remarks>Returns a collection with zero elements in it when the topic name does not exist, or has been deleted, /// or if the calling user does not have the <see cref="Permission.Read"/> permission.</remarks> public override TopicChangeCollection AllChangesForTopicSince(UnqualifiedTopicName topic, DateTime stamp) { TopicChangeCollection answer = new TopicChangeCollection(); FileInfo[] infos = FileInfosForTopic(topic.LocalName); ArrayList sortable = new ArrayList(); foreach (FileInfo each in infos) { sortable.Add(new FileInfoTopicData(each, Namespace)); } sortable.Sort(new TimeSort()); foreach (TopicData each in sortable) { if (each.LastModificationTime < stamp) { continue; } QualifiedTopicRevision name = new QualifiedTopicRevision(topic.ResolveRelativeTo(Namespace)); name.Version = each.Version; TopicChange change = TopicChangeFromName(name); answer.Add(change); } return answer; }
internal TopicChangesCacheItem(TopicChangeCollection changes, DateTime since) { _changes = changes; _since = since; }
private void AssertChangesAreEqual(TopicChangeCollection expectedChanges, TopicChangeCollection actualChanges) { Assert.AreEqual(expectedChanges.Count, actualChanges.Count, "Number of changes are different."); for (int i = 0; i < expectedChanges.Count; i++) { TopicChange expectedChange = expectedChanges[i]; TopicChange actualChange = actualChanges[i]; Assert.AreEqual(0, actualChange.CompareTo(expectedChange), "Checking that changes are equivalent for " + actualChange.TopicRevision.DottedNameWithVersion + " and " + expectedChange.TopicRevision.DottedNameWithVersion); } }
private void Page_Load(object sender, System.EventArgs e) { _changeList = Federation.GetTopicChanges(new TopicName(TheTopic.LocalName, TheTopic.Namespace)); ShowPage(); }