From 711a4ba48981da649e80ef7015d9a8bbf1827138 Mon Sep 17 00:00:00 2001 From: Asif Mansoor Amanullah Date: Tue, 7 Mar 2017 10:38:43 -0600 Subject: [PATCH] addressed commits --- .../DefaultKeyValueStoreDimensionConfig.java | 15 +++++++-------- .../dimension/DefaultLookupDimensionConfig.java | 16 ++++++++-------- .../DefaultRegisteredLookupDimensionConfig.java | 17 ++++++++--------- .../data/config/names/TestDimensionName.java | 3 ++- .../data/config/dimension/WikiDimensions.java | 2 +- .../names/WikiApiDimensionConfigInfo.java | 6 ++++-- .../data/config/table/WikiTableLoader.java | 4 ++-- 7 files changed, 32 insertions(+), 31 deletions(-) diff --git a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultKeyValueStoreDimensionConfig.java b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultKeyValueStoreDimensionConfig.java index 3f5effd318..9aa9f5c6c7 100644 --- a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultKeyValueStoreDimensionConfig.java +++ b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultKeyValueStoreDimensionConfig.java @@ -10,7 +10,6 @@ import java.util.LinkedHashSet; import javax.validation.constraints.NotNull; - /** * A Default Key Value Store Dimension holds all of the information needed to construct a Dimension. */ @@ -71,19 +70,19 @@ public DefaultKeyValueStoreDimensionConfig( * @param description A description of the dimension and its meaning. * @param longName The Long Name is the external, end-user-facing long name for the dimension. * @param category The Category is the external, end-user-facing category for the dimension. - * @param defaultDimensionFields The default set of fields for this dimension to be shown in the response. + * @param fields The set of fields for this dimension, this set of field will also be used for the default fields. * @param keyValueStore The key value store holding dimension row data. * @param searchProvider The search provider for field value lookups on this dimension. */ public DefaultKeyValueStoreDimensionConfig( - DimensionName apiName, + @NotNull DimensionName apiName, String physicalName, String description, String longName, String category, - LinkedHashSet defaultDimensionFields, - KeyValueStore keyValueStore, - SearchProvider searchProvider + @NotNull LinkedHashSet fields, + @NotNull KeyValueStore keyValueStore, + @NotNull SearchProvider searchProvider ) { this ( apiName, @@ -91,8 +90,8 @@ public DefaultKeyValueStoreDimensionConfig( description, longName, category, - defaultDimensionFields, - defaultDimensionFields, + fields, + fields, keyValueStore, searchProvider ); diff --git a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultLookupDimensionConfig.java b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultLookupDimensionConfig.java index d48721f1a5..c646c3fa05 100644 --- a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultLookupDimensionConfig.java +++ b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultLookupDimensionConfig.java @@ -66,21 +66,21 @@ public DefaultLookupDimensionConfig( * @param description A description of the dimension and its meaning. * @param longName The Long Name is the external, end-user-facing long name for the dimension. * @param category The Category is the external, end-user-facing category for the dimension. - * @param defaultDimensionFields The default set of fields for this dimension to be shown in the response. + * @param fields The set of fields for this dimension, this set of field will also be used for the default fields. * @param keyValueStore The key value store holding dimension row data. * @param searchProvider The search provider for field value lookups on this dimension. * @param namespaces A list of namespaces used to configure the Lookup dimension. */ public DefaultLookupDimensionConfig( - DimensionName apiName, + @NotNull DimensionName apiName, String physicalName, String description, String longName, String category, - LinkedHashSet defaultDimensionFields, - KeyValueStore keyValueStore, - SearchProvider searchProvider, - List namespaces + @NotNull LinkedHashSet fields, + @NotNull KeyValueStore keyValueStore, + @NotNull SearchProvider searchProvider, + @NotNull List namespaces ) { this ( apiName, @@ -88,8 +88,8 @@ public DefaultLookupDimensionConfig( description, longName, category, - defaultDimensionFields, - defaultDimensionFields, + fields, + fields, keyValueStore, searchProvider, namespaces diff --git a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultRegisteredLookupDimensionConfig.java b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultRegisteredLookupDimensionConfig.java index f9b568847d..3130aac4b7 100644 --- a/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultRegisteredLookupDimensionConfig.java +++ b/fili-core/src/main/java/com/yahoo/bard/webservice/data/config/dimension/DefaultRegisteredLookupDimensionConfig.java @@ -11,7 +11,6 @@ import java.util.LinkedHashSet; import java.util.List; - /** * A Default Registered Lookup Dimension holds all of the information needed to construct a Registered Lookup Dimension. */ @@ -69,21 +68,21 @@ public DefaultRegisteredLookupDimensionConfig( * @param description A description of the dimension and its meaning. * @param longName The Long Name is the external, end-user-facing long name for the dimension. * @param category The Category is the external, end-user-facing category for the dimension. - * @param defaultDimensionFields The default set of fields for this dimension to be shown in the response. + * @param fields The set of fields for this dimension, this set of field will also be used for the default fields. * @param keyValueStore The key value store holding dimension row data. * @param searchProvider The search provider for field value lookups on this dimension. * @param lookups A list of lookups used to configure the Lookup dimension. */ public DefaultRegisteredLookupDimensionConfig( - DimensionName apiName, + @NotNull DimensionName apiName, String physicalName, String description, String longName, String category, - LinkedHashSet defaultDimensionFields, - KeyValueStore keyValueStore, - SearchProvider searchProvider, - List lookups + @NotNull LinkedHashSet fields, + @NotNull KeyValueStore keyValueStore, + @NotNull SearchProvider searchProvider, + @NotNull List lookups ) { this ( apiName, @@ -91,8 +90,8 @@ public DefaultRegisteredLookupDimensionConfig( description, longName, category, - defaultDimensionFields, - defaultDimensionFields, + fields, + fields, keyValueStore, searchProvider, lookups diff --git a/fili-core/src/test/java/com/yahoo/bard/webservice/data/config/names/TestDimensionName.java b/fili-core/src/test/java/com/yahoo/bard/webservice/data/config/names/TestDimensionName.java index 2bc1867c89..6f86b9774d 100644 --- a/fili-core/src/test/java/com/yahoo/bard/webservice/data/config/names/TestDimensionName.java +++ b/fili-core/src/test/java/com/yahoo/bard/webservice/data/config/names/TestDimensionName.java @@ -11,7 +11,8 @@ public enum TestDimensionName implements DimensionName { NAME, AGE, ETHNICITY, - GENDER; + GENDER + ; @Override public String asName() { diff --git a/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/dimension/WikiDimensions.java b/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/dimension/WikiDimensions.java index 5ddefd8317..826cc5e374 100644 --- a/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/dimension/WikiDimensions.java +++ b/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/dimension/WikiDimensions.java @@ -78,7 +78,7 @@ public Set getAllDimensionConfigurations() { * * @return set of dimension configurations */ - public LinkedHashSet getDimensionConfigurationsByApiName( + public LinkedHashSet getDimensionConfigurationsByConfigInfo( WikiApiDimensionConfigInfo... dimensionNames ) { return Arrays.stream(dimensionNames) diff --git a/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/names/WikiApiDimensionConfigInfo.java b/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/names/WikiApiDimensionConfigInfo.java index 873950d6f8..1f2902d8e6 100644 --- a/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/names/WikiApiDimensionConfigInfo.java +++ b/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/names/WikiApiDimensionConfigInfo.java @@ -3,6 +3,7 @@ package com.yahoo.wiki.webservice.data.config.names; import com.yahoo.bard.webservice.data.config.names.DimensionName; +import com.yahoo.bard.webservice.data.dimension.Dimension; import com.yahoo.bard.webservice.util.EnumUtils; /** @@ -20,7 +21,8 @@ public enum WikiApiDimensionConfigInfo implements DimensionName { CONTINENT("Name of the Continent to which the wiki page belongs ", "wiki continent", "General"), COUNTRY("Name of the Country to which the wiki page belongs", "wiki country", "General"), REGION("Name of the Region to which the wiki page belongs", "wiki region", "General"), - CITY("Name of the City to which the wiki page belongs", "wiki city", "General"); + CITY("Name of the City to which the wiki page belongs", "wiki city", "General") + ; private final String camelName; private final String description; @@ -60,6 +62,6 @@ public String getLongName() { } public String getCategory() { - return this.category; + return Dimension.DEFAULT_CATEGORY; } } diff --git a/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/table/WikiTableLoader.java b/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/table/WikiTableLoader.java index a0519eb4f3..18e2d17503 100644 --- a/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/table/WikiTableLoader.java +++ b/fili-wikipedia-example/src/main/java/com/yahoo/wiki/webservice/data/config/table/WikiTableLoader.java @@ -61,8 +61,8 @@ public WikiTableLoader() { private void configureSample(WikiDimensions wikiDimensions) { // Dimensions - Set dimsBasefactDruidTableName = wikiDimensions.getDimensionConfigurationsByApiName( - WikiApiDimensionConfigInfo.values() + Set dimsBasefactDruidTableName = wikiDimensions.getDimensionConfigurationsByConfigInfo( + WikiApiDimensionConfigInfo.values() ); // Physical Tables