use of com.cognizant.devops.platformdal.outcome.InsightsOutcomeTools in project Insights by CognizantOneDevOps.
the class OutComeServiceImpl method getAllActiveOutcome.
@Override
public JsonArray getAllActiveOutcome() throws InsightsCustomException {
try {
List<InsightsOutcomeTools> configs = outComeConfigDAL.getAllActiveOutcome();
Gson gson = new Gson();
JsonElement element = gson.toJsonTree(configs, new TypeToken<List<InsightsOutcomeTools>>() {
}.getType());
if (!element.isJsonArray()) {
throw new InsightsCustomException("Unable to parse Json");
}
return element.getAsJsonArray();
} catch (Exception e) {
log.error("Error getting outcome list ..", e);
throw new InsightsCustomException(e.getMessage());
}
}
use of com.cognizant.devops.platformdal.outcome.InsightsOutcomeTools in project Insights by CognizantOneDevOps.
the class OutComeServiceImpl method updateOutcomeConfig.
@Override
public void updateOutcomeConfig(JsonObject configJson) throws InsightsCustomException {
try {
int outcomeId = configJson.get("id").getAsInt();
InsightsOutcomeTools insightsOutcomeTools = outComeConfigDAL.getOutcomeConfig(outcomeId);
insightsOutcomeTools.setOutcomeName(configJson.get("outcomeName").getAsString());
insightsOutcomeTools.setOutcomeType(configJson.get("outcomeType").getAsString());
if (configJson.has("toolConfigJson")) {
insightsOutcomeTools.setConfigJson(configJson.get("toolConfigJson").getAsJsonObject().toString());
}
insightsOutcomeTools.setIsActive(configJson.get("isActive").getAsBoolean());
// insightsOutcomeTools.setCreatedDate(configJson.get("createdDate").getAsLong());
insightsOutcomeTools.setMetricUrl(configJson.get("metricUrl").getAsString());
insightsOutcomeTools.setUpdatedDate(InsightsUtils.getCurrentTimeInEpochMilliSeconds());
insightsOutcomeTools.setRequestParameters(configJson.get("parameters").toString());
outComeConfigDAL.updateOutcomeConfig(insightsOutcomeTools);
} catch (Exception e) {
log.error(e);
throw new InsightsCustomException(" Error while updating record " + e.getMessage());
}
}
use of com.cognizant.devops.platformdal.outcome.InsightsOutcomeTools in project Insights by CognizantOneDevOps.
the class OutComeServiceImpl method updateOutcomeConfigStatus.
@Override
public void updateOutcomeConfigStatus(JsonObject configJson) throws InsightsCustomException {
try {
int outcomeId = configJson.get("id").getAsInt();
InsightsOutcomeTools insightsOutcomeTools = outComeConfigDAL.getOutcomeConfig(outcomeId);
insightsOutcomeTools.setIsActive(configJson.get("isActive").getAsBoolean());
outComeConfigDAL.updateOutcomeConfig(insightsOutcomeTools);
} catch (Exception e) {
log.error(e);
throw new InsightsCustomException(" Error while updating outcome status " + e.getMessage());
}
}
use of com.cognizant.devops.platformdal.outcome.InsightsOutcomeTools in project Insights by CognizantOneDevOps.
the class OutComeServiceImpl method saveOutcomeConfig.
@Override
public int saveOutcomeConfig(JsonObject configJson) throws InsightsCustomException {
String outcomeName = configJson.get("outcomeName").getAsString();
InsightsOutcomeTools outcomeConfig = outComeConfigDAL.getOutComeConfigByName(outcomeName);
if (outcomeConfig != null) {
throw new InsightsCustomException("Outcome with given name already exists.");
}
InsightsOutcomeTools insightsOutcomeTools = new InsightsOutcomeTools();
insightsOutcomeTools.setOutcomeName(outcomeName);
insightsOutcomeTools.setOutcomeType(configJson.get("outcomeType").getAsString());
if (configJson.has("toolConfigJson")) {
insightsOutcomeTools.setConfigJson(configJson.get("toolConfigJson").getAsJsonObject().toString());
}
insightsOutcomeTools.setIsActive(configJson.get(CommonsAndDALConstants.ISACTIVE).getAsBoolean());
insightsOutcomeTools.setMetricUrl(configJson.get("metricUrl").getAsString());
InsightsTools insightsMilestoneTools = outComeConfigDAL.getOutComeByToolId(configJson.get("toolName").getAsInt());
insightsOutcomeTools.setInsightsTools(insightsMilestoneTools);
insightsOutcomeTools.setCreatedDate(InsightsUtils.getCurrentTimeInEpochMilliSeconds());
insightsOutcomeTools.setRequestParameters(configJson.get("parameters").getAsJsonArray().toString());
return outComeConfigDAL.saveOutcomeConfig(insightsOutcomeTools);
}
use of com.cognizant.devops.platformdal.outcome.InsightsOutcomeTools in project Insights by CognizantOneDevOps.
the class MileStoneServiceImpl method fetchOutcomeConfig.
@Override
public JsonArray fetchOutcomeConfig() throws InsightsCustomException {
try {
List<InsightsOutcomeTools> configs = mileStoneConfigDAL.getOutcomeConfigTools();
Gson gson = new Gson();
JsonElement element = gson.toJsonTree(configs, new TypeToken<List<InsightsOutcomeTools>>() {
}.getType());
if (!element.isJsonArray()) {
throw new InsightsCustomException("Unable to parse Json");
}
return element.getAsJsonArray();
} catch (Exception e) {
log.error("Error getting milestone list ..", e);
throw new InsightsCustomException(e.getMessage());
}
}
Aggregations