Search in sources :

Example 1 with BaseRequest

use of org.apache.atlas.catalog.BaseRequest in project incubator-atlas by apache.

the class EntityService method getEntity.

@GET
@Path("{entityId}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response getEntity(@Context HttpHeaders headers, @Context UriInfo ui, @PathParam("entityId") String entityId) throws CatalogException {
    AtlasPerfTracer perf = null;
    try {
        if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
            perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityService.getEntity(" + entityId + ")");
        }
        BaseRequest request = new InstanceRequest(Collections.<String, Object>singletonMap("id", entityId));
        Result result = getResource(entityResourceProvider, request);
        return Response.status(Response.Status.OK).entity(getSerializer().serialize(result, ui)).build();
    } finally {
        AtlasPerfTracer.log(perf);
    }
}
Also used : AtlasPerfTracer(org.apache.atlas.utils.AtlasPerfTracer) BaseRequest(org.apache.atlas.catalog.BaseRequest) InstanceRequest(org.apache.atlas.catalog.InstanceRequest) Result(org.apache.atlas.catalog.Result) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with BaseRequest

use of org.apache.atlas.catalog.BaseRequest in project incubator-atlas by apache.

the class EntityService method getEntities.

@GET
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response getEntities(@Context HttpHeaders headers, @Context UriInfo ui) throws CatalogException {
    AtlasPerfTracer perf = null;
    try {
        if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
            perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityService.getEntities()");
        }
        String queryString = decode(getQueryString(ui));
        BaseRequest request = new CollectionRequest(Collections.<String, Object>emptyMap(), queryString);
        Result result = getResources(entityResourceProvider, request);
        return Response.status(Response.Status.OK).entity(getSerializer().serialize(result, ui)).build();
    } finally {
        AtlasPerfTracer.log(perf);
    }
}
Also used : CollectionRequest(org.apache.atlas.catalog.CollectionRequest) AtlasPerfTracer(org.apache.atlas.utils.AtlasPerfTracer) BaseRequest(org.apache.atlas.catalog.BaseRequest) Result(org.apache.atlas.catalog.Result) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 3 with BaseRequest

use of org.apache.atlas.catalog.BaseRequest in project incubator-atlas by apache.

the class EntityService method getEntityTags.

@GET
@Path("{entityId}/tags")
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response getEntityTags(@Context HttpHeaders headers, @Context UriInfo ui, @PathParam("entityId") String entityGuid) throws CatalogException {
    AtlasPerfTracer perf = null;
    try {
        if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
            perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityService.getEntityTags(" + entityGuid + ")");
        }
        BaseRequest request = new CollectionRequest(Collections.<String, Object>singletonMap("id", entityGuid), decode(getQueryString(ui)));
        Result result = getResources(entityTagResourceProvider, request);
        return Response.status(Response.Status.OK).entity(getSerializer().serialize(result, ui)).build();
    } finally {
        AtlasPerfTracer.log(perf);
    }
}
Also used : CollectionRequest(org.apache.atlas.catalog.CollectionRequest) AtlasPerfTracer(org.apache.atlas.utils.AtlasPerfTracer) BaseRequest(org.apache.atlas.catalog.BaseRequest) Result(org.apache.atlas.catalog.Result) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

GET (javax.ws.rs.GET)3 Produces (javax.ws.rs.Produces)3 BaseRequest (org.apache.atlas.catalog.BaseRequest)3 Result (org.apache.atlas.catalog.Result)3 AtlasPerfTracer (org.apache.atlas.utils.AtlasPerfTracer)3 Path (javax.ws.rs.Path)2 CollectionRequest (org.apache.atlas.catalog.CollectionRequest)2 InstanceRequest (org.apache.atlas.catalog.InstanceRequest)1