use of com.webank.wedatasphere.qualitis.project.excel.ExcelCustomRuleByProject in project Qualitis by WeBankFinTech.
the class RuleBatchServiceImpl method getCustomRule.
@Override
public List<ExcelCustomRuleByProject> getCustomRule(Iterable<Rule> rules, String localeStr) {
List<ExcelCustomRuleByProject> lines = new ArrayList<>();
for (Rule rule : rules) {
if (!rule.getRuleType().equals(RuleTypeEnum.CUSTOM_RULE.getCode())) {
continue;
}
ExcelCustomRuleByProject ruleLinePrefix = new ExcelCustomRuleByProject();
basicInfoToExcel(ruleLinePrefix, rule);
lines.add(ruleLinePrefix);
for (AlarmConfig alarmConfig : rule.getAlarmConfigs()) {
Double threshold = alarmConfig.getThreshold();
String alarmOutputName = alarmConfig.getTemplateOutputMeta().getOutputName();
String alarmCompareType = CompareTypeEnum.getCompareTypeName(alarmConfig.getCompareType());
String checkTemplateName = CheckTemplateEnum.getCheckTemplateName(alarmConfig.getCheckTemplate(), localeStr);
ExcelCustomRuleByProject tmp = new ExcelCustomRuleByProject(rule.getName());
tmp.setCompareType(alarmCompareType);
tmp.setAlarmCheckName(alarmOutputName);
tmp.setThreshold(String.valueOf(threshold));
tmp.setCheckTemplateName(checkTemplateName);
RuleMetric ruleMetric = alarmConfig.getRuleMetric();
// Recod rule metric info (unique code).
if (ruleMetric != null) {
String enCode = ruleMetric.getEnCode();
tmp.setRuleMetricEnCode(enCode);
tmp.setRuleMetricName(ruleMetric.getName());
}
tmp.setUploadRuleMetricValue(alarmConfig.getUploadRuleMetricValue());
tmp.setUploadAbnormalValue(alarmConfig.getUploadAbnormalValue());
lines.add(tmp);
}
}
return lines;
}
use of com.webank.wedatasphere.qualitis.project.excel.ExcelCustomRuleByProject in project Qualitis by WeBankFinTech.
the class ExcelRuleListener method invoke.
@Override
public void invoke(Object object, AnalysisContext context) {
if (context.getCurrentSheet().getSheetName().equals(ExcelSheetName.TEMPLATE_RULE_NAME)) {
ExcelTemplateRuleByProject excelTemplateRuleByProject = (ExcelTemplateRuleByProject) object;
String key = excelTemplateRuleByProject.getRuleName();
if (templateExcelContent.containsKey(key)) {
templateExcelContent.get(key).add(excelTemplateRuleByProject);
} else {
List<ExcelTemplateRuleByProject> tmp = new ArrayList<>();
tmp.add(excelTemplateRuleByProject);
templateExcelContent.put(key, tmp);
}
} else if (context.getCurrentSheet().getSheetName().equals(ExcelSheetName.CUSTOM_RULE_NAME)) {
ExcelCustomRuleByProject excelCustomRule = (ExcelCustomRuleByProject) object;
String key = excelCustomRule.getRuleName();
if (customExcelContent.containsKey(key)) {
customExcelContent.get(key).add(excelCustomRule);
} else {
List<ExcelCustomRuleByProject> tmp = new ArrayList<>();
tmp.add(excelCustomRule);
customExcelContent.put(key, tmp);
}
} else if (context.getCurrentSheet().getSheetName().equals(ExcelSheetName.MULTI_TEMPLATE_RULE_NAME)) {
ExcelMultiTemplateRuleByProject excelMultiTemplateRule = (ExcelMultiTemplateRuleByProject) object;
String key = excelMultiTemplateRule.getRuleName();
if (multiTemplateExcelContent.containsKey(key)) {
multiTemplateExcelContent.get(key).add(excelMultiTemplateRule);
} else {
List<ExcelMultiTemplateRuleByProject> tmp = new ArrayList<>();
tmp.add(excelMultiTemplateRule);
multiTemplateExcelContent.put(key, tmp);
}
} else if (context.getCurrentSheet().getSheetName().equals(ExcelSheetName.TEMPLATE_FILE_RULE_NAME)) {
ExcelTemplateFileRuleByProject excelTemplateFileRule = (ExcelTemplateFileRuleByProject) object;
String key = excelTemplateFileRule.getRuleName();
if (templateFileExcelContent.containsKey(key)) {
templateFileExcelContent.get(key).add(excelTemplateFileRule);
} else {
List<ExcelTemplateFileRuleByProject> tmp = new ArrayList<>();
tmp.add(excelTemplateFileRule);
templateFileExcelContent.put(key, tmp);
}
}
}
Aggregations