Skip to content

Commit

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

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

Expand All @@ -15,11 +15,13 @@ protected QueryRepository() {
super(Query.class);
}

public UUID getQueryUUIDFromCommonAreaUUID(UUID caID) {
public Query 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;
String query = "SELECT * FROM query WHERE CONVERT(metadata USING utf8) LIKE ?";
try {
return (Query) em().createNativeQuery(query, Query.class).setParameter(1, caIDRegex).getSingleResult();
} catch (PersistenceException ignored) {
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public QueryStatus queryCommonAreaMetaData(UUID commonAreaQueryId, HttpHeaders h
*/
public QueryStatus queryMetadata(UUID queryId, HttpHeaders headers) {
Query query = queryRepo.getById(queryId);
query = query == null ? queryRepo.getQueryUUIDFromCommonAreaUUID(queryId) : query;
if (query == null) {
throw new ProtocolException(ProtocolException.QUERY_NOT_FOUND + queryId.toString());
}
Expand Down

0 comments on commit 8605718

Please sign in to comment.