use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.
the class IngraphDashboardConfigResource method updateDashboardConfig.
@GET
@Path("/update")
public String updateDashboardConfig(@NotNull @QueryParam("id") long ingraphDashboardConfigId, @QueryParam("name") String name, @QueryParam("fabricGroup") String fabricGroup, @QueryParam("active") boolean active, @QueryParam("bootstrap") boolean bootstrap, @QueryParam("fromIngraphDashboard") boolean fromIngraphDashboard, @QueryParam("startTime") String bootstrapStartTime, @QueryParam("endTime") String bootstrapEndTime, @QueryParam("fetchIntervalPeriod") String fetchIntervalPeriod, @QueryParam("mergeNumAvroRecords") String mergeNumAvroRecords, @QueryParam("granularitySize") String granularitySize, @QueryParam("granularityUnit") String granularityUnit) {
try {
IngraphDashboardConfigDTO ingraphDashboardConfigDTO = ingraphDashboardConfigDAO.findById(ingraphDashboardConfigId);
ingraphDashboardConfigDTO.setName(name);
ingraphDashboardConfigDTO.setFabricGroup(fabricGroup);
if (StringUtils.isNotBlank(fetchIntervalPeriod)) {
ingraphDashboardConfigDTO.setFetchIntervalPeriod(Long.valueOf(fetchIntervalPeriod));
}
if (StringUtils.isNotBlank(mergeNumAvroRecords)) {
ingraphDashboardConfigDTO.setMergeNumAvroRecords(Integer.valueOf(mergeNumAvroRecords));
}
if (StringUtils.isNotBlank(granularitySize)) {
ingraphDashboardConfigDTO.setGranularitySize(Integer.valueOf(granularitySize));
}
if (StringUtils.isNotBlank(granularityUnit)) {
ingraphDashboardConfigDTO.setGranularityUnit(TimeUnit.valueOf(granularityUnit));
}
Boolean isActive = Boolean.valueOf(active);
ingraphDashboardConfigDTO.setActive(isActive);
Boolean isFromIngraphDashboard = Boolean.valueOf(fromIngraphDashboard);
ingraphDashboardConfigDTO.setFromIngraphDashboard(isFromIngraphDashboard);
Boolean needBootstrap = Boolean.valueOf(bootstrap);
ingraphDashboardConfigDTO.setBootstrap(needBootstrap);
if (needBootstrap) {
long startTimeInMs = sdf.parse(bootstrapStartTime).getTime();
long endTimeInMs = sdf.parse(bootstrapEndTime).getTime();
ingraphDashboardConfigDTO.setBootstrapStartTime(startTimeInMs);
ingraphDashboardConfigDTO.setBootstrapEndTime(endTimeInMs);
}
int numRowsUpdated = ingraphDashboardConfigDAO.update(ingraphDashboardConfigDTO);
if (numRowsUpdated == 1) {
return JsonResponseUtil.buildResponseJSON(ingraphDashboardConfigDTO).toString();
} else {
return JsonResponseUtil.buildErrorResponseJSON("Failed to update dashboard id:" + ingraphDashboardConfigId).toString();
}
} catch (Exception e) {
return JsonResponseUtil.buildErrorResponseJSON("Failed to update dashboard id:" + ingraphDashboardConfigId + ". Exception:" + e.getMessage()).toString();
}
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.
the class IngraphDashboardConfigManagerImpl method findByName.
@Override
public IngraphDashboardConfigDTO findByName(String name) {
Predicate predicate = Predicate.EQ("name", name);
List<IngraphDashboardConfigBean> list = genericPojoDao.get(predicate, IngraphDashboardConfigBean.class);
IngraphDashboardConfigDTO result = null;
if (CollectionUtils.isNotEmpty(list)) {
result = MODEL_MAPPER.map(list.get(0), IngraphDashboardConfigDTO.class);
}
return result;
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.
the class TestIngraphDatasetConfigManager method testFindIngraphDashboard.
@Test(dependsOnMethods = { "testCreateIngraphDashboard" })
public void testFindIngraphDashboard() {
List<IngraphDashboardConfigDTO> ingraphDashboardConfigDTOs = ingraphDashboardConfigDAO.findAll();
Assert.assertEquals(ingraphDashboardConfigDTOs.size(), 2);
IngraphDashboardConfigDTO ingraphDashboardConfigDTO = ingraphDashboardConfigDAO.findByName(name1);
Assert.assertEquals(ingraphDashboardConfigDTO.getName(), name1);
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.
the class TestIngraphDatasetConfigManager method testUpdateIngraphDashboard.
@Test(dependsOnMethods = { "testFindIngraphDashboard" })
public void testUpdateIngraphDashboard() {
IngraphDashboardConfigDTO ingraphDashboardConfigDTO = ingraphDashboardConfigDAO.findById(ingraphDashboardConfigId1);
Assert.assertNotNull(ingraphDashboardConfigDTO);
Assert.assertTrue(ingraphDashboardConfigDTO.isBootstrap());
ingraphDashboardConfigDTO.setBootstrap(false);
ingraphDashboardConfigDAO.update(ingraphDashboardConfigDTO);
ingraphDashboardConfigDTO = ingraphDashboardConfigDAO.findById(ingraphDashboardConfigId1);
Assert.assertNotNull(ingraphDashboardConfigDTO);
Assert.assertFalse(ingraphDashboardConfigDTO.isBootstrap());
}
use of com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO in project pinot by linkedin.
the class TestIngraphDatasetConfigManager method testCreateIngraphDashboard.
@Test
public void testCreateIngraphDashboard() {
IngraphDashboardConfigDTO ingraphDashboardConfigDTO1 = getTestIngraphDashboardConfig(name1);
ingraphDashboardConfigId1 = ingraphDashboardConfigDAO.save(ingraphDashboardConfigDTO1);
Assert.assertNotNull(ingraphDashboardConfigId1);
IngraphDashboardConfigDTO ingraphDashboardConfigDTO2 = getTestIngraphDashboardConfig(name2);
ingraphDashboardConfigId2 = ingraphDashboardConfigDAO.save(ingraphDashboardConfigDTO2);
Assert.assertNotNull(ingraphDashboardConfigId2);
}
Aggregations