Exemplo n.º 1
0
        public AdvertisedPipelineComponentTypeUnderContext(Type componentType, IPipelineUseCase useCase)
        {
            _componentType = componentType;

            _role = PipelineComponent.GetRoleFor(componentType);

            var context = useCase.GetContext();

            _allowableUnderContext = context.IsAllowable(componentType, out _allowableReason);

            Type[] initializationTypes;

            var initializationObjects = useCase.GetInitializationObjects();

            //it is permitted to specify only Types as initialization objects if it is design time and the user hasn't picked any objects to execute the use case under
            if (useCase.IsDesignTime && initializationObjects.All(t => t is Type))
            {
                initializationTypes = initializationObjects.Cast <Type>().ToArray();
            }
            else
            {
                initializationTypes = useCase.GetInitializationObjects().Select(o => o.GetType()).ToArray();
            }

            foreach (var requiredInputType in context.GetIPipelineRequirementsForType(componentType))
            {
                //if there are no initialization objects that are instances of an IPipelineRequirement<T> then we cannot satisfy the components pipeline requirements (e.g. a component  DelimitedFlatFileDataFlowSource requires a FlatFileToLoad but pipeline is trying to load from a database reference)
                if (!initializationTypes.Any(available => requiredInputType == available || requiredInputType.IsAssignableFrom(available)))
                {
                    unmetRequirements.Add(requiredInputType);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new argument storage object for one of the arguments in <see cref="PipelineComponent"/>.
 ///
 /// <para>You should probably call <see cref="IArgumentHost.CreateArgumentsForClassIfNotExists{T}"/> intead</para>
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="parent"></param>
 public PipelineComponentArgument(ICatalogueRepository repository, PipelineComponent parent)
 {
     repository.InsertAndHydrate(this, new Dictionary <string, object>()
     {
         { "PipelineComponent_ID", parent.ID },
         { "Name", "Parameter" + Guid.NewGuid() },
         { "Type", typeof(string).ToString() }
     });
 }
Exemplo n.º 3
0
        /// <inheritdoc/>
        public void Clone(PipelineComponent intoTargetComponent)
        {
            var cloneArg = new PipelineComponentArgument(intoTargetComponent.CatalogueRepository, intoTargetComponent);

            cloneArg.Name        = Name;
            cloneArg.Value       = Value;
            cloneArg.Type        = Type;
            cloneArg.Description = Description;
            cloneArg.SaveToDatabase();
        }
Exemplo n.º 4
0
        /// <inheritdoc/>
        public PipelineComponent Clone(Pipeline intoTargetPipeline)
        {
            var cataRepo = (ICatalogueRepository)intoTargetPipeline.Repository;

            var clone = new PipelineComponent(cataRepo, intoTargetPipeline, GetClassAsSystemType(), Order);

            foreach (var argument in PipelineComponentArguments)
            {
                argument.Clone(clone);
            }

            clone.Name = Name;
            clone.SaveToDatabase();

            return(clone);
        }
Exemplo n.º 5
0
        /// <inheritdoc/>
        public PipelineComponent Clone(Pipeline intoTargetPipeline)
        {
            var cataRepo = (ICatalogueRepository)intoTargetPipeline.Repository;

            var clone = new PipelineComponent(cataRepo, intoTargetPipeline, GetClassAsSystemType(), Order);

            foreach (IPipelineComponentArgument argument in PipelineComponentArguments)
            {
                var cloneArg = new PipelineComponentArgument(cataRepo, clone);

                cloneArg.Name  = argument.Name;
                cloneArg.Value = argument.Value;
                cloneArg.SetType(argument.GetSystemType());
                cloneArg.Description = argument.Description;
                cloneArg.SaveToDatabase();
            }

            clone.Name = Name;
            clone.SaveToDatabase();

            return(clone);
        }