You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.1 KiB
83 lines
2.1 KiB
package com.tptj.demo.hg.submit.provider; |
|
|
|
import com.fr.base.TemplateUtils; |
|
import com.fr.data.AbstractSubmitTask; |
|
import com.fr.intelli.record.Focus; |
|
import com.fr.log.FineLoggerFactory; |
|
import com.fr.record.analyzer.EnableMetrics; |
|
import com.fr.script.Calculator; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.stable.xml.XMLPrintWriter; |
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
/** |
|
* @author 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2021-05-18 |
|
**/ |
|
@EnableMetrics |
|
public class DemoSubmit extends AbstractSubmitTask { |
|
|
|
public static final String Job_Type = "Demo_Submit"; |
|
|
|
private String key; |
|
private String value; |
|
|
|
@Override |
|
public String getJobType() { |
|
return Job_Type; |
|
} |
|
|
|
public String getKey() { |
|
return key; |
|
} |
|
|
|
public void setKey(String key) { |
|
this.key = key; |
|
} |
|
|
|
public String getValue() { |
|
return value; |
|
} |
|
|
|
public void setValue(String value) { |
|
this.value = value; |
|
} |
|
|
|
@Override |
|
@Focus(id="com.tptj.demo.hg.submit.provider.v10",text = "DemoSubmit") |
|
public void doJob(Calculator calculator) throws Exception { |
|
String k_r = TemplateUtils.render(key,calculator); |
|
String v_r = TemplateUtils.render(value,calculator); |
|
FineLoggerFactory.getLogger().info("DemoSubmit => key:{}, value:{}",k_r,v_r); |
|
} |
|
|
|
@Override |
|
public void doFinish(Calculator calculator) throws Exception { |
|
|
|
} |
|
|
|
private static final String XML_TAG = "DemoSubmit"; |
|
|
|
@Override |
|
public void readXML(XMLableReader reader) { |
|
String tag = reader.getTagName(); |
|
if( XML_TAG.equals(tag) ){ |
|
key = reader.getAttrAsString("key", StringUtils.EMPTY); |
|
value = reader.getAttrAsString("value", StringUtils.EMPTY); |
|
} |
|
} |
|
|
|
@Override |
|
public void writeXML(XMLPrintWriter writer) { |
|
writer.startTAG(XML_TAG).attr("key",key).attr("value",value).end(); |
|
} |
|
|
|
@Override |
|
public Object clone() throws CloneNotSupportedException { |
|
DemoSubmit obj = (DemoSubmit) super.clone(); |
|
obj.key = key; |
|
obj.value = value; |
|
return obj; |
|
} |
|
}
|
|
|