use of com.yahoo.elide.datastores.aggregation.metadata.models.ArgumentDefinition in project elide by yahoo.
the class AggregationDataStore method populateEntityDictionary.
/**
* Populate an {@link EntityDictionary} and use this dictionary to construct a {@link QueryEngine}.
* @param dictionary the dictionary
*/
@Override
public void populateEntityDictionary(EntityDictionary dictionary) {
if (dynamicCompiledClasses != null && dynamicCompiledClasses.size() != 0) {
dynamicCompiledClasses.stream().filter((type) -> !IS_TYPE_HIDDEN.test(type)).forEach(dynamicLoadedClass -> {
dictionary.bindEntity(dynamicLoadedClass, IS_FIELD_HIDDEN);
validateModelExpressionChecks(dictionary, dynamicLoadedClass);
dictionary.bindPermissionExecutor(dynamicLoadedClass, aggPermissionExecutor);
});
}
dictionary.getScanner().getAnnotatedClasses(AGGREGATION_STORE_CLASSES).stream().filter((type) -> !IS_TYPE_HIDDEN.test(ClassType.of(type))).forEach(cls -> {
dictionary.bindEntity(cls, IS_FIELD_HIDDEN);
validateModelExpressionChecks(dictionary, ClassType.of(cls));
dictionary.bindPermissionExecutor(cls, aggPermissionExecutor);
});
for (Table table : queryEngine.getMetaDataStore().getMetaData(ClassType.of(Table.class))) {
/* Add 'grain' argument to each TimeDimensionColumn */
for (TimeDimension timeDim : table.getAllTimeDimensions()) {
dictionary.addArgumentToAttribute(dictionary.getEntityClass(table.getName(), table.getVersion()), timeDim.getName(), new ArgumentType("grain", ClassType.STRING_TYPE, timeDim.getDefaultGrain().getGrain()));
}
/* Add argument to each Column */
for (Column col : table.getAllColumns()) {
for (ArgumentDefinition arg : col.getArgumentDefinitions()) {
dictionary.addArgumentToAttribute(dictionary.getEntityClass(table.getName(), table.getVersion()), col.getName(), new ArgumentType(arg.getName(), ValueType.getType(arg.getType()), arg.getDefaultValue()));
}
}
/* Add argument to each Table */
for (ArgumentDefinition arg : table.getArgumentDefinitions()) {
dictionary.addArgumentToEntity(dictionary.getEntityClass(table.getName(), table.getVersion()), new ArgumentType(arg.getName(), ValueType.getType(arg.getType()), arg.getDefaultValue()));
}
}
}
Aggregations