Search in sources :

Example 1 with DEFAULT

use of com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage.DEFAULT in project elide by yahoo.

the class MetaDataStore method getNamespace.

/**
 * Get a namespace object.
 *
 * @param modelType the model type
 * @return the namespace
 */
public Namespace getNamespace(Type<?> modelType) {
    String apiVersionName = EntityDictionary.getModelVersion(modelType);
    Include include = (Include) EntityDictionary.getFirstPackageAnnotation(modelType, Arrays.asList(Include.class));
    String namespaceName;
    if (include != null && !include.name().isEmpty()) {
        namespaceName = include.name();
    } else {
        namespaceName = DEFAULT;
    }
    return namespaces.stream().filter(namespace -> namespace.getName().equals(namespaceName)).filter(namespace -> namespace.getVersion().equals(apiVersionName)).findFirst().orElse(null);
}
Also used : HashMapDataStore(com.yahoo.elide.core.datastore.inmemory.HashMapDataStore) Arrays(java.util.Arrays) Path(com.yahoo.elide.core.Path) Getter(lombok.Getter) IS_FIELD_HIDDEN(com.yahoo.elide.datastores.aggregation.AggregationDataStore.IS_FIELD_HIDDEN) Include(com.yahoo.elide.annotation.Include) Dimension(com.yahoo.elide.datastores.aggregation.metadata.models.Dimension) HashMap(java.util.HashMap) Function(java.util.function.Function) HashSet(java.util.HashSet) DuplicateMappingException(com.yahoo.elide.core.exceptions.DuplicateMappingException) NamespacePackage(com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage) Pair(org.apache.commons.lang3.tuple.Pair) DEFAULT_NAMESPACE(com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage.DEFAULT_NAMESPACE) TableType(com.yahoo.elide.datastores.aggregation.dynamic.TableType) Namespace(com.yahoo.elide.datastores.aggregation.metadata.models.Namespace) ClassScanner(com.yahoo.elide.core.utils.ClassScanner) Map(java.util.Map) Column(com.yahoo.elide.datastores.aggregation.metadata.models.Column) NO_VERSION(com.yahoo.elide.core.dictionary.EntityDictionary.NO_VERSION) InternalServerErrorException(com.yahoo.elide.core.exceptions.InternalServerErrorException) AggregationDataStore(com.yahoo.elide.datastores.aggregation.AggregationDataStore) Entity(javax.persistence.Entity) ApiVersion(com.yahoo.elide.annotation.ApiVersion) DataStoreTransaction(com.yahoo.elide.core.datastore.DataStoreTransaction) TableSource(com.yahoo.elide.datastores.aggregation.metadata.models.TableSource) DEFAULT(com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage.DEFAULT) FromSubquery(com.yahoo.elide.datastores.aggregation.queryengines.sql.annotation.FromSubquery) Collection(java.util.Collection) ArgumentDefinition(com.yahoo.elide.datastores.aggregation.metadata.models.ArgumentDefinition) TimeDimensionGrain(com.yahoo.elide.datastores.aggregation.metadata.models.TimeDimensionGrain) Set(java.util.Set) FromTable(com.yahoo.elide.datastores.aggregation.queryengines.sql.annotation.FromTable) Subselect(org.hibernate.annotations.Subselect) Collectors(java.util.stream.Collectors) EntityDictionary(com.yahoo.elide.core.dictionary.EntityDictionary) List(java.util.List) Versioned(com.yahoo.elide.datastores.aggregation.metadata.models.Versioned) TypeHelper.getClassType(com.yahoo.elide.core.utils.TypeHelper.getClassType) DataStore(com.yahoo.elide.core.datastore.DataStore) Type(com.yahoo.elide.core.type.Type) TimeDimension(com.yahoo.elide.datastores.aggregation.metadata.models.TimeDimension) Annotation(java.lang.annotation.Annotation) Table(com.yahoo.elide.datastores.aggregation.metadata.models.Table) EMPTY(com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage.EMPTY) MetricFormula(com.yahoo.elide.datastores.aggregation.annotation.MetricFormula) Metric(com.yahoo.elide.datastores.aggregation.metadata.models.Metric) Include(com.yahoo.elide.annotation.Include)

Aggregations

ApiVersion (com.yahoo.elide.annotation.ApiVersion)1 Include (com.yahoo.elide.annotation.Include)1 Path (com.yahoo.elide.core.Path)1 DataStore (com.yahoo.elide.core.datastore.DataStore)1 DataStoreTransaction (com.yahoo.elide.core.datastore.DataStoreTransaction)1 HashMapDataStore (com.yahoo.elide.core.datastore.inmemory.HashMapDataStore)1 EntityDictionary (com.yahoo.elide.core.dictionary.EntityDictionary)1 NO_VERSION (com.yahoo.elide.core.dictionary.EntityDictionary.NO_VERSION)1 DuplicateMappingException (com.yahoo.elide.core.exceptions.DuplicateMappingException)1 InternalServerErrorException (com.yahoo.elide.core.exceptions.InternalServerErrorException)1 Type (com.yahoo.elide.core.type.Type)1 ClassScanner (com.yahoo.elide.core.utils.ClassScanner)1 TypeHelper.getClassType (com.yahoo.elide.core.utils.TypeHelper.getClassType)1 AggregationDataStore (com.yahoo.elide.datastores.aggregation.AggregationDataStore)1 IS_FIELD_HIDDEN (com.yahoo.elide.datastores.aggregation.AggregationDataStore.IS_FIELD_HIDDEN)1 MetricFormula (com.yahoo.elide.datastores.aggregation.annotation.MetricFormula)1 NamespacePackage (com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage)1 DEFAULT (com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage.DEFAULT)1 DEFAULT_NAMESPACE (com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage.DEFAULT_NAMESPACE)1 EMPTY (com.yahoo.elide.datastores.aggregation.dynamic.NamespacePackage.EMPTY)1