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.
46 lines
1.9 KiB
46 lines
1.9 KiB
3 years ago
|
package com.fr.plugin.dingding.webhook;
|
||
|
|
||
|
import com.fr.intelli.record.Focus;
|
||
|
import com.fr.intelli.record.Original;
|
||
|
import com.fr.plugin.context.PluginContext;
|
||
|
import com.fr.plugin.context.PluginContexts;
|
||
|
import com.fr.plugin.dingding.webhook.entity.OutputWebHook;
|
||
|
import com.fr.plugin.dingding.webhook.entity.WebHookEntity;
|
||
|
import com.fr.plugin.dingding.webhook.format.PNGOutputFormat;
|
||
|
import com.fr.plugin.dingding.webhook.handle.WebHookHandle;
|
||
|
import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor;
|
||
|
import com.fr.schedule.extension.report.job.output.BaseOutputFormat;
|
||
|
import com.fr.schedule.feature.ScheduleOutputActionEntityRegister;
|
||
|
import com.fr.schedule.feature.output.OutputActionHandler;
|
||
|
import com.fr.stable.fun.Authorize;
|
||
|
|
||
|
/**
|
||
|
* @Author fr.open
|
||
|
* @Date 2020/9/15
|
||
|
* @Description
|
||
|
**/
|
||
|
@Authorize(callSignKey = PluginConstants.PLUGIN_ID)
|
||
|
public class OutputPluginLifecycleMonitor extends AbstractPluginLifecycleMonitor {
|
||
|
@Override
|
||
|
@Focus(id = PluginConstants.PLUGIN_ID, text = "钉钉webhook", source = Original.PLUGIN)
|
||
|
public void afterRun(PluginContext pluginContext) {
|
||
|
if (!PluginContexts.currentContext().isAvailable()) {
|
||
|
return;
|
||
|
}
|
||
|
BaseOutputFormat.registerOutputFormat(new PNGOutputFormat());
|
||
|
OutputActionHandler.registerHandler(new WebHookHandle(), OutputWebHook.class.getName());
|
||
|
ScheduleOutputActionEntityRegister.getInstance().addClass(WebHookEntity.class);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
@Focus(id = PluginConstants.PLUGIN_ID, text = "钉钉webhook", source = Original.PLUGIN)
|
||
|
public void beforeStop(PluginContext pluginContext) {
|
||
|
if (!PluginContexts.currentContext().isAvailable()) {
|
||
|
return;
|
||
|
}
|
||
|
BaseOutputFormat.removeOutputFormat(PNGOutputFormat.CONVERT_TO_PNG);
|
||
|
OutputActionHandler.removeOutputHandler(OutputWebHook.class.getName());
|
||
|
ScheduleOutputActionEntityRegister.getInstance().removeClass(WebHookEntity.class);
|
||
|
}
|
||
|
}
|