⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inputparameters.java

📁 数据仓库工具
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    public void setGenerateDoml(String generate_Doml) {
        this.generateDoml = generate_Doml;
    }

    /**
     * This method read value from generateSqlForAllVendors parameter
     * @return value of parameter
     */
    public boolean getSqlForAllVendors() {
        return generateSqlForAllVendors;
    }

    /**
     * This method set the value of allVendors parameter
     * @param generate is value of parameter
     */
    public void setAllVendors(String generate) {
        if (generate.equalsIgnoreCase("true")) {
            generateSqlForAllVendors = true;
            allVendors = searchXmlFile.getAllVendors();
        }
    }

    /**
     * This method read value from allVendors parameter
     * @return value of parameter
     */
    public Vector getAllVendors() {
        return allVendors;
    }

    /**
     * This method read value form generateSqlOnly parameter
     * @return value of parameter
     */
    public boolean isGenerateSql() {
        return generateSomeSql;
    }

    private void setDefaultSqlStmt() {
        sqlToGenerate.add(0, null);
        sqlToGenerate.add(1, null);
        sqlToGenerate.add(2, null);
        sqlToGenerate.add(3, null);
        sqlToGenerate.add(4, null);
        sqlToGenerate.add(5, null);
    }

    /**
     * This method sets the value of sqlToGenerate parameter.
     * @param generate_DropTableStmt is value of parameter
     */
    public void setSqlStmtDropTable(String generate_DropTableStmt) {

        if (generate_DropTableStmt.equalsIgnoreCase("true")) {
            generateSomeSql = true;
            sqlToGenerate.setElementAt("DropTables", 1);
        }
    }

    /**
     * This method sets the value of sqlToGenerate parameter.
     * @param generate_DropIntegrityStmt is value of parameter
     */
    public void setSqlStmtDropIntegrity(String generate_DropIntegrityStmt) {
        if (generate_DropIntegrityStmt.equalsIgnoreCase("true")) {
            generateSomeSql = true;
            sqlToGenerate.setElementAt("DropIntegrity", 0);
        }
    }

    /**
     * This method sets the value of sqlToGenerate parameter.
     * @param generate_CreateTableStmt is value of parameter
     */
    public void setSqlStmtCreateTable(String generate_CreateTableStmt) {
        if (generate_CreateTableStmt.equalsIgnoreCase("true")) {
            generateSomeSql = true;
            sqlToGenerate.setElementAt("CreateTables", 2);
        }
    }

    /**
     * This method sets the value of sqlToGenerate parameter.
     * @param generate_CreatePKStmt is value of parameter
     */
    public void setSqlStmtCreatePK(String generate_CreatePKStmt) {
        if (generate_CreatePKStmt.equalsIgnoreCase("true")) {
            if (!this.alterTablePrimaryKey.equalsIgnoreCase("false")) {
                generateSomeSql = true;
                sqlToGenerate.setElementAt("CreatePrimary", 4);
            }
        }
    }

    /**
     * This method sets the value of sqlToGenerate parameter.
     * @param generate_CreateFKStmt is value of parameter
     */
    public void setSqlStmtCreateFK(String generate_CreateFKStmt) {
        if (generate_CreateFKStmt.equalsIgnoreCase("true")) {
            generateSomeSql = true;
            sqlToGenerate.setElementAt("CreateForeigin", 5);
        }
    }

    /**
     * This method sets the value of sqlToGenerate parameter.
     * @param generate_CreateIndexStmt is value of parameter
     */
    public void setSqlStmtCreateIndex(String generate_CreateIndexStmt) {
        if (generate_CreateIndexStmt.equalsIgnoreCase("true")) {
            generateSomeSql = true;
            sqlToGenerate.setElementAt("CreateIndexes", 3);
        }
    }

    /**
     * This method reads value of sqlToGenerate parameter.
     * @return value of parameter.
     */
    public Vector getSqlToGenerate() {
        return sqlToGenerate;
    }

    /**
     * This method sets value of sqlToGenerate parameter.
     */
    public void setSqlToGenerate() {

        if (this.alterTablePrimaryKey.equalsIgnoreCase("false")) {
            sqlToGenerate.setElementAt(null, 4);
        }
    }

    /**
     * This method reads value of path parameter.
     * @return value of parameter.
     */
    public String getPath() {
        return path;
    }

    /**
     * Construct object InputParameters, and initialise the default value of input parameters.
     * @throws LoaderException
     */
    public InputParameters(String confJarStructure) throws LoaderException {
        //initialization InputParameters
        setDefaultSqlStmt();
        searchXmlFile = new SearchXmlFile("relative", path, confJarStructure);
    }

    /**
     * This method sets the value of pathToSourceConf parameter.
     * @param path_ToSourceConf is the value of parameter.
     */
    public void setPathToSourceConf(String path_ToSourceConf) {
        pathToSourceConf = path_ToSourceConf;
    }

    /**
     * This method read the value of pathToSourceConf parameter.
     * @return the value of parameter.
     */
    public String getPathToSourceConf() {
        return pathToSourceConf;
    }

    /**
     * This method sets the value of sourceType parameter.
     * @param source_Type is the value of parameter.
     * @throws LoaderException
     */
    public void setSourceType(String source_Type) throws LoaderException {
        setLogger();
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetSourceType is started.");
//        }
        if (source_Type != null) {
            if (searchXmlFile.getPathToConf(source_Type) != null) {
                setPathToSourceConf(searchXmlFile.getPathToConf(source_Type));
                sourceType = source_Type;
            } else {
                String msg = "This type of source database (" + source_Type + ") is not supported!" + " See documentation!";
								LoaderException le = new LoaderException("Exception:", new Exception(msg + "\n"));
                if (this.logger != null) {
                    this.logger.write("full", "Exception:" + "This type of source database (" + source_Type + ") is not supported!" + " See documentation!"+le.getStackTraceAsString());
                }
                
                throw le;
            }
        }
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetSourceType is finished.");
//        }
    }

    /**
     * This method read the value of sourceType parameter.
     * @return value of parameter.
     */
    public String getSourceType() {
        return sourceType;
    }

    /**
     * This method sets the value of pathToTargetConf parameter.
     * @param path_ToTargetConf is the value of parameter.
     */
    public void setPathToTargetConf(String path_ToTargetConf) {
        pathToTargetConf = path_ToTargetConf;
    }

    /**
     * This method read the value of pathToTargetConf parameter.
     * @return value of parameter.
     */
    public String getPathToTargetConf() {
        return pathToTargetConf;
    }

    /**
     * This method sets the value of targetType parameter.
     * @param target_Type is the value of parameter.
     * @throws LoaderException
     */
    public void setTargetType(String target_Type) throws LoaderException {
        setLogger();
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetTargetType is started.");
//        }
        if (target_Type != null) {
            //search the OctopusDBVendors.xml file for defined type of database.
            if (searchXmlFile.getPathToConf(target_Type) != null) {
                setPathToTargetConf(searchXmlFile.getPathToConf(target_Type));
                targetType = target_Type;
                setAlterTablePrimaryKey2(pathToTargetConf);
            } else {
                String msg = "This type of target database (" + target_Type + ") is not supported!" + " See documentation!";
								LoaderException le = new LoaderException("Exception:", new Exception(msg));
                if (this.logger != null) {
                    this.logger.write("full", "Exception:" + "This type of target database (" + target_Type + ") is not supported!" + " See documentation!"+le.getStackTraceAsString());
                } 
                throw le;
            }
        }
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetTargetType is finished.");
//        }
    }

    private void setAlterTablePrimaryKey2(String pathToTargetConf) throws LoaderException {
        SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToTargetConf(), getConfJarStructure());
        if ((searchXmlFile.getAlterTablePrimaryKey(getTargetDriverName()) != null))
            setAlterTablePrimaryKey(searchXmlFile.getAlterTablePrimaryKey(getTargetDriverName()));
    }

    public void setSourceDriverProperties() throws LoaderException {
        setLogger();
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetSourceDriverProperties is started.");
//        }
        SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToSourceConf(), getConfJarStructure());
        Vector tmpVector = searchXmlFile.getFileSystemDatabase(getSourceDriverName());
        String fileSystemDatabse = tmpVector.get(0).toString();
        String connectionPrefix = tmpVector.get(1).toString();

        if (fileSystemDatabse.equalsIgnoreCase("true")) {
            File file = new File(getSourceDataBase());
            File fileOut = new File(getGeneratorOutput());
            if (!file.isAbsolute()) {
                try {
                    String main = "";
                    if (!getGeneratorOutput().equalsIgnoreCase(""))
                        main = fileOut.getCanonicalPath() + System.getProperty("file.separator") + getSourceDataBase();
                    else
                        main = getSourceDataBase();

                    File mainFile = new File(main);
                    setSourceDataBase(mainFile.getCanonicalPath());
                } catch (Exception ex) {
										LoaderException le = new LoaderException("Exception:" + ex.getMessage(), ex);
                    if (this.logger != null) {
                        this.logger.write("full", "Exception:" + le.getStackTraceAsString());
                    }
                   
                    throw le;
                    //ex.printStackTrace();
                }
            }
        }
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetSourceDriverProperties is finished.");
//        }
    }

    public void setTargetDriverProperties() throws LoaderException {
        setLogger();
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetTargetDriverProperties is started.");
//        }
        SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToTargetConf(), getConfJarStructure());
        try {
            this.maxConstraintLength = searchXmlFile.getMaxConstraintLength(getTargetDriverName());
        } catch (Exception ex) {
						LoaderException le = new LoaderException("Exception:" + ex.getMessage(), ex);
            this.logger.write("full", "Exception:" + le.getStackTraceAsString());
            throw le;
        }
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetTargetDriverProperties is finished.");
//        }

    }

    public String getMaxConstraintLength() {
        return this.maxConstraintLength;
    }

    /**
     * This method read the value of targetType parameter.
     * @return value of parameter.
     */
    public String getTargetType() {
        return targetType;
    }

    /**
     * This method sets the value of sourceDataBase parameter.
     * @param source_DataBase is the value of parameter.
     * @throws LoaderException
     */
    public void setSourceDataBase(String source_DataBase) throws LoaderException {
        setLogger();
//        if (this.logger != null) {
//            this.logger.write("full", "\tsetSourceDataBase is started.");
//        }
        if (source_DataBase != null) {
            if (this.sourceDriverName.equalsIgnoreCase("microsoft")) {
                int num1 = source_DataBase.indexOf("SelectMethod=");
                int num2 = source_DataBase.indexOf("selectMethod=");
                if (num2 != -1) {
                    //           source_DataBase=source_DataBase.replaceFirst("selectMethod=","SelectMethod=");
                    if (source_DataBase.indexOf("selectMethod=") != -1)
                        source_DataBase = Utils.replaceAll(source_DataBase, "selectMethod=", "SelectMethod=");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -