use of com.webank.wedatasphere.qualitis.rule.request.AlarmConfigRequest in project Qualitis by WeBankFinTech.
the class RuleBatchServiceImpl method getAlarmConfig.
private void getAlarmConfig(List<AlarmConfigRequest> alarmConfigRequests, ExcelTemplateRuleByProject excelTemplateRule, Template template, String localeStr) throws UnExpectedRequestException {
String templateOutputName = excelTemplateRule.getAlarmCheckName();
if (!StringUtils.isBlank(templateOutputName)) {
String checkTemplateName = excelTemplateRule.getCheckTemplateName();
String compareTypeName = excelTemplateRule.getCompareType();
String threshold = excelTemplateRule.getThreshold();
TemplateOutputMeta templateOutputMeta = findTemplateOutputMetaByTemplateAndOutputName(template, templateOutputName);
if (templateOutputMeta == null) {
throw new UnExpectedRequestException("{&TEMPLATE_OUTPUT_NAME} {&DOES_NOT_EXIST}");
}
AlarmConfigRequest alarmConfigRequest = new AlarmConfigRequest();
alarmConfigRequest.setCheckTemplate(CheckTemplateEnum.getCheckTemplateCode(checkTemplateName, localeStr));
alarmConfigRequest.setCompareType(CompareTypeEnum.getCompareTypeCode(compareTypeName));
alarmConfigRequest.setThreshold(Double.valueOf(threshold));
alarmConfigRequest.setOutputMetaId(templateOutputMeta.getId());
// Rule Metric.
String ruleMetricEnCode = excelTemplateRule.getRuleMetricEnCode();
if (StringUtils.isNotBlank(ruleMetricEnCode)) {
// xx_xx_xx_encode, index is 3.
RuleMetric ruleMetricInDb = ruleMetricDao.findByEnCode(ruleMetricEnCode);
if (ruleMetricInDb == null) {
throw new UnExpectedRequestException("Rule metric[Code=" + ruleMetricEnCode + "] " + "{&DOES_NOT_EXIST}");
}
String code = ruleMetricInDb.getEnCode();
alarmConfigRequest.setRuleMetricEnCode(code);
}
alarmConfigRequest.setUploadRuleMetricValue(excelTemplateRule.getUploadRuleMetricValue());
alarmConfigRequest.setUploadAbnormalValue(excelTemplateRule.getUploadAbnormalValue());
alarmConfigRequests.add(alarmConfigRequest);
}
}
use of com.webank.wedatasphere.qualitis.rule.request.AlarmConfigRequest in project Qualitis by WeBankFinTech.
the class AddMultiRuleRequestBuilder method initAlarm.
private void initAlarm(List<AlarmConfigRequest> alarmVariable, boolean uploadRuleMetricValue, boolean uploadAbnormalValue) {
if (this.getTemplate().getSaveMidTable()) {
addMultiSourceRuleRequest.setAlarm(true);
AlarmConfigRequest alarmConfigRequest = new AlarmConfigRequest();
alarmConfigRequest.setUploadRuleMetricValue(uploadRuleMetricValue);
alarmConfigRequest.setUploadAbnormalValue(uploadAbnormalValue);
alarmConfigRequest.setOutputMetaId(template.getTemplateOutputMetas().iterator().next().getId());
alarmConfigRequest.setCheckTemplate(CheckTemplateEnum.FIXED_VALUE.getCode());
alarmConfigRequest.setCompareType(CompareTypeEnum.EQUAL.getCode());
alarmConfigRequest.setThreshold(0.0);
alarmVariable.add(alarmConfigRequest);
} else {
addMultiSourceRuleRequest.setAlarm(false);
}
setUploadAbnormalValue(uploadAbnormalValue);
setUploadRuleMetricValue(uploadRuleMetricValue);
addMultiSourceRuleRequest.setAlarmVariable(alarmVariable);
}
use of com.webank.wedatasphere.qualitis.rule.request.AlarmConfigRequest in project Qualitis by WeBankFinTech.
the class AddRuleRequestBuilder method initAlarm.
private void initAlarm(List<AlarmConfigRequest> alarmVariable, boolean uploadRuleMetricValue, boolean uploadAbnormalValue) {
addRuleRequest.setAlarm(true);
AlarmConfigRequest alarmConfigRequest = new AlarmConfigRequest();
alarmConfigRequest.setUploadRuleMetricValue(uploadRuleMetricValue);
alarmConfigRequest.setUploadAbnormalValue(uploadAbnormalValue);
alarmConfigRequest.setOutputMetaId(template.getTemplateOutputMetas().iterator().next().getId());
alarmConfigRequest.setCheckTemplate(CheckTemplateEnum.FIXED_VALUE.getCode());
alarmConfigRequest.setCompareType(CompareTypeEnum.EQUAL.getCode());
alarmConfigRequest.setThreshold(0.0);
alarmVariable.add(alarmConfigRequest);
setUploadRuleMetricValue(uploadRuleMetricValue);
setUploadAbnormalValue(uploadAbnormalValue);
addRuleRequest.setAlarmVariable(alarmVariable);
}
use of com.webank.wedatasphere.qualitis.rule.request.AlarmConfigRequest in project Qualitis by WeBankFinTech.
the class AddRuleRequestBuilder method commonAlarmSetting.
public AlarmConfigRequest commonAlarmSetting(Integer checkTemplateEnum, Integer compareType, double value) {
AlarmConfigRequest newAlarmConfigRequest = new AlarmConfigRequest();
newAlarmConfigRequest.setUploadAbnormalValue(getUploadAbnormalValue());
newAlarmConfigRequest.setUploadRuleMetricValue(getUploadRuleMetricValue());
newAlarmConfigRequest.setOutputMetaId(template.getTemplateOutputMetas().iterator().next().getId());
newAlarmConfigRequest.setRuleMetricEnCode(getRuleMetricEnCode());
newAlarmConfigRequest.setThreshold(value);
switch(checkTemplateEnum) {
case 1:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.MONTH_FLUCTUATION.getCode());
break;
case 2:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.WEEK_FLUCTUATION.getCode());
break;
case 3:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.DAY_FLUCTUATION.getCode());
break;
case 4:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.FIXED_VALUE.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 5:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.FULL_YEAR_RING_GROWTH.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 6:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.HALF_YEAR_GROWTH.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 7:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.SEASON_RING_GROWTH.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 8:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.MONTH_RING_GROWTH.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 9:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.WEEK_RING_GROWTH.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 10:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.DAY_RING_GROWTH.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 11:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.HOUR_RING_GROWTH.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 12:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.YEAR_ON_YEAR.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
default:
addRuleRequest.setAlarm(false);
LOGGER.info("");
}
return newAlarmConfigRequest;
}
use of com.webank.wedatasphere.qualitis.rule.request.AlarmConfigRequest in project Qualitis by WeBankFinTech.
the class AddRuleRequestBuilder method commonAlarmSetting.
public AlarmConfigRequest commonAlarmSetting(Integer checkTemplateEnum, Integer compareType, String value) {
AlarmConfigRequest newAlarmConfigRequest = new AlarmConfigRequest();
newAlarmConfigRequest.setUploadAbnormalValue(getUploadAbnormalValue());
newAlarmConfigRequest.setUploadRuleMetricValue(getUploadRuleMetricValue());
newAlarmConfigRequest.setOutputMetaId(template.getTemplateOutputMetas().iterator().next().getId());
newAlarmConfigRequest.setRuleMetricEnCode(getRuleMetricEnCode());
newAlarmConfigRequest.setThreshold(Double.parseDouble(value));
switch(checkTemplateEnum) {
case 1:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.MONTH_FLUCTUATION.getCode());
break;
case 2:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.WEEK_FLUCTUATION.getCode());
break;
case 3:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.DAY_FLUCTUATION.getCode());
break;
case 4:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.FIXED_VALUE.getCode());
newAlarmConfigRequest.setCompareType(compareType);
break;
case 5:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.FULL_YEAR_RING_GROWTH.getCode());
break;
case 6:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.HALF_YEAR_GROWTH.getCode());
break;
case 7:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.SEASON_RING_GROWTH.getCode());
break;
case 8:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.MONTH_RING_GROWTH.getCode());
break;
case 9:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.WEEK_RING_GROWTH.getCode());
break;
case 10:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.DAY_RING_GROWTH.getCode());
break;
case 11:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.HOUR_RING_GROWTH.getCode());
break;
case 12:
newAlarmConfigRequest.setCheckTemplate(CheckTemplateEnum.YEAR_ON_YEAR.getCode());
break;
default:
addRuleRequest.setAlarm(false);
LOGGER.info("");
}
return newAlarmConfigRequest;
}
Aggregations