public void writeMainWorkflow(String projN, ArrayList<String> mainWf, MyArrayList<String> srcWf, MyArrayList<String> odsWf,int parallelLines){
        ArrayList<String> workflow=rfa.readInputStream(GenerateSrcOdsScripts.class.getResourceAsStream("config/common/workflow.xml"), "UTF-8");
        StringBuffer content=new StringBuffer();

        for (int i = 0; i < workflow.size(); i++) {
            if(workflow.get(i).contains("{project-name-config-generate}")) {
                content.append("<workflow-app xmlns=\"uri:oozie:workflow:0.2\" name=\"" + projN + "-wf\">\n");
            }else if(workflow.get(i).contains("{multiple-path-config-generate}")){
                content.append("    <start to=\"load_data_fork\"/>\n");
                content.append("    <!-- "+srcWf.size()+" -->\n");
                content.append("    <fork name =\"load_data_fork\">\n");
                for(int j=0; j<mainWf.size(); ++j){
                    content.append("        <path start=\""+mainWf.get(j)+"_node\"></path>\n");
                }
                content.append("    </fork>\n");

                for (int j = 0; j < mainWf.size(); j++) {
                    content.append("    <action name=\""+mainWf.get(j)+"_node\">\n");
                    content.append("        <sub-workflow>\n");
                    content.append("            <app-path>${application_path}/"+mainWf.get(j)+".xml</app-path>\n");
                    content.append("            <propagate-configuration/>\n");
                    content.append("        </sub-workflow>\n");
                    content.append("        <ok to=\"load_date_join\"/>\n");
                    content.append("        <error to=\"fail\"/>\n");
                    content.append("    </action>\n");
                }
                content.append("\n");
            }else if(workflow.get(i).contains("cp-success-node-config-generate")){
                ArrayList<String> cp_success=rfa.readInputStream(GenerateSrcOdsScripts.class.getResourceAsStream("config/common/cp_success_node.xml"), "UTF-8");
                for (int j = 0; j < cp_success.size(); j++) {
                    content.append(cp_success.get(j)+"\n");
                }
            }else if(workflow.get(i).contains("{project-message-config-generate}")){
                content.append("            "+projN+"-wf-synochronized workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}]\n");
            }
            else
                content.append(workflow.get(i)+"\n");
        }
        String initPath=System.getProperty("user.dir")+File.separator+projN;
        wfa.mkdirs(initPath);
        wfa.writeFromStringBuffer(initPath+File.separator+"workflow.xml","UTF-8",content);

        initPath=System.getProperty("user.dir")+File.separator+projN+"-ods";
        wfa.mkdirs(initPath);
        wfa.writeFromStringBuffer(initPath+File.separator+"workflow.xml","UTF-8",content);

        for (int i = 0; i < mainWf.size(); i++) {
            writeSrcWorkflow(projN, "sub-"+mainWf.get(i).substring(4,6)+"-"+projN,srcWf.getRange(srcWf.size() * i / mainWf.size(), srcWf.size() * (i + 1) / mainWf.size()-1), parallelLines, mainWf.get(i), true);
            writeOdsWorkflow(projN+"-ods", "sub-"+mainWf.get(i).substring(4,6)+"-"+projN+"-ods", odsWf.getRange(odsWf.size() * i / mainWf.size(), odsWf.size() * (i + 1) / mainWf.size()-1), parallelLines, mainWf.get(i), true);
        }
    }