Commit 0567c947 authored by mcb's avatar mcb

commit

parent 0adfe38d
...@@ -123,7 +123,7 @@ public class SyncParameters extends AbstractParameters { ...@@ -123,7 +123,7 @@ public class SyncParameters extends AbstractParameters {
|| sourceTypeId == DatasouceTypeConstant.Informix || sourceTypeId == DatasouceTypeConstant.Informix
|| sourceTypeId == DatasouceTypeConstant.DB2)) { || sourceTypeId == DatasouceTypeConstant.DB2)) {
//source //source
getJdbcSource(dmpSyncingDatasource, registerTableName, freeMarkerConfig); getJdbcSource(dmpSyncingDatasource, registerTableName, freeMarkerConfig, publicKey);
} }
//产生 Jdbc(MySQL、Oracle、SqlServer、PostgreSQL、Informix、DB2) sink //产生 Jdbc(MySQL、Oracle、SqlServer、PostgreSQL、Informix、DB2) sink
if ((targetTypeId == DatasouceTypeConstant.MySQL if ((targetTypeId == DatasouceTypeConstant.MySQL
...@@ -132,7 +132,7 @@ public class SyncParameters extends AbstractParameters { ...@@ -132,7 +132,7 @@ public class SyncParameters extends AbstractParameters {
|| targetTypeId == DatasouceTypeConstant.PostgreSQL || targetTypeId == DatasouceTypeConstant.PostgreSQL
|| targetTypeId == DatasouceTypeConstant.Informix || targetTypeId == DatasouceTypeConstant.Informix
|| targetTypeId == DatasouceTypeConstant.DB2)) { || targetTypeId == DatasouceTypeConstant.DB2)) {
getJdbcSink(targetDatasource,targetObj,freeMarkerConfig,publicKey); getJdbcSink(targetDatasource, targetObj, freeMarkerConfig, publicKey);
} }
//transform //transform
if (mappingObj.size() > 0 && null != mappingObj) { if (mappingObj.size() > 0 && null != mappingObj) {
...@@ -150,8 +150,6 @@ public class SyncParameters extends AbstractParameters { ...@@ -150,8 +150,6 @@ public class SyncParameters extends AbstractParameters {
.append(" $t "); .append(" $t ");
sqlModel.put("sql", sql); sqlModel.put("sql", sql);
sqlModel.put("source_table_name", source_table_name); sqlModel.put("source_table_name", source_table_name);
//String table_name = registerTableName[0] + "_view";
//sqlModel.put("table_name", table_name);
transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, sqlModel, freeMarkerConfig); transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, sqlModel, freeMarkerConfig);
Map targetModel = new HashMap(); Map targetModel = new HashMap();
...@@ -161,7 +159,7 @@ public class SyncParameters extends AbstractParameters { ...@@ -161,7 +159,7 @@ public class SyncParameters extends AbstractParameters {
.append(" from ") .append(" from ")
.append(" $t "); .append(" $t ");
targetModel.put("sql", targetSql); targetModel.put("sql", targetSql);
targetModel.put("source_table_name", targetTable); targetModel.put("source_table_name", source_table_name);
transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, targetModel, freeMarkerConfig); transform = transform + FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_TRANSFORM_SQL, targetModel, freeMarkerConfig);
} }
...@@ -216,7 +214,7 @@ public class SyncParameters extends AbstractParameters { ...@@ -216,7 +214,7 @@ public class SyncParameters extends AbstractParameters {
waterdropScript = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL, waterdropModel, freeMarkerConfig); waterdropScript = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL, waterdropModel, freeMarkerConfig);
} }
public void getJdbcSource(DmpSyncingDatasource dmpSyncingDatasource, String[] registerTableName, FreeMarkerConfigurer freeMarkerConfig) { public void getJdbcSource(DmpSyncingDatasource dmpSyncingDatasource, String[] registerTableName, FreeMarkerConfigurer freeMarkerConfig, String publicKey) {
for (String tableName : registerTableName) { for (String tableName : registerTableName) {
Map jdbcModel = new HashMap(); Map jdbcModel = new HashMap();
jdbcModel.put("driver", dmpSyncingDatasource.getDriverClassName()); jdbcModel.put("driver", dmpSyncingDatasource.getDriverClassName());
...@@ -224,7 +222,7 @@ public class SyncParameters extends AbstractParameters { ...@@ -224,7 +222,7 @@ public class SyncParameters extends AbstractParameters {
jdbcModel.put("table", tableName); jdbcModel.put("table", tableName);
jdbcModel.put("result_table_name", tableName); jdbcModel.put("result_table_name", tableName);
jdbcModel.put("user", dmpSyncingDatasource.getUserName()); jdbcModel.put("user", dmpSyncingDatasource.getUserName());
jdbcModel.put("password", dmpSyncingDatasource.getPassword()); jdbcModel.put("password", EncryptionUtils.decode(dmpSyncingDatasource.getPassword(), publicKey));
jdbcModel.put("partitionColumn", ""); jdbcModel.put("partitionColumn", "");
jdbcModel.put("numPartitions", ""); jdbcModel.put("numPartitions", "");
jdbcModel.put("lowerBound", ""); jdbcModel.put("lowerBound", "");
...@@ -233,7 +231,7 @@ public class SyncParameters extends AbstractParameters { ...@@ -233,7 +231,7 @@ public class SyncParameters extends AbstractParameters {
} }
} }
public void getJdbcSink(DmpSyncingDatasource targetDatasource,Map<String, Object> targetObj,FreeMarkerConfigurer freeMarkerConfig,String publicKey){ public void getJdbcSink(DmpSyncingDatasource targetDatasource, Map<String, Object> targetObj, FreeMarkerConfigurer freeMarkerConfig, String publicKey) {
String postImportStatement = String.valueOf(targetObj.get("postImportStatement")); //导入后语句 String postImportStatement = String.valueOf(targetObj.get("postImportStatement")); //导入后语句
String preImportStatement = String.valueOf(targetObj.get("preImportStatement")); //导入前语句 String preImportStatement = String.valueOf(targetObj.get("preImportStatement")); //导入前语句
preStatements = new ArrayList<String>(); preStatements = new ArrayList<String>();
...@@ -265,7 +263,8 @@ public class SyncParameters extends AbstractParameters { ...@@ -265,7 +263,8 @@ public class SyncParameters extends AbstractParameters {
} }
jdbcSinkModel.put("dbtable", targetObj.get("targetTable")); //目标表 jdbcSinkModel.put("dbtable", targetObj.get("targetTable")); //目标表
jdbcSinkModel.put("user", targetDatasource.getUserName()); jdbcSinkModel.put("user", targetDatasource.getUserName());
jdbcSinkModel.put("password", targetDatasource.getPassword()); jdbcSinkModel.put("password", password);
jdbcSinkModel.put("source_table_name", targetObj.get("targetTable"));
sink = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_SINK_JDBC, jdbcSinkModel, freeMarkerConfig); sink = FreeMarkerUtils.freemakerJson(CommConstant.WATERDROP_FTL_SINK_JDBC, jdbcSinkModel, freeMarkerConfig);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment