forked from avniproject/avni-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avniproject#762 | MetabaseJoin And MetabaseQuery created
- Loading branch information
1 parent
b9dc476
commit 6df633a
Showing
5 changed files
with
73 additions
and
26 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
avni-server-api/src/main/java/org/avni/server/domain/metabase/MetabaseJoin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.avni.server.domain.metabase; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
|
||
public class MetabaseJoin { | ||
private final String fields; | ||
private final String alias; | ||
private final int sourceTable; | ||
private final JsonNode condition; | ||
|
||
public MetabaseJoin(String fields, String alias, int sourceTable, JsonNode condition) { | ||
this.fields = fields; | ||
this.alias = alias; | ||
this.sourceTable = sourceTable; | ||
this.condition = condition; | ||
} | ||
|
||
public ObjectNode toJson(ObjectMapper objectMapper) { | ||
ObjectNode joinNode = objectMapper.createObjectNode(); | ||
joinNode.put("fields", this.fields); | ||
joinNode.put("alias", this.alias); | ||
joinNode.put("source-table", this.sourceTable); | ||
joinNode.set("condition", this.condition); | ||
return joinNode; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
avni-server-api/src/main/java/org/avni/server/domain/metabase/MetabaseQuery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.avni.server.domain.metabase; | ||
|
||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
|
||
public class MetabaseQuery { | ||
private final int sourceTable; | ||
private final ArrayNode joins; | ||
|
||
public MetabaseQuery(int sourceTable, ArrayNode joins) { | ||
this.sourceTable = sourceTable; | ||
this.joins = joins; | ||
} | ||
|
||
public ObjectNode toJson(ObjectMapper objectMapper) { | ||
ObjectNode queryNode = objectMapper.createObjectNode(); | ||
queryNode.put("source-table", this.sourceTable); | ||
queryNode.set("joins", this.joins); | ||
return queryNode; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters