private static void ValidateConfig(CoreModel m, ValidationResultRepository repo)
        {
            if (m.Config == null)
            {
                repo.AddError("The ceusdl-Code does not contain a config-Section.", ValidationResult.OT_CONFIG);
            }

            if (string.IsNullOrEmpty(m.Config.Prefix))
            {
                repo.AddInfo("The ceusdl config section does not contain a prefix definition. This is not mandatory but can be helpful.", ValidationResult.OT_CONFIG);
            }

            if (string.IsNullOrEmpty(m.Config.ILDatabase))
            {
                repo.AddInfo("The ceusdl config section does not contain a database name for interface layer.", ValidationResult.OT_CONFIG);
            }
            if (string.IsNullOrEmpty(m.Config.BLDatabase))
            {
                repo.AddInfo("The ceusdl config section does not contain a database name for base layer.", ValidationResult.OT_CONFIG);
            }
            if (string.IsNullOrEmpty(m.Config.BTDatabase))
            {
                repo.AddInfo("The ceusdl config section does not contain a database name for base layer transformation.", ValidationResult.OT_CONFIG);
            }
            if (string.IsNullOrEmpty(m.Config.ALDatabase))
            {
                repo.AddInfo("The ceusdl config section does not contain a database name for analytical layer.", ValidationResult.OT_CONFIG);
            }
        }
Example #2
0
 private static void CheckFactsWithInvalidDataType(CoreInterface ifa, ValidationResultRepository repo)
 {
     foreach (var attr in ifa.Attributes.Where(a => a is CoreFactAttribute).Select(a => (CoreFactAttribute)a))
     {
         if (attr.DataType != CoreDataType.INT && attr.DataType != CoreDataType.DECIMAL)
         {
             repo.AddError($"The Fact {attr.Name} in {ifa.Name} has the DataType {attr.DataType} which is non numerical", ValidationResult.OT_ATTRIBUTE);
         }
     }
 }
Example #3
0
        public static void Validate(CoreInterface ifa, CoreModel m, ValidationResultRepository repo)
        {
            if (ifa.IsHistorized && !HasFinestTimeUnit(m))
            {
                repo.AddError($"Your ceusdl code contains historized interfaces ({ifa.Name}) but no TemporalTable which is the finest_time_attribute", ValidationResult.OT_INTERFACE);
            }

            if (HasNoPrimaryKey(ifa))
            {
                repo.AddError($"Your ceusdl code for {ifa.Name} does not have a primary key definition", ValidationResult.OT_INTERFACE);
            }

            if (DimHasNonSingleAttributePrimaryKey(ifa))
            {
                repo.AddError($"Your ceusdl code for {ifa.Name} must have a one attribute primary key", ValidationResult.OT_INTERFACE);
            }

            foreach (var illegal in ContainsIllegalAttributeName(ifa))
            {
                repo.AddError($"The interface {ifa.Name} contains the illegal attribute name {illegal}, which "
                              + "is preserved for the ceusdl generation process", ValidationResult.OT_ATTRIBUTE);
            }

            foreach (var illegal in ContainsIllegalAttributeType(ifa))
            {
                repo.AddError($"The interface {ifa.Name} contains an attribute of type {illegal.GetType().Name}, which is illegal for a {ifa.Type} Interface", ValidationResult.OT_ATTRIBUTE);
            }

            foreach (var illegal in ContainsIllegalReference(ifa))
            {
                repo.AddError($"The interface {ifa.Name} ({ifa.Type}) contains an illegal reference "
                              + $"to {illegal.ReferencedInterface.Name}.{illegal.ReferencedAttribute.Name} ({illegal.ReferencedInterface.Type})", ValidationResult.OT_ATTRIBUTE);
            }

            foreach (var duplicate in FindDuplicateAttributes(ifa, m))
            {
                repo.AddError($"Your code for {ifa.Name} contains more then one definition of {duplicate} as illegal duplicates", ValidationResult.OT_ATTRIBUTE);
            }

            CheckFactsWithInvalidDataType(ifa, repo);
        }
 private static void ValidateInterface(CoreInterface ifa, CoreModel m, ValidationResultRepository repo)
 {
     CoreInterfaceValidator.Validate(ifa, m, repo);
 }