Skip to content

Commit

Permalink
Merge pull request #343 from aimansharief/ViewTemplateFix
Browse files Browse the repository at this point in the history
Issue #1051: SB-RC: Added Fix for view template in search
  • Loading branch information
pallakartheekreddy authored Aug 13, 2024
2 parents 3100322 + d82f931 commit c377055
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ jobs:
sudo rm -rf /usr/local/.ghcup/ghc/9.6.4
- name: Check space before tests
run: df -h
- name: Install Docker Compose
run: |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
# debug step
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ private JsonNode searchEntity(JsonNode inputJson, ISearchService service, String
ViewTemplate viewTemplate = viewTemplateManager.getViewTemplate(inputJson);
if (viewTemplate != null) {
ViewTransformer vTransformer = new ViewTransformer();
resultNode.set(ENTITY_LIST, vTransformer.transform(viewTemplate, resultNode.get(ENTITY_LIST)));
String entityName = resultNode.fields().next().getKey();
ObjectNode transformerInput = JsonNodeFactory.instance.objectNode().set(entityName, resultNode.get(entityName).get(ENTITY_LIST));
((ObjectNode) resultNode.get(entityName)).set(ENTITY_LIST, vTransformer.transform(viewTemplate, transformerInput).get(entityName));
}
// Search is tricky to support LD. Needs a revisit here.
logger.debug("searchEntity ends");
Expand Down Expand Up @@ -754,7 +756,9 @@ public JsonNode getAuditLog(JsonNode inputJson, String userId) throws Exception
ViewTemplate viewTemplate = viewTemplateManager.getViewTemplate(inputJson);
if (viewTemplate != null) {
ViewTransformer vTransformer = new ViewTransformer();
resultNode.set(ENTITY_LIST, vTransformer.transform(viewTemplate, resultNode.get(ENTITY_LIST)));
String entityName = resultNode.fields().next().getKey();
ObjectNode transformerInput = JsonNodeFactory.instance.objectNode().set(entityName, resultNode.get(entityName).get(ENTITY_LIST));
((ObjectNode) resultNode.get(entityName)).set(ENTITY_LIST, vTransformer.transform(viewTemplate, transformerInput).get(entityName));
}
logger.debug("get audit log ends");

Expand Down

0 comments on commit c377055

Please sign in to comment.