use of com.cognizant.devops.platformdal.assessmentreport.ReportConfigDAL in project Insights by CognizantOneDevOps.
the class ReportKPISubscriber method extractKPIAndContentRetryList.
private void extractKPIAndContentRetryList(JsonObject incomingTaskMessage, List<InsightsKPIConfig> kpiConfigList, List<Integer> contentList) {
ReportConfigDAL reportConfigDAL = new ReportConfigDAL();
InsightsWorkflowExecutionHistory historyConfig = workflowDAL.getWorkflowExecutionHistoryByHistoryId(incomingTaskMessage.get("exectionHistoryId").getAsInt());
JsonObject statusLog = new Gson().fromJson(historyConfig.getStatusLog(), JsonObject.class);
log.debug(" Worlflow Detail ==== extractKPIAndContentRetryList statusLog {}", statusLog);
if (statusLog != null) {
Type type = new TypeToken<List<Integer>>() {
}.getType();
Gson gson = new Gson();
List<Integer> kpiList = gson.fromJson(statusLog.get("kpiList"), type);
if (!kpiList.isEmpty()) {
kpiConfigList.addAll(reportConfigDAL.getActiveKPIConfigurationsBasedOnKPIId(kpiList));
}
contentList.addAll(gson.fromJson(statusLog.get(AssessmentReportAndWorkflowConstants.CONTENT_ARRAY), type));
} else {
log.error("Worlflow Detail ==== ReportKPISubscriber unable to parse retry message ", statusLog);
}
}
use of com.cognizant.devops.platformdal.assessmentreport.ReportConfigDAL in project Insights by CognizantOneDevOps.
the class KPIExecutor method call.
@Override
public JsonObject call() throws Exception {
JsonObject response = new JsonObject();
JsonArray failedjobs = new JsonArray();
int kpiId = ReportEngineEnum.StatusCode.ERROR.getValue();
long startTime = System.nanoTime();
try {
kpiId = executeKPIJob(_kpiConfigDTO);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", _kpiConfigDTO.getExecutionId(), _kpiConfigDTO.getWorkflowId(), _kpiConfigDTO.getReportId(), "-", _kpiConfigDTO.getKpiId(), _kpiConfigDTO.getCategory(), 0, "usecasename: " + _kpiConfigDTO.getUsecaseName() + "schedule: " + _kpiConfigDTO.getSchedule());
} catch (InsightsJobFailedException e) {
response.addProperty(STATUS, "Failure");
failedjobs.add(_kpiConfigDTO.getKpiId());
response.add("kpiArray", failedjobs);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", _kpiConfigDTO.getExecutionId(), _kpiConfigDTO.getWorkflowId(), _kpiConfigDTO.getReportId(), "-", _kpiConfigDTO.getKpiId(), _kpiConfigDTO.getCategory(), 0, "usecasename: " + _kpiConfigDTO.getUsecaseName() + "schedule: " + _kpiConfigDTO.getSchedule());
}
if (kpiId != ReportEngineEnum.StatusCode.ERROR.getValue()) {
ReportConfigDAL reportConfigAL = new ReportConfigDAL();
List<InsightsContentConfig> contentConfigList = reportConfigAL.getActiveContentConfigByKPIId(_kpiConfigDTO.getKpiId());
if (!contentConfigList.isEmpty()) {
/* Execute content on the same thread */
failedjobs = ContentExecutor.executeContentJob(contentConfigList, _kpiConfigDTO);
}
/* If none of the kpi or content is failed then simply return Status as success */
if (failedjobs.size() > 0) {
response.addProperty(STATUS, "Failure");
response.add("contentArray", failedjobs);
} else {
response.addProperty(STATUS, "Success");
}
long processingTime = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime);
log.debug("Type=TaskExecution executionId={} workflowId={} ConfigId={} WorkflowType={} KpiId={} Category={} ProcessingTime={} message={}", _kpiConfigDTO.getExecutionId(), _kpiConfigDTO.getWorkflowId(), _kpiConfigDTO.getReportId(), "-", _kpiConfigDTO.getKpiId(), _kpiConfigDTO.getCategory(), processingTime, "usecasename: " + _kpiConfigDTO.getUsecaseName() + " schedule: " + _kpiConfigDTO.getSchedule());
}
return response;
}
Aggregations