private static string GetCurrentValueOrigin(IssueAttribute attribute, [CanBeNull] object currentValue, Guid startVersionGuid, [NotNull] ExceptionLineage lineage, out DateTime?importDate) { string origin = null; importDate = null; foreach (ManagedExceptionVersion exceptionObject in lineage.GetAll() .OrderByDescending(e => e.VersionBeginDate)) { if (!Equals(exceptionObject.GetValue(attribute), currentValue)) { // value is different --> next version (by date) must have introduced this value break; } if (exceptionObject.VersionUuid == startVersionGuid) { // start version for search (excluded) reached break; } // value is equal origin = exceptionObject.VersionImportOrigin; importDate = exceptionObject.VersionBeginDate; } return(origin); }
public Field(IssueAttribute attribute, [NotNull] FieldDefinition definition) { Assert.ArgumentNotNull(definition, nameof(definition)); Attribute = attribute; Definition = definition; }
public object GetValue(IssueAttribute attribute) { object value; return(_editableAttributes.TryGetValue(attribute, out value) ? value : null); }
private FieldDefinition GetFieldDefinition(IssueAttribute attribute) { FieldDefinition definition; return(_definitionsByAttribute.TryGetValue(attribute, out definition) ? definition : null); }
Action ActivatePageAndNavigate(IssueAttribute issueAttribute, Type type) { Action navigationAction = null; if (issueAttribute.NavigationBehavior == NavigationBehavior.PushAsync) { return(async() => { var page = ActivatePage(type); TrackOnInsights(page); await Navigation.PushAsync(page); }); } if (issueAttribute.NavigationBehavior == NavigationBehavior.PushModalAsync) { return(async() => { var page = ActivatePage(type); TrackOnInsights(page); await Navigation.PushModalAsync(page); }); } if (issueAttribute.NavigationBehavior == NavigationBehavior.Default) { return(async() => { var page = ActivatePage(type); TrackOnInsights(page); if (page is ContentPage || page is CarouselPage) { await Navigation.PushAsync(page); } else if (page is Shell) { Application.Current.MainPage = page; } else { await Navigation.PushModalAsync(page); } }); } if (issueAttribute.NavigationBehavior == NavigationBehavior.SetApplicationRoot) { return(() => { var page = ActivatePage(type); TrackOnInsights(page); Application.Current.MainPage = page; }); } return(navigationAction); }
public void SetValue(IssueAttribute attribute, [CanBeNull] object value) { if (attribute == IssueAttribute.ExceptionStatus) { // normalize the status value value = ExceptionObjectUtils.GetNormalizedStatus(value as string); } _editableAttributes[attribute] = value; }
private void WriteValue([NotNull] ManagedExceptionVersion managedExceptionVersion, IssueAttribute attribute, [NotNull] IRowBuffer buffer) { int fieldIndex = GetFieldIndex(attribute); object rawValue = managedExceptionVersion.GetValue(attribute); buffer.Value[fieldIndex] = FormatValue(rawValue); }
private int GetFieldIndex(IssueAttribute attribute) { int fieldIndex; if (!_attributeFieldIndexes.TryGetValue(attribute, out fieldIndex)) { fieldIndex = _targetFields.GetIndex(attribute, _targetTable); _attributeFieldIndexes.Add(attribute, fieldIndex); } return(fieldIndex); }
public ExceptionAttributeConflict(IssueAttribute attribute, object updateValue, object currentValue, object originalValue, [CanBeNull] string currentValueOrigin, DateTime?currentValueImportDate) { Attribute = attribute; UpdateValue = updateValue; CurrentValue = currentValue; OriginalValue = originalValue; CurrentValueOrigin = currentValueOrigin; CurrentValueImportDate = currentValueImportDate; }
private ExceptionAttributeConflict CreateConflict( IssueAttribute attribute, object newValue, object currentValue, object originalValue, Guid lineageUuid, Guid startVersionGuid) { ExceptionLineage lineage = _lineages[lineageUuid]; DateTime?currentValueImportDate; string currentValueOrigin = GetCurrentValueOrigin( attribute, currentValue, startVersionGuid, lineage, out currentValueImportDate); return(new ExceptionAttributeConflict(attribute, newValue, currentValue, originalValue, currentValueOrigin, currentValueImportDate)); }
public IField CreateField(IssueAttribute attribute, bool optional = false) { FieldDefinition definition = GetFieldDefinition(attribute); if (definition == null) { if (optional) { return(null); } throw new ArgumentException($@"Field definition not found for {attribute}", nameof(attribute)); } return(definition.CreateField()); }
public string GetName(IssueAttribute attribute, bool optional = false) { FieldDefinition fieldDefinition = GetFieldDefinition(attribute); if (fieldDefinition == null) { if (optional) { return(null); } throw new ArgumentException( $@"No field definition for attribute {attribute}", nameof(attribute)); } return(fieldDefinition.Name); }
Action ActivatePageAndNavigate (IssueAttribute issueAttribute, Type type) { Action navigationAction = null; if (issueAttribute.NavigationBehavior == NavigationBehavior.PushAsync) { return async () => { var page = ActivatePage (type); TrackOnInsights (page); await Navigation.PushAsync (page); }; } if (issueAttribute.NavigationBehavior == NavigationBehavior.PushModalAsync) { return async () => { var page = ActivatePage (type); TrackOnInsights (page); await Navigation.PushModalAsync (page); }; } if (issueAttribute.NavigationBehavior == NavigationBehavior.Default) { return async () => { var page = ActivatePage (type); TrackOnInsights (page); if (page is ContentPage || page is CarouselPage) { await Navigation.PushAsync (page); } else { await Navigation.PushModalAsync (page); } }; } if (issueAttribute.NavigationBehavior == NavigationBehavior.SetApplicationRoot) { return () => { var page = ActivatePage (type); TrackOnInsights (page); Application.Current.MainPage = page; }; } return navigationAction; }
public int GetIndex(IssueAttribute attribute, ITable table, bool optional = false) { Assert.ArgumentNotNull(table, nameof(table)); FieldDefinition fieldDefinition = GetFieldDefinition(attribute); if (fieldDefinition != null) { string fieldName = fieldDefinition.Name; return(GetIndex(fieldName, table, optional)); } if (optional) { return(-1); } throw new ArgumentException( $@"No field definition for attribute {attribute}", nameof(attribute)); }
private static bool HasField([NotNull] ITable table, IssueAttribute attribute, [NotNull] IIssueTableFields fields) { return(fields.GetIndex(attribute, table, optional: true) >= 0); }
protected int GetIndex(IssueAttribute attribute, bool optional = false) { return(_fields.GetIndex(attribute, _table, optional)); }
private static IssueTableFields.Field Map(IssueAttribute attribute, [NotNull] FieldDefinition definition) { return(new IssueTableFields.Field(attribute, definition)); }
public bool HasField(IssueAttribute attribute, ITable table) { return(GetIndex(attribute, table, optional: true) >= 0); }