-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add chunjun ChunjunSinkFactory for UpdateMode types filter at runtime…
… by JdbcDialect class annotation datavane/tis#139
- Loading branch information
1 parent
596aa58
commit 8230ab1
Showing
31 changed files
with
324 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,14 +18,23 @@ | |
|
||
package com.qlangtech.plugins.incr.flink.chunjun.sink; | ||
|
||
import com.dtstack.chunjun.connector.jdbc.dialect.JdbcDialect; | ||
import com.dtstack.chunjun.connector.jdbc.dialect.SupportUpdateMode; | ||
import com.dtstack.chunjun.sink.WriteMode; | ||
import com.qlangtech.tis.extension.TISExtension; | ||
import com.qlangtech.tis.extension.impl.SuFormProperties; | ||
import com.qlangtech.tis.plugin.annotation.FormField; | ||
import com.qlangtech.tis.plugin.annotation.FormFieldType; | ||
import com.qlangtech.tis.plugin.annotation.Validator; | ||
import com.qlangtech.tis.plugin.datax.IncrSelectedTabExtend; | ||
import com.qlangtech.tis.plugin.incr.TISSinkFactory; | ||
import com.qlangtech.tis.plugins.incr.flink.connector.ChunjunSinkFactory; | ||
import com.qlangtech.tis.plugins.incr.flink.connector.UpdateMode; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
|
@@ -43,6 +52,24 @@ public UpdateMode getIncrMode() { | |
return Objects.requireNonNull(incrMode, "incrMode can not be null"); | ||
} | ||
|
||
/** | ||
* 由于每种 JdbcDialect 支持的写入类型是不同的所以需要在在运行时 更新下拉列表需要进行过滤 | ||
* | ||
* @param descs | ||
* @return | ||
* @see JdbcDialect | ||
* @see SupportUpdateMode | ||
*/ | ||
public static List<UpdateMode.BasicDescriptor> filter(List<UpdateMode.BasicDescriptor> descs) { | ||
|
||
SuFormProperties.SuFormGetterContext context = SuFormProperties.subFormGetterProcessThreadLocal.get(); | ||
Objects.requireNonNull(context, "context can not be null"); | ||
//String dataXName = context.param.getDataXName(); | ||
ChunjunSinkFactory sinkFactory = (ChunjunSinkFactory) TISSinkFactory.getIncrSinKFactory(context.param.getPluginContext()); | ||
Set<WriteMode> writeModes = sinkFactory.supportSinkWriteMode(); | ||
return descs.stream().filter((d) -> writeModes.contains(d.writeMode)).collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public boolean isSource() { | ||
return false; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 25 additions & 24 deletions
49
...plugin/src/main/java/com/qlangtech/tis/plugins/incr/flink/connector/impl/ReplaceType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,45 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.qlangtech.tis.plugins.incr.flink.connector.impl; | ||
|
||
import com.dtstack.chunjun.sink.WriteMode; | ||
import com.qlangtech.tis.extension.TISExtension; | ||
import org.apache.commons.lang.StringUtils; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
* @create: 2022-07-18 10:09 | ||
**/ | ||
public class ReplaceType extends BasicUpdate { | ||
|
||
// private static final String REPLACE = "replace"; | ||
|
||
@Override | ||
protected String getMode() { | ||
return WriteMode.REPLACE.getMode(); | ||
} | ||
// @Override | ||
// protected String getMode() { | ||
// return WriteMode.REPLACE.getMode(); | ||
// } | ||
|
||
@TISExtension | ||
public static final class DftDescriptor extends BasicDescriptor { | ||
public String getDisplayName() { | ||
return StringUtils.capitalize(WriteMode.REPLACE.getMode()); | ||
public DftDescriptor() { | ||
super(WriteMode.REPLACE); | ||
} | ||
|
||
// public String getDisplayName() { | ||
// return StringUtils.capitalize(WriteMode.REPLACE.getMode()); | ||
// } | ||
} | ||
} |
Oops, something went wrong.