-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* copy code verbatim from old module to the new module * make changes in build.gradle * make changes to the new module * add new module in settings.gradle
- Loading branch information
1 parent
56fcb75
commit 39a5c92
Showing
29 changed files
with
2,303 additions
and
0 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
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,21 @@ | ||
apply plugin: 'java' | ||
|
||
apply from: "$rootDir/gradle/java-publishing.gradle" | ||
|
||
dependencies { | ||
compile project(':dao-api') | ||
|
||
compile externalDependency.elasticSearchRest7 | ||
compile externalDependency.elasticSearchTransport7 | ||
compile externalDependency.guava | ||
compile externalDependency.lombok | ||
compile externalDependency.commonsIo | ||
compile externalDependency.commonsLang | ||
compile externalDependency.jacksonCore | ||
compile externalDependency.jacksonDataBind | ||
|
||
annotationProcessor externalDependency.lombok | ||
|
||
testCompile project(':testing:test-models') | ||
testCompile externalDependency.mockitoInline | ||
} |
57 changes: 57 additions & 0 deletions
57
.../elasticsearch-dao-7/src/main/java/com/linkedin/metadata/dao/browse/BaseBrowseConfig.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,57 @@ | ||
package com.linkedin.metadata.dao.browse; | ||
|
||
import com.linkedin.data.schema.RecordDataSchema; | ||
import com.linkedin.data.template.RecordTemplate; | ||
import javax.annotation.Nonnull; | ||
|
||
|
||
public abstract class BaseBrowseConfig<DOCUMENT extends RecordTemplate> { | ||
private static RecordDataSchema searchDocumentSchema; | ||
|
||
@Nonnull | ||
public String getBrowseDepthFieldName() { | ||
return "browsePaths.length"; | ||
} | ||
|
||
@Nonnull | ||
public String getBrowsePathFieldName() { | ||
return "browsePaths"; | ||
} | ||
|
||
@Nonnull | ||
public String getUrnFieldName() { | ||
return "urn"; | ||
} | ||
|
||
@Nonnull | ||
public String getSortingField() { | ||
return "urn"; | ||
} | ||
|
||
@Nonnull | ||
public String getRemovedField() { | ||
return "removed"; | ||
} | ||
|
||
public boolean hasFieldInSchema(@Nonnull String fieldName) { | ||
return getSearchDocumentSchema().contains(fieldName); | ||
} | ||
|
||
private RecordDataSchema getSearchDocumentSchema() { | ||
if (searchDocumentSchema == null) { | ||
try { | ||
searchDocumentSchema = getSearchDocument().newInstance().schema(); | ||
} catch (InstantiationException | IllegalAccessException e) { | ||
throw new RuntimeException("Couldn't create an instance of the search document"); | ||
} | ||
} | ||
return searchDocumentSchema; | ||
} | ||
|
||
@Nonnull | ||
public String getIndexName() { | ||
return getSearchDocument().getSimpleName().toLowerCase(); | ||
} | ||
|
||
public abstract Class<DOCUMENT> getSearchDocument(); | ||
} |
Oops, something went wrong.