public class MongoTableUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
checkExistingIndices(List<com.mongodb.client.model.IndexModel> expectedIndices,
com.mongodb.client.MongoCursor<org.bson.Document> existingIndices)
Utility method which can be used to check if the existing indices contain the expected indices
defined by the annotation 'PrimaryKey' and 'IndexBy' and log a warning when indices differs.
|
static List<com.mongodb.client.model.IndexModel> |
extractIndexModels(io.siddhi.query.api.annotation.Annotation indices,
List<String> attributeNames,
String tableName) |
static List<com.mongodb.client.model.IndexModel> |
extractIndexModels(List<io.siddhi.query.api.annotation.Annotation> indices,
List<String> attributeNames,
String tableName)
Utility method which can be used to check if the given Indices are valid and return List of
MongoDB Index Models when valid.
|
static com.mongodb.MongoClientOptions.Builder |
extractMongoClientOptionsBuilder(io.siddhi.query.api.annotation.Annotation storeAnnotation,
io.siddhi.core.util.config.ConfigReader configReader)
Utility method which can be used to create MongoClientOptionsBuilder from values defined in the
deployment yaml file.
|
static com.mongodb.client.model.IndexModel |
extractPrimaryKey(io.siddhi.query.api.annotation.Annotation primaryKey,
List<String> attributeNames)
Utility method which can be used to check if the given primary key is valid i.e.
|
static String |
getCompareOperator(io.siddhi.query.api.expression.condition.Compare.Operator operator) |
static boolean |
isEmpty(String field)
Utility method which can be used to check if a given string instance is null or empty.
|
static void |
logQuery(String queryType,
String queryLog) |
static Map<String,Object> |
mapValuesToAttributes(Object[] record,
List<String> attributeNames)
Utility method tp map the values to the respective attributes before database writes.
|
static org.bson.Document |
resolveCondition(MongoCompiledCondition compiledCondition,
Map<String,Object> conditionParameterMap,
String queryType)
Utility method which can be used to resolve the condition with the runtime values and return a Document
describing the filter.
|
public static com.mongodb.client.model.IndexModel extractPrimaryKey(io.siddhi.query.api.annotation.Annotation primaryKey,
List<String> attributeNames)
primaryKey - the PrimaryKey annotation which contains the primary key attributes.attributeNames - List containing names of the attributes.public static List<com.mongodb.client.model.IndexModel> extractIndexModels(io.siddhi.query.api.annotation.Annotation indices, List<String> attributeNames, String tableName)
public static List<com.mongodb.client.model.IndexModel> extractIndexModels(List<io.siddhi.query.api.annotation.Annotation> indices, List<String> attributeNames, String tableName)
indices - the IndexBy annotation which contains the indices definitions.attributeNames - List containing names of the attributes.public static org.bson.Document resolveCondition(MongoCompiledCondition compiledCondition, Map<String,Object> conditionParameterMap, String queryType)
compiledCondition - the compiled condition which was built during compile time and now is being provided
by the Siddhi runtime.conditionParameterMap - the map which contains the runtime value(s) for the condition.public static boolean isEmpty(String field)
field - the string instance to be checked.public static Map<String,Object> mapValuesToAttributes(Object[] record, List<String> attributeNames)
record - Object array of the runtime values.attributeNames - List containing names of the attributes.public static void checkExistingIndices(List<com.mongodb.client.model.IndexModel> expectedIndices, com.mongodb.client.MongoCursor<org.bson.Document> existingIndices)
existingIndices - List of indices that the collection contains.expectedIndices - List of indices that are defined by the annotations.public static com.mongodb.MongoClientOptions.Builder extractMongoClientOptionsBuilder(io.siddhi.query.api.annotation.Annotation storeAnnotation,
io.siddhi.core.util.config.ConfigReader configReader)
storeAnnotation - the source annotation which contains the needed parameters.configReader - ConfigReader Configuration Readerpublic static String getCompareOperator(io.siddhi.query.api.expression.condition.Compare.Operator operator)
Copyright © 2021 WSO2. All rights reserved.