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 | MCI and MQB added and others modified
- Loading branch information
1 parent
dac5397
commit 910ffb5
Showing
9 changed files
with
267 additions
and
127 deletions.
There are no files selected for viewing
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
37 changes: 37 additions & 0 deletions
37
avni-server-api/src/main/java/org/avni/server/domain/metabase/MetabaseCollectionInfo.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,37 @@ | ||
package org.avni.server.domain.metabase; | ||
|
||
public class MetabaseCollectionInfo { | ||
private String name; | ||
private int id; | ||
private boolean isPersonal; | ||
|
||
public MetabaseCollectionInfo(String name, int id, boolean isPersonal) { | ||
this.name = name; | ||
this.id = id; | ||
this.isPersonal = isPersonal; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public boolean isPersonal() { | ||
return isPersonal; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public void setPersonal(boolean personal) { | ||
isPersonal = personal; | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
avni-server-api/src/main/java/org/avni/server/domain/metabase/MetabaseQueryBuilder.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,41 @@ | ||
// to be completed | ||
package org.avni.server.domain.metabase; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.node.ArrayNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
|
||
public class MetabaseQueryBuilder { | ||
private final Database database; | ||
private ArrayNode joins; | ||
|
||
public MetabaseQueryBuilder(Database database, ArrayNode joins) { | ||
this.database = database; | ||
this.joins = joins; | ||
} | ||
|
||
public MetabaseQueryBuilder forTable(TableDetails tableDetails) { | ||
// code to be added | ||
return this; | ||
} | ||
|
||
|
||
public MetabaseQueryBuilder joinWith(TableDetails joinTable, FieldDetails originField, FieldDetails destinationField) { | ||
// Build the join condition and add to the joins array | ||
ObjectMapper objectMapper = new ObjectMapper(); | ||
ArrayNode joinCondition = objectMapper.createArrayNode(); | ||
|
||
joinCondition.add(ConditionType.EQUAL.getOperator()); | ||
joinCondition.add(objectMapper.createArrayNode().add("field").add(originField.getId())); | ||
joinCondition.add(objectMapper.createArrayNode().add("field").add(destinationField.getId())); | ||
|
||
joins.add(joinCondition); | ||
return this; | ||
} | ||
|
||
|
||
public MetabaseQuery build() { | ||
return new MetabaseQuery(database, joins); | ||
} | ||
} |
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
Oops, something went wrong.