/**\r
- * Copyright 2017 ZTE Corporation.\r
+ * Copyright 2017-2022 ZTE Corporation.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
private String content;\r
\r
+ private String creator;\r
+\r
private int enabled;\r
}\r
import java.io.File;
import java.nio.file.Paths;
import java.util.*;
+import java.util.stream.Collectors;
public class ConfigFileScanningTask implements Runnable {
final public static long POLLING_PERIOD = 30L;
final private static Logger LOGGER = LoggerFactory.getLogger(ConfigFileScanningTask.class);
final private static long FILE_SIZE_LMT = 1024 * 1024 * 10; // 10MB
+ final private static String CREATOR = "__SYSTEM__DEFAULT__";
private String configFile = "/opt/hrmrules/index.json";
private ConfigFileScanner configFileScanner;
private String url;
RuleQueryListResponse ruleQueryListResponse = JerseyClient.newInstance().get(url, RuleQueryListResponse.class);
List<RuleResult4API> deployedRules = Collections.EMPTY_LIST;
if (null != ruleQueryListResponse) {
- deployedRules = ruleQueryListResponse.getCorrelationRules();
+ deployedRules = ruleQueryListResponse.getCorrelationRules()
+ .stream().filter(r -> CREATOR.equals(r.getCreator())).collect(Collectors.toList());
}
return deployedRules;
}
ruleCreateRequest.setContent(contents);
ruleCreateRequest.setDescription("");
ruleCreateRequest.setEnabled(1);
+ ruleCreateRequest.setCreator(CREATOR);
return ruleCreateRequest;
}
/**
- * Copyright 2021 ZTE Corporation.
+ * Copyright 2021-2022 ZTE Corporation.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ruleResult4API.setContent(contents);
ruleResult4API.setDescription("");
ruleResult4API.setEnabled(1);
+ ruleResult4API.setCreator("__SYSTEM__DEFAULT__");
return ruleResult4API;
}
}
\ No newline at end of file