Skip to content

Commit

Permalink
bad
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Feb 7, 2024
1 parent b67777d commit dd5a34c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
import edu.harvard.dbmi.avillach.data.entity.Query;

import javax.enterprise.context.ApplicationScoped;
import javax.persistence.criteria.CriteriaQuery;
import javax.transaction.Transactional;
import java.util.UUID;

@Transactional
@ApplicationScoped
public class QueryRepository extends BaseRepository<Query, UUID>{
public class QueryRepository extends BaseRepository<Query, UUID> {

protected QueryRepository() {super(Query.class);}
protected QueryRepository() {
super(Query.class);
}

public UUID getQueryUUIDFromCommonAreaUUID(UUID caID) {
String caIDRegex = "%" + caID + "%";
String query = "SELECT uuid FROM query WHERE CONVERT(metadata using utf8) LIKE ?;";
// em().getCriteriaBuilder().like(em())
em().createQuery(query).setParameter(0, caIDRegex).getSingleResult();
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.apache.commons.lang3.ObjectUtils;

@OpenAPIDefinition(info = @Info(title = "Pic-sure API", version = "1.0.0", description = "This is the Pic-sure API."))
@Path("/")
Expand Down Expand Up @@ -192,8 +193,10 @@ public Response querySync(
responseCode = "200", description = "Query metadata", content = @Content(schema = @Schema(implementation = QueryStatus.class))
)}
)
public QueryStatus queryMetadata(@PathParam("queryId") UUID queryId, @Context HttpHeaders headers) {
return queryService.queryMetadata(queryId, headers);
public QueryStatus queryMetadata(
@PathParam("queryId") UUID queryId, @QueryParam("checkCommonArea") boolean checkCommonArea, @Context HttpHeaders headers
) {
return checkCommonArea ? queryService.queryCommonAreaMetaData(queryId, headers) : queryService.queryMetadata(queryId, headers);
}

@POST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ public Response querySync(QueryRequest queryRequest, HttpHeaders headers) {
return syncResponse;
}

public QueryStatus queryCommonAreaMetaData(UUID commonAreaQueryId, HttpHeaders headers) {
// queryRepo..createNativeQuery(sql)
return null;
}

/**
* @param queryId The UUID of the query to get metadata about
* @return a QueryStatus object containing the metadata stored about the given query
Expand Down

0 comments on commit dd5a34c

Please sign in to comment.