|
|
@ -14,6 +14,7 @@ import com.fr.general.data.DataModel; |
|
|
|
import com.fr.intelli.record.Focus; |
|
|
|
import com.fr.intelli.record.Focus; |
|
|
|
import com.fr.plugin.db.es.fun.help.RenderUtils; |
|
|
|
import com.fr.plugin.db.es.fun.help.RenderUtils; |
|
|
|
import com.fr.plugin.db.es.fun.type.ConverterType; |
|
|
|
import com.fr.plugin.db.es.fun.type.ConverterType; |
|
|
|
|
|
|
|
import com.fr.plugin.db.es.fun.type.QueryType; |
|
|
|
import com.fr.record.analyzer.EnableMetrics; |
|
|
|
import com.fr.record.analyzer.EnableMetrics; |
|
|
|
import com.fr.script.Calculator; |
|
|
|
import com.fr.script.Calculator; |
|
|
|
import com.fr.stable.NameReference; |
|
|
|
import com.fr.stable.NameReference; |
|
|
@ -39,6 +40,8 @@ public class ElasticsearchTableData extends BaseTableData { |
|
|
|
private Conf<String> endPoint = HolderKit.simple(StringKit.EMPTY); |
|
|
|
private Conf<String> endPoint = HolderKit.simple(StringKit.EMPTY); |
|
|
|
@Identifier("query") |
|
|
|
@Identifier("query") |
|
|
|
private Conf<String> query = HolderKit.simple(StringKit.EMPTY); |
|
|
|
private Conf<String> query = HolderKit.simple(StringKit.EMPTY); |
|
|
|
|
|
|
|
@Identifier("queryType") |
|
|
|
|
|
|
|
private Conf<String> queryType = HolderKit.simple(QueryType.GET.getType()); |
|
|
|
@Identifier("script") |
|
|
|
@Identifier("script") |
|
|
|
private Conf<String> script = HolderKit.simple(StringKit.EMPTY); |
|
|
|
private Conf<String> script = HolderKit.simple(StringKit.EMPTY); |
|
|
|
@Identifier("converterType") |
|
|
|
@Identifier("converterType") |
|
|
@ -74,6 +77,14 @@ public class ElasticsearchTableData extends BaseTableData { |
|
|
|
this.query.set(query); |
|
|
|
this.query.set(query); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public QueryType getQueryType() { |
|
|
|
|
|
|
|
return QueryType.parse(queryType.get()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setQueryType(QueryType queryType) { |
|
|
|
|
|
|
|
this.queryType.set(queryType.getType()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getScript() { |
|
|
|
public String getScript() { |
|
|
|
return script.get(); |
|
|
|
return script.get(); |
|
|
|
} |
|
|
|
} |
|
|
@ -116,6 +127,7 @@ public class ElasticsearchTableData extends BaseTableData { |
|
|
|
connection, |
|
|
|
connection, |
|
|
|
RenderUtils.calculateQuery(endPoint.get(), ps), |
|
|
|
RenderUtils.calculateQuery(endPoint.get(), ps), |
|
|
|
RenderUtils.calculateQuery(query.get(), ps), |
|
|
|
RenderUtils.calculateQuery(query.get(), ps), |
|
|
|
|
|
|
|
getQueryType(), |
|
|
|
RenderUtils.calculateQuery(script.get(), ps), |
|
|
|
RenderUtils.calculateQuery(script.get(), ps), |
|
|
|
getConverterType(), |
|
|
|
getConverterType(), |
|
|
|
getConfigAttribute(), |
|
|
|
getConfigAttribute(), |
|
|
@ -148,6 +160,10 @@ public class ElasticsearchTableData extends BaseTableData { |
|
|
|
if ((tmpVal = reader.getElementValue()) != null) { |
|
|
|
if ((tmpVal = reader.getElementValue()) != null) { |
|
|
|
this.setQuery(tmpVal); |
|
|
|
this.setQuery(tmpVal); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if ("QueryType".equals(tmpName)) { |
|
|
|
|
|
|
|
if ((tmpVal = reader.getElementValue()) != null) { |
|
|
|
|
|
|
|
this.setQueryType(QueryType.parse(tmpVal)); |
|
|
|
|
|
|
|
} |
|
|
|
} if ("Script".equals(tmpName)) { |
|
|
|
} if ("Script".equals(tmpName)) { |
|
|
|
if ((tmpVal = reader.getElementValue()) != null) { |
|
|
|
if ((tmpVal = reader.getElementValue()) != null) { |
|
|
|
this.setScript(tmpVal); |
|
|
|
this.setScript(tmpVal); |
|
|
@ -171,6 +187,7 @@ public class ElasticsearchTableData extends BaseTableData { |
|
|
|
XmlKit.writeXMLable(writer, configAttribute.get(), ConfigAttribute.XML_TAG); |
|
|
|
XmlKit.writeXMLable(writer, configAttribute.get(), ConfigAttribute.XML_TAG); |
|
|
|
} |
|
|
|
} |
|
|
|
writer.startTAG("Query").textNode(getQuery()).end(); |
|
|
|
writer.startTAG("Query").textNode(getQuery()).end(); |
|
|
|
|
|
|
|
writer.startTAG("QueryType").textNode(getQueryType().getType()).end(); |
|
|
|
writer.startTAG("Script").textNode(getScript()).end(); |
|
|
|
writer.startTAG("Script").textNode(getScript()).end(); |
|
|
|
writer.startTAG("Attr"); |
|
|
|
writer.startTAG("Attr"); |
|
|
|
writer.attr("endPoint", getEndPoint()); |
|
|
|
writer.attr("endPoint", getEndPoint()); |
|
|
@ -185,6 +202,7 @@ public class ElasticsearchTableData extends BaseTableData { |
|
|
|
cloned.endPoint = (Conf<String>) endPoint.clone(); |
|
|
|
cloned.endPoint = (Conf<String>) endPoint.clone(); |
|
|
|
cloned.converterType = (Conf<Integer>) converterType.clone(); |
|
|
|
cloned.converterType = (Conf<Integer>) converterType.clone(); |
|
|
|
cloned.query = (Conf<String>) query.clone(); |
|
|
|
cloned.query = (Conf<String>) query.clone(); |
|
|
|
|
|
|
|
cloned.queryType = (Conf<String>) queryType.clone(); |
|
|
|
cloned.script = (Conf<String>) script.clone(); |
|
|
|
cloned.script = (Conf<String>) script.clone(); |
|
|
|
return cloned; |
|
|
|
return cloned; |
|
|
|
} |
|
|
|
} |
|
|
|