public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var ownedThing = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var deprecatableThing = thing as IDeprecatableThing; if (deprecatableThing != null && !deprecatableThing.IsDeprecated) { if (ownedThing.Owner.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced DomainOfExpertise {ownedThing.Owner.Iid}:{ownedThing.Owner.ShortName} of IOwnedThing.Owner is deprecated", SeverityKind.Warning); results.Add(result); } } else { if (ownedThing.Owner.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced DomainOfExpertise {ownedThing.Owner.Iid}:{ownedThing.Owner.ShortName} of IOwnedThing.Owner is deprecated", SeverityKind.Warning); results.Add(result); } } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var referencerRule = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (!referencerRule.IsDeprecated) { if (referencerRule.ReferencingCategory.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced Category {referencerRule.ReferencingCategory.Iid}:{referencerRule.ReferencingCategory.ShortName} of ReferencerRule.ReferencingCategory is deprecated", SeverityKind.Warning); results.Add(result); } foreach (var category in referencerRule.ReferencedCategory) { if (category.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced Category {category.Iid}:{category.ShortName} in ReferencerRule.ReferencedCategory is deprecated", SeverityKind.Warning); results.Add(result); } } } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var referenceSource = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (referenceSource.IsDeprecated) { return(results); } if (referenceSource.Publisher.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced Organization {referenceSource.Publisher.Iid}:{referenceSource.Publisher.ShortName} of ReferenceSource.Publisher is deprecated", SeverityKind.Warning); results.Add(result); } if (referenceSource.PublishedIn.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced ReferenceSource {referenceSource.PublishedIn.Iid}:{referenceSource.PublishedIn.ShortName} of ReferenceSource.PublishedIn is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var quantityKind = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (quantityKind.IsDeprecated) { return(results); } foreach (var measurementScale in quantityKind.PossibleScale) { if (measurementScale.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementScale {measurementScale.Iid}:{measurementScale.ShortName} in QuantityKind.PossibleScale is deprecated", SeverityKind.Warning); results.Add(result); } } if (quantityKind.DefaultScale.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementScale {quantityKind.DefaultScale.Iid}:{quantityKind.DefaultScale.ShortName} of QuantityKind.DefaultScale is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var relationalExpression = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (relationalExpression.Scale != null && relationalExpression.Scale.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementScale {relationalExpression.Scale.Iid}:{relationalExpression.Scale.ShortName} of RelationalExpression.Scale is deprecated", SeverityKind.Warning); results.Add(result); } if (relationalExpression.ParameterType.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced ParameterType {relationalExpression.ParameterType.Iid}:{relationalExpression.ParameterType.ShortName} of RelationalExpression.ParameterType is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherReferencedMeasurementScaleInChainOfRdls(Thing thing) { var quantityKind = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var referenceDataLibrary = (ReferenceDataLibrary)thing.GetContainerOfType(typeof(ReferenceDataLibrary)); foreach (var measurementScale in quantityKind.PossibleScale) { if (!referenceDataLibrary.IsMeasurementScaleInChainOfRdls(measurementScale)) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementScale {measurementScale.Iid}:{measurementScale.ShortName} in QuantityKind.PossibleScale is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } } if (!referenceDataLibrary.IsMeasurementScaleInChainOfRdls(quantityKind.DefaultScale)) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementScale {quantityKind.DefaultScale.Iid}:{quantityKind.DefaultScale.ShortName} in QuantityKind.DefaultScale is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherReferencedCategoryIsInChainOfRdls(Thing thing) { var referencerRule = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var referenceDataLibrary = (ReferenceDataLibrary)referencerRule.Container; if (!referenceDataLibrary.IsCategoryInChainOfRdls(referencerRule.ReferencingCategory)) { var result = new RuleCheckResult(thing, rule.Id, $"The ReferencerRule.RelationshipCategory {referencerRule.ReferencingCategory.Iid}:{referencerRule.ReferencingCategory.ShortName} of {referencerRule.Iid}:{referencerRule.ShortName} is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } foreach (var category in referencerRule.ReferencedCategory) { if (!referenceDataLibrary.IsCategoryInChainOfRdls(category)) { var result = new RuleCheckResult(thing, rule.Id, $"The ReferencerRule.ReferencedCategory {category.Iid}:{category.ShortName} of {referencerRule.Iid}:{referencerRule.ShortName} is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var referenceDataLibrary = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var siteReferenceDataLibrary = referenceDataLibrary as SiteReferenceDataLibrary; if (siteReferenceDataLibrary != null && siteReferenceDataLibrary.IsDeprecated) { return(results); } if (referenceDataLibrary.RequiredRdl != null && referenceDataLibrary.RequiredRdl.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced SiteReferenceDataLibrary {referenceDataLibrary.RequiredRdl.Iid}:{referenceDataLibrary.RequiredRdl.ShortName} of ReferenceDataLibrary.RequiredRdl is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var siteDirectory = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (siteDirectory.DefaultPersonRole != null && siteDirectory.DefaultPersonRole.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced PersonRole {siteDirectory.DefaultPersonRole.Iid}:{siteDirectory.DefaultPersonRole.ShortName} of SiteDirectory.DefaultPersonRole is deprecated", SeverityKind.Warning); results.Add(result); } if (siteDirectory.DefaultParticipantRole != null && siteDirectory.DefaultParticipantRole.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced ParticipantRole {siteDirectory.DefaultParticipantRole.Iid}:{siteDirectory.DefaultParticipantRole.ShortName} of SiteDirectory.DefaultParticipantRole is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var personRole = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (personRole.IsDeprecated) { return(results); } foreach (var personPermission in personRole.PersonPermission) { if (personPermission.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced PersonPermission {personPermission.Iid}:{personPermission.ObjectClass} in PersonRole.PersonPermission is deprecated", SeverityKind.Warning); results.Add(result); } } return(results); }
public IEnumerable <RuleCheckResult> CheckWheterTheLanguageCodeExistsInTheSiteDirectory(Thing thing) { var annotation = this.VerifyThingArgument(thing); var topContainer = thing.TopContainer; SiteDirectory siteDirectory; var engineeringModel = topContainer as EngineeringModel; if (engineeringModel != null) { siteDirectory = engineeringModel.EngineeringModelSetup.TopContainer as SiteDirectory; } else { siteDirectory = topContainer as SiteDirectory; } var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (siteDirectory != null) { var languageCodeExists = siteDirectory.NaturalLanguage.Any(x => x.LanguageCode == annotation.LanguageCode); if (!languageCodeExists) { var result = new RuleCheckResult(thing, rule.Id, $"The Annotation.LanguageCode: {annotation.LanguageCode} for Idd: {thing.Iid} does not exist in the SiteDirectory { siteDirectory.Iid}", rule.Severity); results.Add(result); } } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var unitFactor = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var derivedUnit = (DerivedUnit)unitFactor.Container; if (derivedUnit.IsDeprecated) { return(results); } if (unitFactor.Unit.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementUnit {unitFactor.Unit.Iid}:{unitFactor.Unit.ShortName} of UnitFactor.Unit is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherSourceAndTargetAreContainedByTheSameIteration(Thing thing) { var binaryRelationship = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (binaryRelationship.Source == null) { throw new IncompleteModelException("The Source property is null"); } if (binaryRelationship.Target == null) { throw new IncompleteModelException("The Target property is null"); } var sourceIteration = binaryRelationship.Source.GetContainerOfType(typeof(Iteration)); if (sourceIteration == null) { var result = new RuleCheckResult(thing, rule.Id, "The source is not contained by an Iteration", SeverityKind.Warning); results.Add(result); } else { if (sourceIteration.Iid != binaryRelationship.Container.Iid) { var result = new RuleCheckResult(thing, rule.Id, "The source of the BinaryRelationship is not contained by the same Iteration as the BinaryRelationship", SeverityKind.Warning); results.Add(result); } } var targetIteration = binaryRelationship.Target.GetContainerOfType(typeof(Iteration)); if (targetIteration == null) { var result = new RuleCheckResult(thing, rule.Id, "The target is not contained by an Iteration", SeverityKind.Warning); results.Add(result); } else { if (targetIteration.Iid != binaryRelationship.Container.Iid) { var result = new RuleCheckResult(thing, rule.Id, "The target of the BinaryRelationship is not contained by the same Iteration as the BinaryRelationship", SeverityKind.Warning); results.Add(result); } } return(results); }
public IEnumerable <RuleCheckResult> CheckWeatherTheLanguageCodeIsValid(Thing thing) { var annotation = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (CultureInfo.GetCultures(CultureTypes.AllCultures).All(x => x.Name != annotation.LanguageCode)) { var result = new RuleCheckResult(thing, rule.Id, $"The Annotation.LanguageCode: {annotation.LanguageCode} for Idd: {thing.Iid} is not a valid LanguageCode", rule.Severity); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var prefixedUnit = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (!prefixedUnit.IsDeprecated && prefixedUnit.Prefix.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced UnitPrefix {prefixedUnit.Prefix.Iid}:{prefixedUnit.Prefix.ShortName} of PrefixedUnit.Prefix is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherTheShortNameIsAValidShortName(Thing thing) { var shortNamedThing = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); switch (thing) { case ElementBase elementBase: { var result = this.CheckShortNameValidityOfElementBase(elementBase, rule); if (result != null) { results.Add(result); } break; } case RequirementsContainer requirementsContainer: { var result = this.CheckShortNameValidityOfRequirementsContainer(requirementsContainer, rule); if (result != null) { results.Add(result); } break; } default: { var result = this.CheckShortNameValidityOfShortNamedThing(shortNamedThing, rule); if (result != null) { results.Add(result); } break; } } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherThereAreNoDuplicateCategoriesAreDefined(Thing thing) { var categorizableThing = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); //find if there are any duplicates: List <Category> duplicates = categorizableThing.Category.GroupBy(s => s).SelectMany(grp => grp.Skip(1)).Distinct().ToList(); if (duplicates.Any()) { var duplicateIdentifiers = string.Join(",", duplicates.Select(r => r.Iid)); var duplicateShortNames = string.Join(",", duplicates.Select(r => r.ShortName)); var result = new RuleCheckResult(thing, rule.Id, $"The CategorizableThing is a member of the following Categories: {duplicateIdentifiers}; with shortNames: {duplicateShortNames} more than once", SeverityKind.Warning); results.Add(result); } // verify whether a CategorizableThing is a member of a category and its supercategory by means of the Category property. duplicates = new List <Category>(); foreach (var category in categorizableThing.Category.ToList()) { foreach (var superCategory in category.AllSuperCategories()) { if (categorizableThing.Category.Any(x => x.Iid == superCategory.Iid)) { duplicates.Add(category); duplicates.Add(superCategory); } } } duplicates = duplicates.Distinct().ToList(); if (duplicates.Any()) { var duplicateIdentifiers = string.Join(",", duplicates.Select(r => r.Iid)); var duplicateShortNames = string.Join(",", duplicates.Select(r => r.ShortName)); var result = new RuleCheckResult(thing, rule.Id, $"The CategorizableThing is a member of the following Categories: {duplicateIdentifiers}; with shortNames: {duplicateShortNames} more than once", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var participant = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); foreach (var domainOfExpertise in participant.Domain) { if (domainOfExpertise.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced DomainOfExpertise {domainOfExpertise.Iid}:{domainOfExpertise.ShortName} in Participant.Domain is deprecated", SeverityKind.Warning); results.Add(result); } } if (participant.SelectedDomain.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced DomainOfExpertise {participant.SelectedDomain.Iid}:{participant.SelectedDomain.ShortName} of Participant.SelectedDomain is deprecated", SeverityKind.Warning); results.Add(result); } if (participant.Person.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced Person {participant.Person.Iid}:{participant.Person.ShortName} of Participant.Person is deprecated", SeverityKind.Warning); results.Add(result); } if (participant.Role.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced ParticipantRole {participant.Role.Iid}:{participant.Role.ShortName} of Participant.Role is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherReferencedDefaultScaleIsInTheCollectionOfPossibleScales(Thing thing) { var quantityKind = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (quantityKind.PossibleScale.All(s => s.Iid != quantityKind.DefaultScale.Iid)) { var result = new RuleCheckResult(thing, rule.Id, $"The QuantityKind.DefaultScale {quantityKind.DefaultScale.Iid}:{quantityKind.DefaultScale.ShortName} is not in the list of QuantityKind.PossibleScale", SeverityKind.Error); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var parameter = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (parameter.RequestedBy != null && parameter.RequestedBy.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced DomainOfExpertise {parameter.RequestedBy.Iid}:{parameter.RequestedBy.ShortName} of Parameter.RequestedBy is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var externalIdentifierMap = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); if (externalIdentifierMap.ExternalFormat != null && externalIdentifierMap.ExternalFormat.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced ReferenceSource {externalIdentifierMap.ExternalFormat.Iid}:{externalIdentifierMap.ExternalFormat.ShortName} of ExternalIdentifierMap.ExternalFormat is deprecated", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherTheReferencedOwnerDomainOfExpertiseIsIsAnActiveDomain(Thing thing) { var ownedThing = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var engineeringModel = thing.TopContainer as EngineeringModel; if (!engineeringModel.EngineeringModelSetup.ActiveDomain.Contains(ownedThing.Owner)) { var result = new RuleCheckResult(thing, rule.Id, $"The Owner {ownedThing.Owner.Iid}:{ownedThing.Owner.ShortName} is not an active Domain of the container Engineering Model", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherReferencedMeasurementUnitIsInChainOfRdls(Thing thing) { var conversionBasedUnit = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var referenceDataLibrary = (ReferenceDataLibrary)thing.Container; if (!referenceDataLibrary.IsMeasurementUnitInChainOfRdls(conversionBasedUnit.ReferenceUnit)) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementUnit {conversionBasedUnit.ReferenceUnit.Iid}:{conversionBasedUnit.ReferenceUnit.ShortName} of ConversionBasedUnit.ReferenceUnit is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherReferencedParameterTypeIsInChainOfRdls(Thing thing) { var parameterTypeComponent = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var referenceDataLibrary = (ReferenceDataLibrary)thing.GetContainerOfType(typeof(ReferenceDataLibrary)); if (!referenceDataLibrary.IsParameterTypeInChainOfRdls(parameterTypeComponent.ParameterType)) { var result = new RuleCheckResult(thing, rule.Id, "The referenced ParameterType is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherACatalogueContainsNoMoreThanOneOptionPerIteration(Thing thing) { var iteration = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var engineeringModel = (EngineeringModel)iteration.Container; if (engineeringModel.EngineeringModelSetup.Kind == EngineeringModelKind.MODEL_CATALOGUE && iteration.Option.Count > 1) { var result = new RuleCheckResult(thing, rule.Id, $"The Iteration {iteration.Iid} is contained by a MODEL_CATALOGUE and contains more than one Option", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherReferencedMeasurementScaleInChainOfRdls(Thing thing) { var relationalExpression = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var engineeringModel = thing.TopContainer as EngineeringModel; var modelReferenceDataLibrary = engineeringModel.EngineeringModelSetup.RequiredRdl.Single(); if (!modelReferenceDataLibrary.IsMeasurementScaleInChainOfRdls(relationalExpression.Scale)) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced MeasurementScale {relationalExpression.Scale.Iid}:{relationalExpression.Scale.ShortName} of RelationalExpression.Scale is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedCompoundParameterTypeIsFinalizedOrNot(Thing thing) { var parameter = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var compoundParameterType = parameter.ParameterType as CompoundParameterType; if (compoundParameterType != null && !compoundParameterType.IsFinalized) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced CompoundParameterType {parameter.ParameterType.Iid}:{parameter.ParameterType.ShortName} of Parameter.ParameterType is not finalized", SeverityKind.Warning); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> CheckWhetherReferencedParameterTypeIsInChainOfRdls(Thing thing) { var parameterizedCategoryRule = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var referenceDataLibrary = (ReferenceDataLibrary)thing.Container; foreach (var parameterType in parameterizedCategoryRule.ParameterType) { if (!referenceDataLibrary.IsParameterTypeInChainOfRdls(parameterType)) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced ParameterType {parameterType.Iid}:{parameterType.ShortName} is not in the chain of Reference Data Libraries", SeverityKind.Error); results.Add(result); } } return(results); }
public IEnumerable <RuleCheckResult> ChecksWheterACategorizableThingIsNotAMemberOfAnAbstractCategory(Thing thing) { var categorizableThing = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); var abstractCategories = categorizableThing.Category.Where(c => c.IsAbstract); if (abstractCategories.Any()) { var abstractIdentifiers = string.Join(",", abstractCategories.Select(r => r.Iid)); var abstractShortNames = string.Join(",", abstractCategories.Select(r => r.ShortName)); var result = new RuleCheckResult(thing, rule.Id, $"The CategorizableThing is a member of the following abstract Categories: {abstractIdentifiers}; with shortNames: {abstractShortNames}", SeverityKind.Error); results.Add(result); } return(results); }
public IEnumerable <RuleCheckResult> ChecksWhetherAReferencedDeprecatableThingIsDeprecated(Thing thing) { var fileRevision = this.VerifyThingArgument(thing); var results = new List <RuleCheckResult>(); var ruleAttribute = System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttribute <RuleAttribute>(); var rule = StaticRuleProvider.QueryRules().Single(r => r.Id == ruleAttribute.Id); foreach (FileType fileType in fileRevision.FileType) { if (fileType.IsDeprecated) { var result = new RuleCheckResult(thing, rule.Id, $"The referenced FileType {fileType.Iid}:{fileType.ShortName} in FileRevision.FileType is deprecated", SeverityKind.Warning); results.Add(result); } } return(results); }