Search in sources :

Example 1 with IngraphDashboardConfigDTO

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();
    }
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 2 with IngraphDashboardConfigDTO

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;
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) IngraphDashboardConfigBean(com.linkedin.thirdeye.datalayer.pojo.IngraphDashboardConfigBean) Predicate(com.linkedin.thirdeye.datalayer.util.Predicate)

Example 3 with IngraphDashboardConfigDTO

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);
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) Test(org.testng.annotations.Test)

Example 4 with IngraphDashboardConfigDTO

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());
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) Test(org.testng.annotations.Test)

Example 5 with IngraphDashboardConfigDTO

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);
}
Also used : IngraphDashboardConfigDTO(com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO) Test(org.testng.annotations.Test)

Aggregations

IngraphDashboardConfigDTO (com.linkedin.thirdeye.datalayer.dto.IngraphDashboardConfigDTO)9 Test (org.testng.annotations.Test)4 GET (javax.ws.rs.GET)3 Path (javax.ws.rs.Path)3 IngraphDashboardConfigBean (com.linkedin.thirdeye.datalayer.pojo.IngraphDashboardConfigBean)1 Predicate (com.linkedin.thirdeye.datalayer.util.Predicate)1 Produces (javax.ws.rs.Produces)1 ObjectNode (org.codehaus.jackson.node.ObjectNode)1 DateTime (org.joda.time.DateTime)1