diff --git a/src/main/java/gov/nih/nci/bento/model/PrivateESDataFetcher.java b/src/main/java/gov/nih/nci/bento/model/PrivateESDataFetcher.java index b75805d36..bec77e7c8 100644 --- a/src/main/java/gov/nih/nci/bento/model/PrivateESDataFetcher.java +++ b/src/main/java/gov/nih/nci/bento/model/PrivateESDataFetcher.java @@ -349,7 +349,8 @@ private List> fileOverview(Map params) throw new String[]{"file_description", "file_description"}, new String[]{"file_format", "file_format"}, new String[]{"file_size", "file_size"}, - new String[]{"diagnosis", "diagnoses"} + new String[]{"diagnosis", "diagnoses"}, + new String[]{"acl", "acl"} }; String defaultSort = "file_name"; // Default sort order @@ -365,10 +366,24 @@ private List> fileOverview(Map params) throw Map.entry("file_description", "file_description"), Map.entry("file_format", "file_format"), Map.entry("file_size", "file_size"), - Map.entry("diagnosis", "diagnoses") + Map.entry("diagnosis", "diagnoses"), + Map.entry("acl", "acl") ); - return overview(FILES_END_POINT, params, PROPERTIES, defaultSort, mapping); + List> result = overview(FILES_END_POINT, params, PROPERTIES, defaultSort, mapping); + final String ACL_KEY = "acl"; + try{ + for(Map resultElement: result){ + String acl = (String) resultElement.get(ACL_KEY); + String[] acls = acl.replaceAll("\\]|\\[|'|\"", "").split(","); + resultElement.put(ACL_KEY, acls); + } + } + catch(ClassCastException | NullPointerException ex){ + logger.error("Error occurred when splitting acl into String array"); + } + + return result; } private List> overview(String endpoint, Map params, String[][] properties, String defaultSort, Map mapping) throws IOException { diff --git a/src/main/resources/graphql/bento-private-es-schema.graphql b/src/main/resources/graphql/bento-private-es-schema.graphql index 91989e6c5..79cf54106 100644 --- a/src/main/resources/graphql/bento-private-es-schema.graphql +++ b/src/main/resources/graphql/bento-private-es-schema.graphql @@ -63,6 +63,7 @@ type FileOverview2 { file_format: String file_size: Float diagnosis: String + acl: [String] } type SearchResult { diff --git a/src/main/resources/yaml/es_indices_bento.yml b/src/main/resources/yaml/es_indices_bento.yml index a24ed8a7b..9dcf1df46 100644 --- a/src/main/resources/yaml/es_indices_bento.yml +++ b/src/main/resources/yaml/es_indices_bento.yml @@ -304,7 +304,8 @@ Indices: type: keyword age_at_index: type: integer - + acl: + type: keyword # Cypher query will be used to retrieve data from Neo4j, and index into Elasticsearch cypher_query: " MATCH (ss:study_subject)<-[*..2]-(parent)<--(f:file) @@ -329,6 +330,7 @@ Indices: f.file_format AS file_format_gs, f.file_size AS file_size, f.md5sum AS md5sum, + f.acl AS acl, toInteger(split(f.file_id,'-')[2]) AS file_id_num, ss.disease_subtype AS diagnoses, sf.grouped_recurrence_score AS rc_scores,