Esempio n. 1
0
        public CodeConstructor[] GenererateContructors(JdbcQueryActivity jdbcQueryActivity, CodeTypeDeclaration classModel)
        {
            var constructor = new CodeConstructor();

            constructor.Attributes = MemberAttributes.Public;

            foreach (CodeMemberField field in classModel.Members)
            {
                if (field.Type.BaseType == iDataAccessFactory)
                {
                    constructor.Parameters.Add(
                        new CodeParameterDeclarationExpression()
                    {
                        Type = field.Type,
                        Name = field.Name,
                        // TODO verifier que ca marche
                        CustomAttributes = new CodeAttributeDeclarationCollection {
                            new CodeAttributeDeclaration(
                                JdbcQueryBuilderUtils.ConvertJdbcConnectionName(jdbcQueryActivity.JdbcSharedConfig)
                                )
                        }
                    });

                    var parameterReference = new CodeFieldReferenceExpression(
                        new CodeThisReferenceExpression(), field.Name);

                    constructor.Statements.Add(new CodeAssignStatement(parameterReference,
                                                                       new CodeArgumentReferenceExpression(field.Name)));
                }
            }

            return(new List <CodeConstructor> {
                constructor
            }.ToArray());
        }
Esempio n. 2
0
        private CodeTypeMember[] GenererateProperties(JdbcQueryActivity jdbcQueryActivity)
        {
            var properties = new List <CodeTypeMember>();

            foreach (var element in jdbcQueryActivity.QueryOutputStatementParameters)
            {
                properties.Add(CodeDomUtils.GenerateProperty(element.Name, JdbcQueryBuilderUtils.ConvertSQLTypeToTypeInString(element.Type)));
            }
            return(properties.ToArray());
        }
        public IActivityBuilder Get(ActivityType activityType)
        {
            var jdbcQueryBuilderUtils = new JdbcQueryBuilderUtils();
            var xslBuilder = new XslBuilder(new XpathBuilder());
            var jdbcQueryActivityBuilder = new JdbcQueryActivityBuilder(new DataAccessBuilder(jdbcQueryBuilderUtils), new DataAccessServiceBuilder(jdbcQueryBuilderUtils), new DataAccessInterfacesCommonBuilder(), xslBuilder);
            if (activityType == ActivityType.jdbcQueryActivityType || activityType == ActivityType.jdbcCallActivityType || activityType == ActivityType.jdbcUpdateActivityType)
            {
                return jdbcQueryActivityBuilder;
            }
            if (activityType == ActivityType.assignActivityType)
            {
                return new AssignActivityBuilder(xslBuilder);
            }

            if (activityType == ActivityType.xmlParseActivityType)
            {
                return new XmlParseActivityBuilder(xslBuilder, new XmlParserHelperBuilder());
            }

            if (activityType == ActivityType.mapperActivityType)
            {
                return new MapperActivityBuilder(xslBuilder);
            }

            if (activityType == ActivityType.nullActivityType)
            {
                return new NullActivityBuilder(xslBuilder);
            }

            if (activityType == ActivityType.javaActivityType)
            {
                return new JavaActivityBuilder(xslBuilder);
            }

            if (activityType == ActivityType.writeToLogActivityType)
            {
                return new WriteToLogActivityBuilder(xslBuilder);
            }

            if (activityType == ActivityType.generateErrorActivity)
            {
                return new GenerateErrorActivityBuilder(xslBuilder);
            }

            if (activityType == ActivityType.groupActivityType)
            {
                return new GroupActivityBuilder(xslBuilder);
            }

            return new DefaultActivityBuilder(xslBuilder);
        }
 public void SetUp()
 {
     jdbcQueryActivity = new JdbcQueryActivity ("Currency" , ActivityType.jdbcQueryActivityType);
     jdbcQueryActivity.QueryStatement = select;
     jdbcQueryActivity.QueryStatementParameters = new Dictionary<string, string> {
         {
             "IdBbUnique",
             "VARCHAR"
         }
     };
     jdbcQueryActivity.JdbcSharedConfig = string.Empty;
     var jdbcQueryBuilderUtils = new JdbcQueryBuilderUtils ();
     jdbcQueryActivityBuilder = new JdbcQueryActivityBuilder (
         new DataAccessBuilder (jdbcQueryBuilderUtils),
         new DataAccessServiceBuilder (jdbcQueryBuilderUtils),
         new DataAccessInterfacesCommonBuilder(),
         new XslBuilder(new XpathBuilder())
     );
 }
        public static CodeMemberMethod GenerateExecuteQuerySignature(JdbcQueryActivity jdbcQueryActivity)
        {
            var method = new CodeMemberMethod();

            method.Attributes = MemberAttributes.Public | MemberAttributes.Final;
            method.Name       = ExecuteSqlQueryMethodName;
            if (jdbcQueryActivity.QueryOutputStatementParameters != null && jdbcQueryActivity.QueryOutputStatementParameters.Count > 0)
            {
                if (ActivityType.jdbcCallActivityType != jdbcQueryActivity.Type)
                {
                    method.ReturnType = new CodeTypeReference("List<" + VariableHelper.ToClassName(jdbcQueryActivity.ClassName + ">"));
                }
                else
                {
                    method.ReturnType = new CodeTypeReference(VariableHelper.ToClassName(jdbcQueryActivity.ClassName));
                }
            }
            else
            {
                method.ReturnType = new CodeTypeReference(CSharpTypeConstant.SystemVoid);
            }
            method.Parameters.AddRange(JdbcQueryBuilderUtils.ConvertQueryStatementParameter(jdbcQueryActivity.QueryStatementParameters));
            return(method);
        }
 public DataAccessServiceBuilder(JdbcQueryBuilderUtils jdbcQueryBuilderUtils)
 {
     this.jdbcQueryBuilderUtils = jdbcQueryBuilderUtils;
 }