Ejemplo n.º 1
0
 protected AdomdDiscoveryCommand BuildBase(DiscoveryTarget target, string connectionString)
 {
     switch (target)
     {
         case DiscoveryTarget.Perspectives:
             return new PerspectiveDiscoveryCommand(connectionString);
         case DiscoveryTarget.MeasureGroups:
             return new MeasureGroupDiscoveryCommand(connectionString);
         case DiscoveryTarget.Measures:
             return new MeasureDiscoveryCommand(connectionString);
         case DiscoveryTarget.Dimensions:
             return new DimensionDiscoveryCommand(connectionString);
         case DiscoveryTarget.Hierarchies:
             return new HierarchyDiscoveryCommand(connectionString);
         case DiscoveryTarget.Levels:
             return new LevelDiscoveryCommand(connectionString);
         case DiscoveryTarget.Properties:
             return new PropertyDiscoveryCommand(connectionString);
         case DiscoveryTarget.Tables:
             return new TableDiscoveryCommand(connectionString);
         case DiscoveryTarget.Columns:
             return new ColumnDiscoveryCommand(connectionString);
     }
     throw new ArgumentOutOfRangeException();
 }
Ejemplo n.º 2
0
 internal MetadataLinkedToDiscoveryRequest(string connectionString, DiscoveryTarget target, IEnumerable <IFilter> filters)
     : base()
 {
     base.ConnectionString = connectionString;
     this.Target           = target;
     base.AddFilters(filters);
 }
Ejemplo n.º 3
0
 public IFilter GetFilter(DiscoveryTarget target)
 {
     if (Filters.ContainsKey(target))
         return Filters[target];
     else
         return null;
 }
 internal MetadataLinkedToDiscoveryRequest(string connectionString, DiscoveryTarget target, IEnumerable<IFilter> filters)
     : base()
 {
     base.ConnectionString = connectionString;
     this.Target = target;
     base.AddFilters(filters);
 }
Ejemplo n.º 5
0
 internal AtLeastOneNotNull(IEnumerable<IFilter> filters, DiscoveryTarget firstElement, DiscoveryTarget secondElement)
     : base(filters)
 {
     elements = new List<DiscoveryTarget>();
     elements.Add(firstElement);
     elements.Add(secondElement);
 }
Ejemplo n.º 6
0
        public AdomdDiscoveryCommand Build(DiscoveryTarget target, IEnumerable <IFilter> filters, string connectionString)
        {
            var command = BuildBase(target, connectionString);

            command.Filters = filters;
            return(command);
        }
Ejemplo n.º 7
0
        protected AdomdDiscoveryCommand BuildBase(DiscoveryTarget target, string connectionString)
        {
            switch (target)
            {
            case DiscoveryTarget.Perspectives:
                return(new PerspectiveDiscoveryCommand(connectionString));

            case DiscoveryTarget.MeasureGroups:
                return(new MeasureGroupDiscoveryCommand(connectionString));

            case DiscoveryTarget.Measures:
                return(new MeasureDiscoveryCommand(connectionString));

            case DiscoveryTarget.Dimensions:
                return(new DimensionDiscoveryCommand(connectionString));

            case DiscoveryTarget.Hierarchies:
                return(new HierarchyDiscoveryCommand(connectionString));

            case DiscoveryTarget.Levels:
                return(new LevelDiscoveryCommand(connectionString));

            case DiscoveryTarget.Properties:
                return(new PropertyDiscoveryCommand(connectionString));

            case DiscoveryTarget.Tables:
                return(new TableDiscoveryCommand(connectionString));

            case DiscoveryTarget.Columns:
                return(new ColumnDiscoveryCommand(connectionString));
            }
            throw new ArgumentOutOfRangeException();
        }
Ejemplo n.º 8
0
        public string GetNextTargetPluralExpression(DiscoveryTarget target)
        {
            var text = string.Empty;

            switch (target)
            {
            case DiscoveryTarget.MeasureGroups:
                text = "measures";
                break;

            case DiscoveryTarget.Dimensions:
                text = "hierarchies";
                break;

            case DiscoveryTarget.Hierarchies:
                text = "levels";
                break;

            case DiscoveryTarget.Levels:
                text = "properties";
                break;

            default:
                break;
            }

            return(text);
        }
Ejemplo n.º 9
0
 internal AtLeastOneNotNull(IEnumerable <IFilter> filters, DiscoveryTarget firstElement, DiscoveryTarget secondElement)
     : base(filters)
 {
     elements = new List <DiscoveryTarget>();
     elements.Add(firstElement);
     elements.Add(secondElement);
 }
Ejemplo n.º 10
0
        private IFilter BuildCaptionFilterForCaptionProperty(object src, DiscoveryTarget target)
        {
            var caption = GetPropertyValue(src, "Caption");
            if (string.IsNullOrEmpty(caption))
                return null;

            var filter = new CaptionFilter(caption, target);
            return filter;
        }
Ejemplo n.º 11
0
 public IFilter GetFilter(DiscoveryTarget target)
 {
     if (Filters.ContainsKey(target))
     {
         return(Filters[target]);
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 12
0
        private IFilter BuildCaptionFilterForCaptionProperty(object src, DiscoveryTarget target)
        {
            var caption = GetPropertyValue(src, "Caption");

            if (string.IsNullOrEmpty(caption))
            {
                return(null);
            }

            var filter = new CaptionFilter(caption, target);

            return(filter);
        }
Ejemplo n.º 13
0
        public virtual MetadataDiscoveryRequest BuildRelation(string connectionString, DiscoveryTarget target, IEnumerable<IFilter> filters)
        {
            //Validations
            Validate(
                new List<Validation>()
                {
                    new ConnectionStringNotEmpty(connectionString),
                    new PerspectiveNotNull(filters),
                    new AtLeastOneNotNull(filters, DiscoveryTarget.Dimensions, DiscoveryTarget.MeasureGroups)
                }
            );

            //If validation of parameters is successfull then we build the object
            var disco = new MetadataLinkedToDiscoveryRequest(connectionString, target, filters);
            return disco;
        }
Ejemplo n.º 14
0
        public virtual MetadataDiscoveryRequest BuildDirect(string connectionString, DiscoveryTarget target, IEnumerable<IFilter> filters)
        {
            //Validations
            Validate(
                new List<Validation>()
                {
                    new ConnectionStringNotEmpty(connectionString),
                    !target.Equals(DiscoveryTarget.Perspectives) ? (Validation)new PerspectiveNotNull(filters) : new NoValidation(),
                    new MeasureGroupWithoutDimension(filters),
                    new MeasureWithoutDimension(filters),
                    new MeasureNotNull(filters),
                    new DimensionNotNullIfHierarchy(target, filters),
                    new HierarchyNotNullIfLevel(target, filters),
                    new LevelNotNullIfProperty(target, filters),
                    new TableNotNullIfColumn(target, filters)
                }
            );

            //If validation of parameters is successfull then we build the object
            var disco = new MetadataDiscoveryRequest(connectionString, target, filters);
            return disco;
        }
Ejemplo n.º 15
0
        public string GetNextTargetPluralExpression(DiscoveryTarget target)
        {
            var text = string.Empty;
            switch (target)
            {
                case DiscoveryTarget.MeasureGroups:
                    text = "measures";
                    break;
                case DiscoveryTarget.Dimensions:
                    text = "hierarchies";
                    break;
                case DiscoveryTarget.Hierarchies:
                    text = "levels";
                    break;
                case DiscoveryTarget.Levels:
                    text = "properties";
                    break;
                default:
                    break;
            }

            return text;
        }
Ejemplo n.º 16
0
        public virtual MetadataDiscoveryRequest BuildDirect(string connectionString, DiscoveryTarget target, IEnumerable <IFilter> filters)
        {
            //Validations
            Validate(
                new List <Validation>()
            {
                new ConnectionStringNotEmpty(connectionString),
                !target.Equals(DiscoveryTarget.Perspectives) ? (Validation) new PerspectiveNotNull(filters) : new NoValidation(),
                new MeasureGroupWithoutDimension(filters),
                new MeasureWithoutDimension(filters),
                new MeasureNotNull(filters),
                new DimensionNotNullIfHierarchy(target, filters),
                new HierarchyNotNullIfLevel(target, filters),
                new LevelNotNullIfProperty(target, filters),
                new TableNotNullIfColumn(target, filters)
            }
                );

            //If validation of parameters is successfull then we build the object
            var disco = new MetadataDiscoveryRequest(connectionString, target, filters);

            return(disco);
        }
Ejemplo n.º 17
0
        public string GetTargetExpression(DiscoveryTarget target)
        {
            var text = string.Empty;

            switch (target)
            {
            case DiscoveryTarget.Perspectives:
                text = "perspective";
                break;

            case DiscoveryTarget.MeasureGroups:
                text = "measure-group";
                break;

            case DiscoveryTarget.Measures:
                text = "measure";
                break;

            case DiscoveryTarget.Dimensions:
                text = "dimension";
                break;

            case DiscoveryTarget.Hierarchies:
                text = "hierarchy";
                break;

            case DiscoveryTarget.Levels:
                text = "level";
                break;

            default:
                break;
            }

            return(text);
        }
Ejemplo n.º 18
0
 internal HierarchyNotNullIfLevel(DiscoveryTarget target, IEnumerable<IFilter> filters)
     : base(DiscoveryTarget.Hierarchies, target, filters)
 {
 }
Ejemplo n.º 19
0
 protected CaptionFilter FindFilterOrNull(IEnumerable<IFilter> filters, DiscoveryTarget target)
 {
     var filter = filters.FirstOrDefault(f => f is CaptionFilter && ((CaptionFilter)f).Target == target);
     return (CaptionFilter)filter;
 }
Ejemplo n.º 20
0
 protected IFilter GetSpecificFilter(DiscoveryTarget discoveryTarget)
 {
     return GetSpecificFilter(discoveryTarget, Filters);
 }
Ejemplo n.º 21
0
        protected CaptionFilter FindFilter(DiscoveryTarget target)
        {
            var filter = Filters.First(f => f is CaptionFilter && ((CaptionFilter)f).Target == target);

            return((CaptionFilter)filter);
        }
 internal DimensionNotNullIfHierarchy(DiscoveryTarget target, IEnumerable<IFilter> filters)
     : base(DiscoveryTarget.Dimensions, target, filters)
 {
 }
Ejemplo n.º 23
0
 internal HierarchyNotNullIfLevel(DiscoveryTarget target, IEnumerable<IFilter> filters)
     : base(DiscoveryTarget.Hierarchies, target, filters)
 {
 }
Ejemplo n.º 24
0
 internal LevelNotNullIfProperty(DiscoveryTarget target, IEnumerable <IFilter> filters)
     : base(DiscoveryTarget.Levels, target, filters)
 {
 }
Ejemplo n.º 25
0
 protected IFilter GetSpecificFilter(DiscoveryTarget discoveryTarget)
 {
     return(GetSpecificFilter(discoveryTarget, Filters));
 }
Ejemplo n.º 26
0
        protected CaptionFilter FindFilterOrNull(IEnumerable <IFilter> filters, DiscoveryTarget target)
        {
            var filter = filters.FirstOrDefault(f => f is CaptionFilter && ((CaptionFilter)f).Target == target);

            return((CaptionFilter)filter);
        }
Ejemplo n.º 27
0
 internal FilterNotNull(DiscoveryTarget filterInvestigated, IEnumerable <IFilter> filters)
     : this(filterInvestigated, filterInvestigated, filters)
 {
     //this.target = target;
 }
Ejemplo n.º 28
0
 internal FilterNotNull(DiscoveryTarget filterInvestigated, DiscoveryTarget target, IEnumerable <IFilter> filters)
     : base(filters)
 {
     this.target             = target;
     this.filterInvestigated = filterInvestigated;
 }
Ejemplo n.º 29
0
 internal TableNotNullIfColumn(DiscoveryTarget target,IEnumerable<IFilter> filters)
     : base(DiscoveryTarget.Tables, target, filters)
 {
 }
Ejemplo n.º 30
0
 public AdomdDiscoveryCommand Build(DiscoveryTarget target, IEnumerable<IFilter> filters, string connectionString)
 {
     var command = BuildBase(target, connectionString);
     command.Filters = filters;
     return command;
 }
Ejemplo n.º 31
0
 protected IFilter GetSpecificFilter(DiscoveryTarget discoveryTarget, IEnumerable<IFilter> filters)
 {
     return filters.FirstOrDefault(f => f.Target == discoveryTarget);
 }
Ejemplo n.º 32
0
 internal FilterNotNull(DiscoveryTarget filterInvestigated, DiscoveryTarget target, IEnumerable<IFilter> filters)
     : base(filters)
 {
     this.target = target;
     this.filterInvestigated = filterInvestigated;
 }
Ejemplo n.º 33
0
 public CaptionFilter(string caption, DiscoveryTarget target)
 {
     captionFilter = caption;
     targetFilter  = target;
 }
Ejemplo n.º 34
0
 internal LevelNotNullIfProperty(DiscoveryTarget target, IEnumerable<IFilter> filters)
     : base(DiscoveryTarget.Levels, target, filters)
 {
 }
Ejemplo n.º 35
0
 protected CaptionFilter FindFilter(DiscoveryTarget target)
 {
     var filter = Filters.First(f => f is CaptionFilter && ((CaptionFilter)f).Target == target);
     return (CaptionFilter)filter;
 }
Ejemplo n.º 36
0
 internal FilterNotNull(DiscoveryTarget filterInvestigated, IEnumerable<IFilter> filters)
     : this(filterInvestigated, filterInvestigated, filters)
 {
     //this.target = target;
 }
Ejemplo n.º 37
0
 internal TableNotNullIfColumn(DiscoveryTarget target, IEnumerable <IFilter> filters)
     : base(DiscoveryTarget.Tables, target, filters)
 {
 }
Ejemplo n.º 38
0
 public CaptionFilter(string caption, DiscoveryTarget target)
 {
     captionFilter = caption;
     targetFilter = target;
 }
Ejemplo n.º 39
0
        public string GetTargetExpression(DiscoveryTarget target)
        {
            var text = string.Empty;
            switch (target)
            {
                case DiscoveryTarget.Perspectives:
                    text = "perspective";
                    break;
                case DiscoveryTarget.MeasureGroups:
                    text = "measure-group";
                    break;
                case DiscoveryTarget.Measures:
                    text = "measure";
                    break;
                case DiscoveryTarget.Dimensions:
                    text = "dimension";
                    break;
                case DiscoveryTarget.Hierarchies:
                    text = "hierarchy";
                    break;
                case DiscoveryTarget.Levels:
                    text = "level";
                    break;
                default:
                    break;
            }

            return text;
        }
Ejemplo n.º 40
0
        public virtual MetadataDiscoveryRequest BuildRelation(string connectionString, DiscoveryTarget target, IEnumerable <IFilter> filters)
        {
            //Validations
            Validate(
                new List <Validation>()
            {
                new ConnectionStringNotEmpty(connectionString),
                new PerspectiveNotNull(filters),
                new AtLeastOneNotNull(filters, DiscoveryTarget.Dimensions, DiscoveryTarget.MeasureGroups)
            }
                );

            //If validation of parameters is successfull then we build the object
            var disco = new MetadataLinkedToDiscoveryRequest(connectionString, target, filters);

            return(disco);
        }
Ejemplo n.º 41
0
 internal DimensionNotNullIfHierarchy(DiscoveryTarget target, IEnumerable <IFilter> filters)
     : base(DiscoveryTarget.Dimensions, target, filters)
 {
 }
Ejemplo n.º 42
0
 protected IFilter GetSpecificFilter(DiscoveryTarget discoveryTarget, IEnumerable <IFilter> filters)
 {
     return(filters.FirstOrDefault(f => f.Target == discoveryTarget));
 }