public RevisionMarker(string id, string author, DateTime date, RevisionType revType) { Id = id; Author = author; Date = date; RevType = revType; }
private void cmbRevisionType_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e) { MessageBoxResult confirm = MessageBox.Show("Do you really want to change Role Type filter?\r\nAll unsaved jobs will be reset.", "", MessageBoxButton.OKCancel); if (confirm == MessageBoxResult.OK) { RevisionType selectedRevisionType = (RevisionType)cmbRevisionType.SelectedItem; _currentApp.SelectedRevisionTypeId = selectedRevisionType.RevisionTypeId; ResetEditEstimateUserID(); if (MainFrame.Source != null && MainFrame.Source.OriginalString == "/EstimateList.xaml") { MainFrame.Refresh(); } else { MainFrame.Navigate(new Uri("/EstimateList.xaml", UriKind.Relative)); } } else { //Change Revision Type to what it was //Remove SelectionChanged EventHandler before modifying value cmbRevisionType.SelectionChanged -= new Telerik.Windows.Controls.SelectionChangedEventHandler(cmbRevisionType_SelectionChanged); //Modify value cmbRevisionType.SelectedValue = _currentApp.SelectedRevisionTypeId; //Add SelectionChanged EventHandler cmbRevisionType.SelectionChanged += new Telerik.Windows.Controls.SelectionChangedEventHandler(cmbRevisionType_SelectionChanged); } }
public EntityRevisionInfo(T entityRevision, RevisionType operation, long revisionId, DateTime timestamp) { EntityRevision = entityRevision; Operation = operation; RevisionId = revisionId; Timestamp = timestamp; }
public virtual void EntityChanged(System.Type entityClass, string entityName, object entityId, RevisionType revisionType, object revisionEntity) { var castedListener = _listener as IEntityTrackingRevisionListener; if (castedListener != null) { castedListener.EntityChanged(entityClass, entityName, entityId, revisionType, revisionEntity); } }
public FakeRelationChange(object owningEntity, RelationDescription rd, RevisionType revisionType, object index) { this.owningEntity = owningEntity; this.rd = rd; this.revisionType = revisionType; this.index = index; }
/// <summary> /// 获得MarkDown /// </summary> /// <param name="strArticleId"></param> /// <returns></returns> public static ArticleContent GetMarkDown(string strArticleId, RevisionType Rtype) { IMongoQuery ArticleIdQuery = Query.EQ(nameof(ArticleID), strArticleId); IMongoQuery RevisionQuery = Query.EQ(nameof(Revision), Rtype); IMongoQuery MarkDownExistQuery = Query.EQ(nameof(ContentType), MarkDown); var Draft = MongoDbRepository.GetFirstRec <ArticleContent>(Query.And(ArticleIdQuery, RevisionQuery, MarkDownExistQuery)); return(Draft); }
/// <summary> /// Create IRevisionMarker from specified Token /// </summary> /// <param name="item"></param> /// <param name="type"></param> /// <returns></returns> private IAbstractMarkupDataContainer GetRevisionMarker(Token item, RevisionType type) { var revisionProperties = ItemFactory.CreateRevisionProperties(type); revisionProperties.Author = item.Author; revisionProperties.Date = item.Date; var revision = ItemFactory.CreateRevision(revisionProperties); return(revision); }
public RevisionMarker() { Id = Guid.NewGuid().ToString(); ContentSectionId = string.Empty; RecordId = -1; DocumentActivityId = -1; Author = string.Empty; Created = null; RevType = RevisionType.Unchanged; }
protected void FillDataWithId(IDictionary<String, Object> data, Object revision, RevisionType revisionType) { AuditEntitiesConfiguration entitiesCfg = verCfg.AuditEntCfg; IDictionary<String, Object> originalId = new Dictionary<String, Object>(); originalId.Add(entitiesCfg.RevisionFieldName, revision); verCfg.EntCfg[EntityName].GetIdMapper().MapToMapFromId(originalId, EntityId); data.Add(entitiesCfg.RevisionTypePropName, revisionType.Representation); data.Add(entitiesCfg.OriginalIdPropName, originalId); }
public override void EntityChanged(System.Type entityClass, string entityName, object entityId, RevisionType revisionType, object revisionEntity) { base.EntityChanged(entityClass, entityName, entityId, revisionType, revisionEntity); var modifiedEntityNames = (ISet<string>)modifiedEntityTypesGetter.Get(revisionEntity); if (modifiedEntityNames == null) { modifiedEntityNames = new HashedSet<string>(); modifiedEntityTypesSetter.Set(revisionEntity, modifiedEntityNames); } modifiedEntityNames.Add(entityName); }
/// <summary> /// 获得MD文字 /// </summary> /// <param name="strArticleId"></param> /// <param name="Rtype"></param> /// <returns></returns> public static string GetMarkDownString(string strArticleId, RevisionType Rtype) { var Document = GetMarkDown(strArticleId, Rtype); if (Document == null) { InfraStructure.Log.ExceptionLog.Log("SYSTEM", "GetHtmlString", "strArticleId=" + strArticleId, "NULL"); return(string.Empty); } return(Document.Content); }
public IEnumerable<object> FindEntities(long revision, RevisionType revisionType) { var entityTypes = FindEntityTypes(revision); var result = new List<object>(); foreach (var type in entityTypes) { result.AddRange(_auditReaderImplementor.CreateQuery().ForEntitiesModifiedAtRevision(type.First, revision) .Add(new RevisionTypeAuditExpression(revisionType, "=")).GetResultList<object>()); } return result; }
protected AbstractAuditWorkUnit(ISessionImplementor sessionImplementor, string entityName, AuditConfiguration verCfg, object id, RevisionType revisionType) { SessionImplementor = sessionImplementor; VerCfg = verCfg; EntityId = id; RevisionType = revisionType; EntityName = entityName; }
public IEnumerable <object> FindEntities(long revision, RevisionType revisionType) { var entityTypes = FindEntityTypes(revision); var result = new List <object>(); foreach (var type in entityTypes) { result.AddRange(_auditReaderImplementor.CreateQuery().ForEntitiesModifiedAtRevision(type.Item1, revision) .Add(new RevisionTypeAuditExpression(revisionType, "=")).GetResultList <object>()); } return(result); }
public IList <object[]> GetRawRevisions(Type type, RevisionType revisionType, DateTime?startDate, DateTime?endDate) { IAuditQuery q = AuditReaderFactory.Get(Session).CreateQuery() .ForRevisionsOfEntity(type, false, true) .Add(AuditEntity.RevisionType().Eq(revisionType)) .AddOrder(AuditEntity.RevisionProperty("REVTSTMP").Desc()); if (startDate.HasValue && endDate.HasValue) { q = q.Add(AuditEntity.RevisionProperty("REVTSTMP").Between(startDate, endDate)); } return(q.GetResultList <object[]>()); }
public static void SelectRevisionType(UserDefinedSettings settings, RevisionType type) { switch (type) { case RevisionType.Commit: settings.RevisionType = "Commit"; break; case RevisionType.Version: settings.RevisionType = "Version"; break; } }
public FakeBidirectionalRelationWorkUnit(ISessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg, Object id, String referencingPropertyName, Object owningEntity, RelationDescription rd, RevisionType revisionType, Object index, IAuditWorkUnit nestedWorkUnit) : base(sessionImplementor, entityName, verCfg, id) { this.nestedWorkUnit = nestedWorkUnit; // Adding the change for the relation. fakeRelationChanges = new Dictionary<String, FakeRelationChange>(); fakeRelationChanges.Add(referencingPropertyName, new FakeRelationChange(owningEntity, rd, revisionType, index)); }
public FakeBidirectionalRelationWorkUnit(ISessionImplementor sessionImplementor, String entityName, AuditConfiguration verCfg, Object id, String referencingPropertyName, Object owningEntity, RelationDescription rd, RevisionType revisionType, Object index, IAuditWorkUnit nestedWorkUnit) : base(sessionImplementor, entityName, verCfg, id) { this.nestedWorkUnit = nestedWorkUnit; // Adding the change for the relation. fakeRelationChanges = new Dictionary <String, FakeRelationChange>(); fakeRelationChanges.Add(referencingPropertyName, new FakeRelationChange(owningEntity, rd, revisionType, index)); }
internal RevisionBrowserTypeItem(RevisionType type, RevisionBrowserModel owner) : base(null, owner) { Type = type; switch (type) { case RevisionType.Commit: Name = "Commits"; break; case RevisionType.Version: Name = "Versions"; break; default: Debug.Assert(false); break; } TimeAgo = String.Empty; }
internal void UpdateReviewedRevisions(HashSet <string> revisions, RevisionType affectedType) { RevisionBrowserModel model = getModel(); if (model.Data != null && model.Data.BaseSha != null && model.Data.Revisions != null) { RevisionBrowserModelData newData = new RevisionBrowserModelData( model.Data.BaseSha, model.Data.Revisions[RevisionType.Commit].Cast <Commit>(), model.Data.Revisions[RevisionType.Version].Cast <GitLabSharp.Entities.Version>(), revisions); SetData(newData, affectedType); } }
public object NullSafeGet(IDataReader resultSet, String[] names, Object owner) { if (resultSet.Read()) { try{ Byte representation = (Byte)resultSet[names[0]]; return(RevisionType.fromRepresentation(representation)); } catch (IndexOutOfRangeException) { return(null); } } return(null); }
private void setDefaultRevisionTypeRadioValue() { RevisionType defaultRevisionType = ConfigurationHelper.GetDefaultRevisionType(Program.Settings); switch (defaultRevisionType) { case RevisionType.Commit: radioButtonCommits.Checked = true; break; case RevisionType.Version: radioButtonVersions.Checked = true; break; } }
public Revision(string name, RevisionType type) { #region Preconditions if (name == null) throw new ArgumentNullException(nameof(name)); if (type == RevisionType.Unknown) throw new ArgumentNullException("May not be Unknown", nameof(type)); #endregion Name = name; Type = type; }
/// <summary> /// A revision in a Git repository, by the fully-qualified reference /// name or the commit ID. /// </summary> /// <param name="refNameOrCommitId">The reference name or commit ID</param> public Revision(string refNameOrCommitId) { if (refNameOrCommitId.StartsWith("refs/heads/")) { type = RevisionType.Branch; version = refNameOrCommitId.Substring(11); } else if (refNameOrCommitId.StartsWith("refs/tags/")) { type = RevisionType.Tag; version = refNameOrCommitId.Substring(10); } else { type = RevisionType.Commit; version = new ObjectId(refNameOrCommitId).ToString(); } }
private void addCollectionChanges(IList <PersistentCollectionChangeData> collectionChanges, ISet <Object> changed, RevisionType revisionType, object id) { foreach (Object changedObj in changed) { IDictionary <String, Object> entityData = new Dictionary <String, Object>(); IDictionary <String, Object> originalId = new Dictionary <String, Object>(); entityData.Add(commonCollectionMapperData.VerEntCfg.OriginalIdPropName, originalId); collectionChanges.Add(new PersistentCollectionChangeData( commonCollectionMapperData.VersionsMiddleEntityName, entityData, changedObj)); // Mapping the collection owner's id. commonCollectionMapperData.ReferencingIdData.PrefixedMapper.MapToMapFromId(originalId, id); // Mapping collection element and index (if present). MapToMapFromObject(originalId, changedObj); entityData.Add(commonCollectionMapperData.VerEntCfg.RevisionTypePropName, revisionType); } }
private void GenerateFakeBidirecationalRelationWorkUnits(AuditSync verSync, IPersistentCollection newColl, object oldColl, String collectionEntityName, String referencingPropertyName, AbstractCollectionEvent evt, RelationDescription rd) { // First computing the relation changes IList <PersistentCollectionChangeData> collectionChanges = verCfg.EntCfg[collectionEntityName].PropertyMapper .MapCollectionChanges(referencingPropertyName, newColl, oldColl, evt.AffectedOwnerIdOrNull); // Getting the id mapper for the related entity, as the work units generated will corrspond to the related // entities. String relatedEntityName = rd.ToEntityName; IIdMapper relatedIdMapper = verCfg.EntCfg[relatedEntityName].GetIdMapper(); // For each collection change, generating the bidirectional work unit. foreach (PersistentCollectionChangeData changeData in collectionChanges) { Object relatedObj = changeData.GetChangedElement(); object relatedId = relatedIdMapper.MapToIdFromEntity(relatedObj); RevisionType revType = (RevisionType)changeData.getData()[verCfg.AuditEntCfg.RevisionTypePropName]; // This can be different from relatedEntityName, in case of inheritance (the real entity may be a subclass // of relatedEntityName). String realRelatedEntityName = evt.Session.BestGuessEntityName(relatedObj); // By default, the nested work unit is a collection change work unit. IAuditWorkUnit nestedWorkUnit = new CollectionChangeWorkUnit(evt.Session, realRelatedEntityName, verCfg, relatedId, relatedObj); verSync.AddWorkUnit(new FakeBidirectionalRelationWorkUnit(evt.Session, realRelatedEntityName, verCfg, relatedId, referencingPropertyName, evt.AffectedOwnerOrNull, rd, revType, changeData.GetChangedElementIndex(), nestedWorkUnit)); } // We also have to generate a collection change work unit for the owning entity. verSync.AddWorkUnit(new CollectionChangeWorkUnit(evt.Session, collectionEntityName, verCfg, evt.AffectedOwnerIdOrNull, evt.AffectedOwnerOrNull)); }
internal void SetData(RevisionBrowserModelData data, RevisionType defaultRevisionType) { // We want to re-expand all previously expanded types if they are collapsed by upgrading the Model Dictionary <RevisionType, bool> oldExpandedState = new Dictionary <RevisionType, bool>(); foreach (RevisionType type in new RevisionType[] { RevisionType.Commit, RevisionType.Version }) { oldExpandedState[type] = getRevisionTypeNode(type).IsExpanded; } getModel().Data = data; autoSelectRevision(getRevisionTypeNode(defaultRevisionType)); foreach (KeyValuePair <RevisionType, bool> kv in oldExpandedState.Where(x => x.Value)) { getRevisionTypeNode(kv.Key).Expand(); } if (_treeView.SelectedNode != null) { _treeView.EnsureVisible(_treeView.SelectedNode); } }
private void addCollectionChanges(ISessionImplementor session, ICollection <PersistentCollectionChangeData> collectionChanges, IEnumerable changed, RevisionType revisionType, object id) { var ordinal = 0; foreach (var changedObj in changed) { var entityData = new Dictionary <string, object>(); var originalId = CreateIdMap(ordinal++); entityData.Add(CommonCollectionMapperData.VerEntCfg.OriginalIdPropName, originalId); collectionChanges.Add(new PersistentCollectionChangeData( CommonCollectionMapperData.VersionsMiddleEntityName, entityData, changedObj)); // Mapping the collection owner's id. CommonCollectionMapperData.ReferencingIdData.PrefixedMapper.MapToMapFromId(originalId, id); // Mapping collection element and index (if present). MapToMapFromObject(session, originalId, entityData, changedObj); (_revisionTypeInId ? originalId : entityData).Add(CommonCollectionMapperData.VerEntCfg.RevisionTypePropName, revisionType); } }
public RevisionEntityInfo(TEntity entity, TRevisionEntity revisionEntity, RevisionType operation) { Entity = entity; RevisionEntity = revisionEntity; Operation = operation; }
public RandomTargetGenerator(RevisionType revisionTypeToIgnore) { this.revisionTypeToIgnore = revisionTypeToIgnore; }
/// <summary> /// Default constructor /// </summary> public RandomTargetGenerator() { revisionTypeToIgnore = RevisionType.Delete; }
private void addCollectionChanges(ICollection<PersistentCollectionChangeData> collectionChanges, IEnumerable changed, RevisionType revisionType, object id) { foreach (var changedObj in changed) { var entityData = new Dictionary<string, object>(); var originalId = new Dictionary<string, object>(); entityData.Add(CommonCollectionMapperData.VerEntCfg.OriginalIdPropName, originalId); collectionChanges.Add(new PersistentCollectionChangeData( CommonCollectionMapperData.VersionsMiddleEntityName, entityData, changedObj)); // Mapping the collection owner's id. CommonCollectionMapperData.ReferencingIdData.PrefixedMapper.MapToMapFromId(originalId, id); // Mapping collection element and index (if present). MapToMapFromObject(originalId, changedObj); entityData.Add(CommonCollectionMapperData.VerEntCfg.RevisionTypePropName, revisionType); } }
private void checkRevisionData(IList <object> result, int revision, RevisionType type, StrIntTestEntity entity) { result[0].Should().Be.EqualTo(entity); ((DefaultRevisionEntity)result[1]).Id.Should().Be.EqualTo(revision); result[2].Should().Be.EqualTo(type); }
public SourceToTargetCopy(RevisionType revisionTypeToIgnore) { this.revisionTypeToIgnore = revisionTypeToIgnore; }
/// <summary> /// Default constructor /// </summary> public SourceToTargetCopy() { revisionTypeToIgnore = RevisionType.Delete; }
/// <summary> /// A revision in a Git repository, by the commit ID. /// </summary> /// <param name="commitId"></param> public Revision(ObjectId commitId) { type = RevisionType.Commit; version = commitId.ToString(); }
protected void FillDataWithId(IDictionary <String, Object> data, Object revision, RevisionType revisionType) { AuditEntitiesConfiguration entitiesCfg = verCfg.AuditEntCfg; IDictionary <String, Object> originalId = new Dictionary <String, Object>(); originalId.Add(entitiesCfg.RevisionFieldName, revision); verCfg.EntCfg[EntityName].GetIdMapper().MapToMapFromId(originalId, EntityId); data.Add(entitiesCfg.RevisionTypePropName, revisionType.Representation); data.Add(entitiesCfg.OriginalIdPropName, originalId); }