Search in sources :

Example 1 with ObjectNode

use of org.codehaus.jackson.node.ObjectNode in project pinot by linkedin.

the class DatasetConfigResource method viewDatsetConfig.

@GET
@Path("/list")
@Produces(MediaType.APPLICATION_JSON)
public String viewDatsetConfig(@DefaultValue("0") @QueryParam("jtStartIndex") int jtStartIndex, @DefaultValue("100") @QueryParam("jtPageSize") int jtPageSize) {
    List<DatasetConfigDTO> datasetConfigDTOs = datasetConfigDao.findAll();
    List<DatasetConfigDTO> subList = Utils.sublist(datasetConfigDTOs, jtStartIndex, jtPageSize);
    ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(subList);
    return rootNode.toString();
}
Also used : DatasetConfigDTO(com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO) ObjectNode(org.codehaus.jackson.node.ObjectNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with ObjectNode

use of org.codehaus.jackson.node.ObjectNode in project pinot by linkedin.

the class JobResource method listTasksForJob.

@GET
@Path("/listTasksForJob")
@Produces(MediaType.APPLICATION_JSON)
public String listTasksForJob(@NotNull @QueryParam("jobId") long jobId) {
    Map<String, Object> filters = new HashMap<>();
    filters.put("jobId", jobId);
    List<TaskDTO> taskDTOs = taskDao.findByParams(filters);
    ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(taskDTOs);
    return rootNode.toString();
}
Also used : ObjectNode(org.codehaus.jackson.node.ObjectNode) HashMap(java.util.HashMap) TaskDTO(com.linkedin.thirdeye.datalayer.dto.TaskDTO) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 3 with ObjectNode

use of org.codehaus.jackson.node.ObjectNode in project pinot by linkedin.

the class JobResource method listJobsForDataset.

@GET
@Path("/listJobsForDataset")
@Produces(MediaType.APPLICATION_JSON)
public String listJobsForDataset(@NotNull @QueryParam("dataset") String dataset, @DefaultValue("0") @QueryParam("jtStartIndex") int jtStartIndex, @DefaultValue("10") @QueryParam("jtPageSize") int jtPageSize) {
    //    Map<String, Object> filters = new HashMap<>();
    //    filters.put("dataset", dataset);
    //    List<JobDTO> jobDTOs = jobDao.findByParams(filters);
    //TODO: we don't have enough info to find jobs for a dataset, may be we should change this to functions?
    List<JobDTO> jobDTOs = Collections.emptyList();
    ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(jobDTOs);
    return rootNode.toString();
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) ObjectNode(org.codehaus.jackson.node.ObjectNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 4 with ObjectNode

use of org.codehaus.jackson.node.ObjectNode in project pinot by linkedin.

the class JobResource method listRecentJobs.

@GET
@Path("/listRecentJobs")
@Produces(MediaType.APPLICATION_JSON)
public String listRecentJobs(@DefaultValue("0") @QueryParam("jtStartIndex") int jtStartIndex, @DefaultValue("10") @QueryParam("jtPageSize") int jtPageSize) {
    List<JobDTO> jobDTOs = jobDao.findNRecentJobs(jtStartIndex + jtPageSize);
    List<JobDTO> subList = Utils.sublist(jobDTOs, jtStartIndex, jtPageSize);
    ObjectNode rootNode = JsonResponseUtil.buildResponseJSON(subList);
    return rootNode.toString();
}
Also used : JobDTO(com.linkedin.thirdeye.datalayer.dto.JobDTO) ObjectNode(org.codehaus.jackson.node.ObjectNode) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 5 with ObjectNode

use of org.codehaus.jackson.node.ObjectNode in project pinot by linkedin.

the class JsonResponseUtil method buildSuccessResponseJSON.

public static ObjectNode buildSuccessResponseJSON(String message) {
    ObjectNode rootNode = MAPPER.getNodeFactory().objectNode();
    rootNode.put("Result", "OK");
    rootNode.put("Message", message);
    return rootNode;
}
Also used : ObjectNode(org.codehaus.jackson.node.ObjectNode)

Aggregations

ObjectNode (org.codehaus.jackson.node.ObjectNode)96 ArrayNode (org.codehaus.jackson.node.ArrayNode)29 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)28 JsonNode (org.codehaus.jackson.JsonNode)22 GET (javax.ws.rs.GET)21 Path (javax.ws.rs.Path)18 Test (org.junit.Test)16 Produces (javax.ws.rs.Produces)12 Map (java.util.Map)11 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)9 IOException (java.io.IOException)7 StringWriter (java.io.StringWriter)5 JsonFactory (org.codehaus.jackson.JsonFactory)5 HelixDataAccessor (org.apache.helix.HelixDataAccessor)4 Span (org.apache.stanbol.enhancer.nlp.model.Span)4 DatasetImpl (org.eol.globi.service.DatasetImpl)4 Date (java.util.Date)3 TaskDriver (org.apache.helix.task.TaskDriver)3 WorkflowConfig (org.apache.helix.task.WorkflowConfig)3