/// <summary> /// The method can be called to clear all current property values from the journal. The version is left /// unchanged. /// </summary> public override void ClearProperties() { classification = null; categories = null; url = null; uid = null; lastMod = null; dateCreated = null; startDate = null; timeStamp = null; summary = null; desc = null; sequence = null; comment = null; organizer = null; recurId = null; status = null; contacts = null; attendees = null; relatedTo = null; attachments = null; reqStats = null; customProps = null; base.ClearProperties(); }
/// <summary> /// This is overridden to allow copying of the additional properties /// </summary> /// <param name="p">The PDI object from which the settings are to be copied</param> protected override void Clone(PDIObject p) { VJournal o = (VJournal)p; this.ClearProperties(); classification = (ClassificationProperty)o.Classification.Clone(); categories = (CategoriesProperty)o.Categories.Clone(); url = (UrlProperty)o.Url.Clone(); uid = (UniqueIdProperty)o.UniqueId.Clone(); lastMod = (LastModifiedProperty)o.LastModified.Clone(); dateCreated = (DateCreatedProperty)o.DateCreated.Clone(); startDate = (StartDateProperty)o.StartDateTime.Clone(); timeStamp = (TimeStampProperty)o.TimeStamp.Clone(); summary = (SummaryProperty)o.Summary.Clone(); desc = (DescriptionProperty)o.Description.Clone(); sequence = (SequenceProperty)o.Sequence.Clone(); comment = (CommentProperty)o.Comment.Clone(); organizer = (OrganizerProperty)o.Organizer.Clone(); recurId = (RecurrenceIdProperty)o.RecurrenceId.Clone(); status = (StatusProperty)o.Status.Clone(); this.Contacts.CloneRange(o.Contacts); this.Attendees.CloneRange(o.Attendees); this.RelatedTo.CloneRange(o.RelatedTo); this.Attachments.CloneRange(o.Attachments); this.RequestStatuses.CloneRange(o.RequestStatuses); this.CustomProperties.CloneRange(o.CustomProperties); base.Clone(p); }
/// <summary> /// Устанавливает метод для события изменения статуса состояний /// </summary> /// <param name="Method"></param> public void SetPropertyEventMethod(StatusProperty Method) { foreach (var item in Items) { item.StatusChangedEvent += Method; } }
public int GetStatusValue(StatusProperty statuscode) { if (statuscode != null) { return(statuscode.Value.Value); } return(-1); }
internal IssueTracker( string plugName, string projectKey, StatusProperty statusField) { PlugName = plugName; ProjectKey = projectKey; StatusField = statusField; }
public void StatusPropertyClass() { StatusProperty property = new StatusProperty("Property", "Value"); string prop = property.ToString(); Assert.IsTrue(prop.Contains("Property")); Assert.IsTrue(prop.Contains("Value")); Assert.AreEqual("<null>", StatusProperty.Create("TestNullToString", new NullToString()).Value); }
public override async Task FromDataContractAsync(object dataContract, object options, CancellationToken token = default) { await base.FromDataContractAsync(dataContract, options, token); if (!StatusProperty.IsNull() && StatusProperty.Value.Id == SalesOrderStatus.Shipped) { Editable = false; } }
public void StatusResultsBuilderProperties() { using (AmbientClock.Pause()) { StatusCheckerTest checker = new StatusCheckerTest(); StatusResultsBuilder test = new StatusResultsBuilder(checker, new StatusProperty[] { new StatusProperty("Property1", "Value1"), new StatusProperty("Property2", "Value2") }); StatusProperty property = test.FindProperty("Property1"); Assert.AreEqual("Value1", property?.Value); } }
internal IssueTracker( string plug, string projectKey, string titleField, StatusProperty statusField) { Plug = plug; ProjectKey = string.IsNullOrEmpty(projectKey) ? "default_proj" : projectKey; TitleField = titleField; StatusField = statusField; }
public PlasticSCM( bool bApprovedCodeReviewFilterEnabled, StatusProperty statusAttribute) { IsApprovedCodeReviewFilterEnabled = bApprovedCodeReviewFilterEnabled; StatusAttribute = statusAttribute; IsBranchAttrFilterEnabled = statusAttribute != null && !string.IsNullOrWhiteSpace(statusAttribute.Name) && !string.IsNullOrWhiteSpace(statusAttribute.ResolvedValue); }
internal static IssueTracker BuildFromConfig(JToken jToken) { string plugName = Field.GetString(jToken, "plugName"); if (string.IsNullOrEmpty(plugName) || plugName.ToLowerInvariant().Trim().Equals("none")) { return(null); } IssueTracker result = new IssueTracker( plugName, Field.GetString(jToken, "projectKey"), StatusProperty.BuildFromConfig(jToken["statusFieldGroup"])); return(result); }
public PlasticSCM( bool bApprovedCodeReviewFilterEnabled, StatusProperty statusAttribute, bool bAutoLabelEnabled, string autoLabelPattern) { IsApprovedCodeReviewFilterEnabled = bApprovedCodeReviewFilterEnabled; StatusAttribute = statusAttribute; IsAutoLabelEnabled = bAutoLabelEnabled; AutomaticLabelPattern = autoLabelPattern; IsBranchAttrFilterEnabled = !string.IsNullOrWhiteSpace(statusAttribute.Name) && !string.IsNullOrWhiteSpace(statusAttribute.ResolvedValue); }
/// <summary> /// This is overridden to allow copying of the additional properties /// </summary> /// <param name="p">The PDI object from which the settings are to be copied</param> protected override void Clone(PDIObject p) { VEvent o = (VEvent)p; this.ClearProperties(); classification = (ClassificationProperty)o.Classification.Clone(); categories = (CategoriesProperty)o.Categories.Clone(); resources = (ResourcesProperty)o.Resources.Clone(); url = (UrlProperty)o.Url.Clone(); uid = (UniqueIdProperty)o.UniqueId.Clone(); geo = (GeographicPositionProperty)o.GeographicPosition.Clone(); lastMod = (LastModifiedProperty)o.LastModified.Clone(); dateCreated = (DateCreatedProperty)o.DateCreated.Clone(); startDate = (StartDateProperty)o.StartDateTime.Clone(); endDate = (EndDateProperty)o.EndDateTime.Clone(); dateStamp = (TimeStampProperty)o.TimeStamp.Clone(); summary = (SummaryProperty)o.Summary.Clone(); desc = (DescriptionProperty)o.Description.Clone(); location = (LocationProperty)o.Location.Clone(); priority = (PriorityProperty)o.Priority.Clone(); sequence = (SequenceProperty)o.Sequence.Clone(); transp = (TimeTransparencyProperty)o.Transparency.Clone(); rNum = (RecurrenceCountProperty)o.RecurrenceCount.Clone(); comment = (CommentProperty)o.Comment.Clone(); organizer = (OrganizerProperty)o.Organizer.Clone(); recurId = (RecurrenceIdProperty)o.RecurrenceId.Clone(); status = (StatusProperty)o.Status.Clone(); duration = (DurationProperty)o.Duration.Clone(); this.Contacts.CloneRange(o.Contacts); this.Attendees.CloneRange(o.Attendees); this.RelatedTo.CloneRange(o.RelatedTo); this.Attachments.CloneRange(o.Attachments); this.RequestStatuses.CloneRange(o.RequestStatuses); this.Alarms.CloneRange(o.Alarms); this.CustomProperties.CloneRange(o.CustomProperties); base.Clone(p); }
internal BotConfiguration( string restApiServerUrl, string webSocketServerUrl, string repository, string trunkBranch, string branchPrefix, string plasticBotUserToken, StatusProperty plsticStatusAttrConfig, IssueTracker issueTrackerConfig, Notifier notifierConfig) { RestApiUrl = restApiServerUrl; WebSocketUrl = webSocketServerUrl; Repository = repository; TrunkBranch = trunkBranch; BranchPrefix = branchPrefix; PlasticBotUserToken = plasticBotUserToken; PlasticStatusAttrConfig = plsticStatusAttrConfig; IssueTrackerConfig = issueTrackerConfig; NotifierConfig = notifierConfig; }
internal static BotConfiguration Build( string configFile, string restApiServerUrl, string webSocketServerUrl) { string fileContent = System.IO.File.ReadAllText(configFile); JObject config = JObject.Parse(fileContent); if (config == null) { return(null); } string repository = Field.GetString(config, "repository"); string branchPrefix = Field.GetString(config, "branchPrefix"); string trunkBranch = Field.GetString(config, "trunkBranch"); string plasticBotUserToken = Field.GetString(config, "plasticBotUserToken"); StatusProperty statusAttrConfig = StatusProperty.BuildFromConfig(config["plasticStatusAttributeGroup"]); IssueTracker issueTrackerConfig = IssueTracker.BuildFromConfig(config["issuesGroup"]); Notifier emailConfig = Notifier.BuildFromConfig(config["notifierEmailGroup"]); return(new BotConfiguration( restApiServerUrl, webSocketServerUrl, repository, trunkBranch, branchPrefix, plasticBotUserToken, statusAttrConfig, issueTrackerConfig, emailConfig)); }
set => SetValue(StatusProperty, value);
set => this.SetValue(StatusProperty, value);
public NamedSpeechRecognizerResponse(string phrase, StatusProperty status) { Phrase = phrase; Status = status; }
public Property CreateProperty(string name, CRMSecurityProvider.Sources.Attribute.CrmAttributeType type, string value, params string[] data) { Property property = null; switch (type) { case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Boolean: property = new CrmBooleanProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Customer: property = new CustomerProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.DateTime: property = new CrmDateTimeProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Decimal: property = new CrmDecimalProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Float: property = new CrmFloatProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Integer: property = new CrmNumberProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Lookup: property = new LookupProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Memo: property = new StringProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Money: property = new CrmMoneyProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Owner: property = new OwnerProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Picklist: property = new PicklistProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.State: property = new StateProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Status: property = new StatusProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.String: property = new StringProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.UniqueIdentifier: property = new UniqueIdentifierProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.PartyList: property = new DynamicEntityArrayProperty(); break; case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Virtual: case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.CalendarRules: case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.Internal: case CRMSecurityProvider.Sources.Attribute.CrmAttributeType.PrimaryKey: break; } if (property != null) { SetPropertyValue(property, value, data); } return(property); }
public async Task StatusClass() { await Status.DefaultInstance.Start(); Assert.IsFalse(Status.DefaultInstance.ShuttingDown); try { DateTime start = AmbientClock.UtcNow; await Status.DefaultInstance.RefreshAsync(); StatusResults overallStatus = Status.DefaultInstance.Results; Assert.AreEqual("/", overallStatus.TargetSystem); Assert.AreEqual(0, overallStatus.RelativeDetailLevel); Assert.AreEqual(StatusNatureOfSystem.ChildrenHeterogenous, overallStatus.NatureOfSystem); Assert.AreEqual(0, overallStatus.Properties.Count()); Assert.IsTrue(overallStatus.Children.Count() > 0); Assert.IsFalse(string.IsNullOrEmpty(overallStatus.ToString())); StatusResults sampleDisk = overallStatus.Children.FirstOrDefault(c => c.TargetSystem == "SampleDisk" && c.Children.Any()) as StatusResults; Assert.IsNotNull(sampleDisk); StatusResults disk = sampleDisk !.Children.FirstOrDefault() as StatusResults; Assert.IsNotNull(disk); Assert.IsTrue(disk !.Properties.Count() > 0); // the properties in the node itself are the constant properties, ie. the path for a disk test Assert.IsFalse(string.IsNullOrEmpty(sampleDisk !.ToString())); StatusProperty att = disk.Properties.FirstOrDefault(a => a.Name == "TotalBytes"); Assert.IsNotNull(att); Assert.IsFalse(string.IsNullOrEmpty(att !.ToString())); Assert.IsFalse(String.IsNullOrEmpty(att !.Name)); Assert.IsFalse(String.IsNullOrEmpty(att !.Value)); HashSet <StatusResults> test = new HashSet <StatusResults>(); StatusResults c1 = overallStatus.Children.FirstOrDefault(c => c.TargetSystem == nameof(TestHeterogenousExplicitRating)); Assert.IsNotNull(c1); Assert.IsNotNull(c1 !.Report); Assert.IsNotNull(c1 !.Report?.Alert?.Rating); Assert.IsFalse(string.IsNullOrEmpty(c1 !.ToString())); test.Add(c1); StatusResults c2 = overallStatus.Children.FirstOrDefault(c => c.TargetSystem == nameof(TestHomogeneousExplicitFailure)); Assert.IsNotNull(c2); Assert.IsNotNull(c2 !.Report); Assert.IsNotNull(c2 !.Report?.Alert?.Rating); Assert.AreNotEqual(c1 !.Report?.Alert, c2 !.Report?.Alert); Assert.IsFalse(string.IsNullOrEmpty(c2 !.ToString())); test.Add(c2); StatusResults c3 = overallStatus.Children.FirstOrDefault(c => c.TargetSystem == nameof(TestMachineConstantStatus)); Assert.IsNotNull(c3); Assert.IsNull(c3 !.Report); Assert.IsFalse(string.IsNullOrEmpty(c3 !.ToString())); test.Add(c3); StatusAuditAlert auditResult = overallStatus.GetSummaryAlerts(true, StatusRating.Alert, false); Assert.AreEqual(0, overallStatus.Properties.Count()); HashSet <StatusAuditReport> test3 = new HashSet <StatusAuditReport>(); Assert.IsTrue(auditResult.Rating >= -1.0f && auditResult.Rating <= 4.0f); Assert.IsFalse(string.IsNullOrEmpty(auditResult.Terse)); Assert.IsFalse(string.IsNullOrEmpty(auditResult.Details)); Assert.IsTrue(overallStatus.SourceSystem == null); Assert.IsTrue(auditResult.Rating <= StatusRating.Fail); Assert.IsFalse(string.IsNullOrEmpty(auditResult.ToString())); AmbientClock.SkipAhead(TimeSpan.FromMilliseconds(100)); await Status.DefaultInstance.RefreshAsync(); overallStatus = Status.DefaultInstance.Results; StatusAuditAlert notOkayResult = overallStatus.GetSummaryAlerts(true, StatusRating.Okay, false); StatusAuditAlert fullResult = overallStatus.GetSummaryAlerts(true, float.MaxValue, false); StatusAuditAlert overallSummaryAlerts = Status.DefaultInstance.Summary; Assert.IsTrue(overallSummaryAlerts.Rating <StatusRating.Fail && overallSummaryAlerts.Rating> StatusRating.Catastrophic); StatusAuditAlert overallSummaryAlertsAndFailures = Status.DefaultInstance.SummaryAlertsAndFailures; Assert.IsTrue(overallSummaryAlertsAndFailures.Rating <StatusRating.Fail && overallSummaryAlertsAndFailures.Rating> StatusRating.Catastrophic); StatusAuditAlert overallSummaryFailures = Status.DefaultInstance.SummaryFailures; Assert.IsTrue(overallSummaryFailures.Rating <StatusRating.Fail && overallSummaryFailures.Rating> StatusRating.Catastrophic); } finally { await Status.DefaultInstance.Stop(); } }
/// <summary> /// Adds the specified name. /// </summary> /// <param name="name">The name.</param> /// <param name="type">The type.</param> /// <param name="value">The value.</param> /// <param name="data">The data.</param> public ICrmAttribute Create(string name, CrmAttributeType type, string value, params string[] data) { Property property = null; switch (type) { case CrmAttributeType.Boolean: property = new CrmBooleanProperty(); break; case CrmAttributeType.Customer: property = new CustomerProperty(); break; case CrmAttributeType.DateTime: property = new CrmDateTimeProperty(); break; case CrmAttributeType.Decimal: property = new CrmDecimalProperty(); break; case CrmAttributeType.Float: property = new CrmFloatProperty(); break; case CrmAttributeType.Integer: property = new CrmNumberProperty(); break; case CrmAttributeType.Lookup: property = new LookupProperty(); break; case CrmAttributeType.Memo: property = new StringProperty(); break; case CrmAttributeType.Money: property = new CrmMoneyProperty(); break; case CrmAttributeType.Owner: property = new OwnerProperty(); break; case CrmAttributeType.Picklist: property = new PicklistProperty(); break; case CrmAttributeType.State: property = new StateProperty(); break; case CrmAttributeType.Status: property = new StatusProperty(); break; case CrmAttributeType.String: property = new StringProperty(); break; case CrmAttributeType.UniqueIdentifier: property = new UniqueIdentifierProperty(); break; case CrmAttributeType.PartyList: property = new DynamicEntityArrayProperty(); break; case CrmAttributeType.Virtual: case CrmAttributeType.CalendarRules: case CrmAttributeType.Internal: case CrmAttributeType.PrimaryKey: break; } this.Add(property); var crmAttributeAdapter = new CrmAttributeAdapter(property) { Name = name }; crmAttributeAdapter.SetValue(value, data); return(crmAttributeAdapter); }
/// <summary> /// Creates the instance. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="value">The value.</param> /// <returns></returns> /// <exception cref="ArgumentException">value</exception> public virtual Property GetProperty(string propertyName, object value) { Property property; if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentException("Property name must be non null.", "propertyName"); } if (value == null) { throw new ArgumentNullException("Property value must be non null.", "value"); } if (string.Compare(propertyName, "StateCode", true, CultureInfo.InvariantCulture) == 0) { property = new StateProperty { Value = (string)value }; } else if (value is string) { property = new StringProperty { Value = (string)value }; } else if (value is UniqueIdentifier) { property = new UniqueIdentifierProperty { Value = (UniqueIdentifier)value }; } else if (value is Status) { property = new StatusProperty { Value = (Status)value }; } else if (value is Picklist) { property = new PicklistProperty { Value = (Picklist)value }; } else if (value is Owner) { property = new OwnerProperty { Value = (Owner)value }; } else if (value is Lookup) { property = new LookupProperty { Value = (Lookup)value }; } else if (value is CrmCampaignIntegration.Services.Key) { property = new KeyProperty { Value = (CrmCampaignIntegration.Services.Key)value }; } else if (value is EntityNameReference) { property = new EntityNameReferenceProperty { Value = (EntityNameReference)value }; } else if (value is DynamicEntity[]) { property = new DynamicEntityArrayProperty { Value = (DynamicEntity[])value }; } else if (value is Customer) { property = new CustomerProperty { Value = (Customer)value }; } else if (value is CrmCampaignIntegration.Services.CrmNumber) { property = new CrmNumberProperty { Value = (CrmCampaignIntegration.Services.CrmNumber)value }; } else if (value is CrmMoney) { property = new CrmMoneyProperty { Value = (CrmMoney)value }; } else if (value is CrmCampaignIntegration.Services.CrmFloat) { property = new CrmFloatProperty { Value = (CrmCampaignIntegration.Services.CrmFloat)value }; } else if (value is CrmDecimal) { property = new CrmDecimalProperty { Value = (CrmDecimal)value }; } else if (value is CrmCampaignIntegration.Services.CrmDateTime) { property = new CrmDateTimeProperty { Value = (CrmCampaignIntegration.Services.CrmDateTime)value }; } else if (value is CrmCampaignIntegration.Services.CrmBoolean) { property = new CrmBooleanProperty { Value = (CrmCampaignIntegration.Services.CrmBoolean)value }; } else { throw new NotSupportedException(string.Format("Unknown value type: {0}", value.GetType())); } property.Name = propertyName; return(property); }