大佬教程收集整理的这篇文章主要介绍了通过数据库连接器创建SQL查询的动态Mule创建条件,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想到使用自定义变压器。所以我为此使用了Java转换器。
逻辑看起来像这样:
public class queryBuilder extends Abstractmessagetransformer {
@OverrIDe
public Object transformmessage(Mulemessage message, String outputEnCoding)
throws transformerException {
System.out.println("query Params : "
+ message.geTinboundProperty("http.query.params").getClass()
.getname());
Map<?, ?> map = message.geTinboundProperty("http.query.params");
System.out.println("Map keys : " + map.keySet());
String where = "";
for (Map.Entry<?, ?> entry : map.entrySet()) {
System.out.println(entry.getKey() + "/" + entry.getValue());
where = where+" "+entry.getKey()+"="+"'"+entry.getValue()+"'"+" and";
}
String whereCondition = where.subString(0, where.lasTindexOf(" "));
System.out.println("Where condition is : "+ where.subString(0, where.lasTindexOf(" ")));
return whereCondition;
}}
现在,这将返回字符串类型的有效负载。
在数据库连接器中,将查询类型选择为 。在 条件之后,添加 。
干杯
以上是大佬教程为你收集整理的通过数据库连接器创建SQL查询的动态Mule创建条件全部内容,希望文章能够帮你解决通过数据库连接器创建SQL查询的动态Mule创建条件所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。