mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-16 03:18:45 +00:00
Add new style checks and fix issues.
- Upgrade to checkstyle 8 - Copy javadoc checks from Google - Disable missing class and method checks for now, too many warnings. I'll have to figure out how to suppress them instead. - Fix other issues, which are mostly missing periods at the end of sentences and lack of paragraph tags.
This commit is contained in:
parent
08f2ce61d9
commit
b9f11ae21b
@ -16,7 +16,7 @@ public abstract class BaseRelationshipBuilder<ASPECT extends RecordTemplate> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the aspect class this {@link BaseRelationshipBuilder} supports
|
||||
* Returns the aspect class this {@link BaseRelationshipBuilder} supports.
|
||||
*/
|
||||
@Nonnull
|
||||
public Class<ASPECT> supportedAspectClass() {
|
||||
@ -24,7 +24,7 @@ public abstract class BaseRelationshipBuilder<ASPECT extends RecordTemplate> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of corresponding relationship updates for the given metadata aspect
|
||||
* Returns a list of corresponding relationship updates for the given metadata aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract <URN extends Urn> List<GraphBuilder.RelationshipUpdates> buildRelationships(@Nonnull URN urn,
|
||||
|
@ -9,7 +9,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* Base class for populating documents from a metadata snapshot
|
||||
* Base class for populating documents from a metadata snapshot.
|
||||
*
|
||||
* @param <DOCUMENT> the type of document that will be populated and returned
|
||||
*/
|
||||
@ -18,7 +18,7 @@ public abstract class BaseIndexBuilder<DOCUMENT extends RecordTemplate> {
|
||||
final List<Class<? extends RecordTemplate>> _snapshotsInterested;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*
|
||||
* @param snapshotsInterested List of metadata snapshot classes the document index builder is interested in
|
||||
* @param documentClass class of DOCUMENT that should have a valid schema
|
||||
@ -31,13 +31,13 @@ public abstract class BaseIndexBuilder<DOCUMENT extends RecordTemplate> {
|
||||
/**
|
||||
* Constructs documents to update from a metadata snapshot
|
||||
*
|
||||
* <p> Given a metadata snapshot containing a list of metadata aspects, this function returns list of documents.
|
||||
* <p>Given a metadata snapshot containing a list of metadata aspects, this function returns list of documents.
|
||||
*
|
||||
* <p> Each document is obtained from parsing a metadata aspect from the metadata snapshot that is relevant to
|
||||
* <p>Each document is obtained from parsing a metadata aspect from the metadata snapshot that is relevant to
|
||||
* the document index builder that inherits this class.
|
||||
*
|
||||
* Each document index builder that inherits from this class, should subscribe to the metadata snapshots it is interested
|
||||
* in by calling the constructor of this class with the list of metadata snapshot classes
|
||||
* <p>Each document index builder that inherits from this class, should subscribe to the metadata snapshots it is
|
||||
* interested in by calling the constructor of this class with the list of metadata snapshot classes
|
||||
*
|
||||
* @param snapshot Metadata snapshot from which document has to be parsed
|
||||
* @return list of documents obtained from various aspects inside a metadata snapshot
|
||||
|
@ -15,9 +15,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
|
||||
/**
|
||||
* This class holds method for taking a snapshot to generate relevant documents
|
||||
* This class holds method for taking a snapshot to generate relevant documents.
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
public final class SnapshotProcessor {
|
||||
|
||||
@ -25,7 +24,7 @@ public final class SnapshotProcessor {
|
||||
private final Set<? extends BaseIndexBuilder> _registeredBuilders;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*
|
||||
* @param registerdBuilders Set of document index builders who are interested in parsing metadata snapshot
|
||||
*/
|
||||
@ -53,16 +52,16 @@ public final class SnapshotProcessor {
|
||||
/**
|
||||
* Constructs documents to update from a snapshot.
|
||||
*
|
||||
* <p> Given a snapshot which is a union of metadata snapshot types, this function returns list of documents to update
|
||||
* <p>Given a snapshot which is a union of metadata snapshot types, this function returns list of documents to update
|
||||
* from parsing non-empty metadata aspects.
|
||||
*
|
||||
* <p> A given metadata snapshot type will contain metadata aspects, each such aspect could be used by multiple
|
||||
* <p>A given metadata snapshot type will contain metadata aspects, each such aspect could be used by multiple
|
||||
* document index builders to construct a document.
|
||||
*
|
||||
* <p> Each document index builder will subscribe to certain snapshot types whose aspects they are interested in, by
|
||||
* <p>Each document index builder will subscribe to certain snapshot types whose aspects they are interested in, by
|
||||
* providing the list of snapshot types in function snapshotsInterested()
|
||||
*
|
||||
* <p> Each document index builder will parse relevant aspects from a metadata snapshot type it has subscribed to and
|
||||
* <p>Each document index builder will parse relevant aspects from a metadata snapshot type it has subscribed to and
|
||||
* return documents to update.
|
||||
*
|
||||
* @param snapshot Snapshot from which the document needs to be parsed
|
||||
|
@ -67,7 +67,7 @@ public class EbeanLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends Urn>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for EbeanLocalDAO
|
||||
* Constructor for EbeanLocalDAO.
|
||||
*
|
||||
* @param aspectUnionClass containing union of all supported aspects. Must be a valid aspect union defined in com.linkedin.metadata.aspect
|
||||
* @param producer {@link BaseMetadataEventProducer} for the metadata event producer
|
||||
@ -80,7 +80,7 @@ public class EbeanLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends Urn>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for EbeanLocalDAO
|
||||
* Constructor for EbeanLocalDAO.
|
||||
*
|
||||
* @param producer {@link BaseMetadataEventProducer} for the metadata event producer
|
||||
* @param serverConfig {@link ServerConfig} that defines the configuration of EbeanServer instances
|
||||
@ -395,7 +395,8 @@ public class EbeanLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends Urn>
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an {@link AspectKey} and a {@link PrimaryKey} for Ebean are equivalent
|
||||
* Checks if an {@link AspectKey} and a {@link PrimaryKey} for Ebean are equivalent.
|
||||
*
|
||||
* @param aspectKey Urn needs to do a ignore case match
|
||||
*/
|
||||
private boolean matchKeys(@Nonnull AspectKey<URN, ? extends RecordTemplate> aspectKey, @Nonnull PrimaryKey pk) {
|
||||
@ -625,7 +626,7 @@ public class EbeanLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends Urn>
|
||||
|
||||
/**
|
||||
* Sets the values of parameters in metadata index query based on its position, values obtained from
|
||||
* {@link IndexCriterionArray} and last urn
|
||||
* {@link IndexCriterionArray} and last urn.
|
||||
*
|
||||
* @param indexCriterionArray {@link IndexCriterionArray} whose values will be used to set parameters in metadata
|
||||
* index query based on its position
|
||||
@ -647,7 +648,7 @@ public class EbeanLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends Urn>
|
||||
|
||||
/**
|
||||
* Constructs SQL query that contains positioned parameters (with `?`), based on whether {@link IndexCriterion} of
|
||||
* a given condition has field `pathParams`
|
||||
* a given condition has field `pathParams`.
|
||||
*
|
||||
* @param indexCriterionArray {@link IndexCriterionArray} used to construct the SQL query
|
||||
* @return String representation of SQL query
|
||||
@ -671,8 +672,10 @@ public class EbeanLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends Urn>
|
||||
|
||||
/**
|
||||
* Returns list of urns from strongly consistent secondary index that satisfy the given filter conditions.
|
||||
* Results are sorted in increasing alphabetical order of urn.
|
||||
* NOTE: Currently this works for upto 10 filter conditions.
|
||||
*
|
||||
* <p>Results are sorted in increasing alphabetical order of urn.
|
||||
*
|
||||
* <p>NOTE: Currently this works for upto 10 filter conditions.
|
||||
*
|
||||
* @param indexFilter {@link IndexFilter} containing filter conditions to be applied
|
||||
* @param lastUrn last urn of the previous fetched page. This eliminates the need to use offset which
|
||||
|
@ -17,6 +17,9 @@ import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
/**
|
||||
* Schema definition for the metadata aspect table.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@ -35,6 +38,9 @@ public class EbeanMetadataAspect extends Model {
|
||||
public static final String CREATED_BY_COLUMN = "createdBy";
|
||||
public static final String CREATED_FOR_COLUMN = "createdFor";
|
||||
|
||||
/**
|
||||
* Key for an aspect in the table.
|
||||
*/
|
||||
@Embeddable
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
|
@ -12,6 +12,9 @@ import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
/**
|
||||
* Unique ID for a piece of metadata stored in MySQL.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
|
@ -14,6 +14,9 @@ import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
/**
|
||||
* Index definition for MySQL metadata.
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
// define composite indexes
|
||||
|
@ -38,7 +38,7 @@ public class ImmutableLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends U
|
||||
private static final String GMA_CREATE_ALL_SQL = "gma-create-all.sql";
|
||||
|
||||
/**
|
||||
* Constructs an {@link ImmutableLocalDAO} from a hard-coded URN-Aspect map
|
||||
* Constructs an {@link ImmutableLocalDAO} from a hard-coded URN-Aspect map.
|
||||
*/
|
||||
public ImmutableLocalDAO(@Nonnull Class<ASPECT_UNION> aspectUnionClass,
|
||||
@Nonnull Map<URN, ? extends RecordTemplate> urnAspectMap) {
|
||||
@ -60,7 +60,7 @@ public class ImmutableLocalDAO<ASPECT_UNION extends UnionTemplate, URN extends U
|
||||
/**
|
||||
* Loads a map of URN to aspect values from an {@link InputStream}.
|
||||
*
|
||||
* The InputStream is expected to contain a JSON map where the keys are a specific type of URN and values are a
|
||||
* <p>The InputStream is expected to contain a JSON map where the keys are a specific type of URN and values are a
|
||||
* specific type of metadata aspect.
|
||||
*/
|
||||
@Nonnull
|
||||
|
@ -7,6 +7,9 @@ import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* Maps schema paths to values for DatasetUrns.
|
||||
*/
|
||||
public class DatasetUrnPathExtractor implements UrnPathExtractor<DatasetUrn> {
|
||||
@Override
|
||||
public Map<String, Object> extractPaths(@Nonnull DatasetUrn urn) {
|
||||
|
@ -10,7 +10,7 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* A class that holds all the registered {@link UrnPathExtractor}s.
|
||||
*
|
||||
* Register new type of urn path extractors by adding them to {@link #REGISTERED_URN_PATH_EXTRACTORS}.
|
||||
* <p>Register new type of urn path extractors by adding them to {@link #REGISTERED_URN_PATH_EXTRACTORS}.
|
||||
*/
|
||||
public class RegisteredUrnPathExtractors {
|
||||
|
||||
|
@ -5,6 +5,9 @@ import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
/**
|
||||
* Given an urn, extracts a map of schema key to value.
|
||||
*/
|
||||
public interface UrnPathExtractor<URN extends Urn> {
|
||||
@Nonnull
|
||||
Map<String, Object> extractPaths(@Nonnull URN urn);
|
||||
|
@ -53,7 +53,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of groups/entities that match given browse request
|
||||
* Gets a list of groups/entities that match given browse request.
|
||||
*
|
||||
* @param path the path to be browsed
|
||||
* @param requestParams the request map with fields and values as filters
|
||||
@ -81,7 +81,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds aggregations for search request
|
||||
* Builds aggregations for search request.
|
||||
*
|
||||
* @param path the path which is being browsed
|
||||
* @return {@link AggregationBuilder}
|
||||
@ -99,7 +99,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs group search request
|
||||
* Constructs group search request.
|
||||
*
|
||||
* @param path the path which is being browsed
|
||||
* @return {@link SearchRequest}
|
||||
@ -115,7 +115,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds query string
|
||||
* Builds query string.
|
||||
*
|
||||
* @param path the path which is being browsed
|
||||
* @param requestMap entity filters e.g. status=PUBLISHED for features
|
||||
@ -154,7 +154,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs search request for entity search
|
||||
* Constructs search request for entity search.
|
||||
*
|
||||
* @param path the path which is being browsed
|
||||
* @param from index of first entity
|
||||
@ -177,7 +177,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts search responses into browse result
|
||||
* Extracts search responses into browse result.
|
||||
*
|
||||
* @param groupsResponse groups search response
|
||||
* @param entitiesResponse entity search response
|
||||
@ -200,7 +200,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts group search response into browse result metadata
|
||||
* Extracts group search response into browse result metadata.
|
||||
*
|
||||
* @param groupsResponse groups search response
|
||||
* @param path the path which is being browsed
|
||||
@ -221,7 +221,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts entity search response into list of browse result entities
|
||||
* Extracts entity search response into list of browse result entities.
|
||||
*
|
||||
* @param entitiesResponse entity search response
|
||||
* @return list of {@link BrowseResultEntity}
|
||||
@ -247,9 +247,9 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the name of group/entity from path
|
||||
* Extracts the name of group/entity from path.
|
||||
*
|
||||
* Example: /foo/bar/baz => baz
|
||||
* <p>Example: /foo/bar/baz => baz
|
||||
*
|
||||
* @param path path of the group/entity
|
||||
* @return String
|
||||
@ -275,7 +275,7 @@ public class ESBrowseDAO extends BaseBrowseDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of paths for a given urn
|
||||
* Gets a list of paths for a given urn.
|
||||
*
|
||||
* @param urn urn of the entity
|
||||
* @return all paths related to a given urn
|
||||
|
@ -18,20 +18,21 @@ public abstract class BaseESAutoCompleteQuery {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the search query for auto complete request
|
||||
* Constructs the search query for auto complete request.
|
||||
*
|
||||
* <p>TODO: merge this with regular search query construction to take filters as context for suggestions
|
||||
*
|
||||
* @param field the field name for the auto complete
|
||||
* @param input the type ahead query text
|
||||
* @param requestParams the request map as filters
|
||||
* @return a valid search request
|
||||
* TODO: merge this with regular search query construction to take filters as context for suggestions
|
||||
*/
|
||||
@Nonnull
|
||||
abstract SearchRequest constructAutoCompleteQuery(@Nonnull String input, @Nonnull String field,
|
||||
@Nullable Filter requestParams);
|
||||
|
||||
/**
|
||||
* Gets a list of suggestions out of raw search hits
|
||||
* Gets a list of suggestions out of raw search hits.
|
||||
*
|
||||
* @param searchResponse the raw search response from search engine
|
||||
* @param field the field name for the auto complete
|
||||
|
@ -44,7 +44,7 @@ public class ESAutoCompleteQueryForHighCardinalityFields extends BaseESAutoCompl
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs auto complete query given request
|
||||
* Constructs auto complete query given request.
|
||||
*
|
||||
* @param input the type ahead query text
|
||||
* @param field the field name for the auto complete
|
||||
|
@ -44,7 +44,7 @@ public class ESAutoCompleteQueryForLowCardinalityFields extends BaseESAutoComple
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs auto complete query given request
|
||||
* Constructs auto complete query given request.
|
||||
*
|
||||
* @param input the type ahead query text
|
||||
* @param field the field name for the auto complete
|
||||
|
@ -83,7 +83,7 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the base query string given input
|
||||
* Constructs the base query string given input.
|
||||
*
|
||||
* @param input the search input text
|
||||
* @return built query
|
||||
@ -131,7 +131,8 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link SearchRequest} given filters to be applied to search query and sort criterion to be applied to search results
|
||||
* Returns a {@link SearchRequest} given filters to be applied to search query and sort criterion to be applied to
|
||||
* search results.
|
||||
*
|
||||
* @param filters {@link Filter} list of conditions with fields and values
|
||||
* @param sortCriterion {@link SortCriterion} to be applied to the search results
|
||||
@ -162,14 +163,15 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the search query based on the query request
|
||||
* Constructs the search query based on the query request.
|
||||
*
|
||||
* <p>TODO: This part will be replaced by searchTemplateAPI when the elastic is upgraded to 6.4 or later
|
||||
*
|
||||
* @param input the search input text
|
||||
* @param filter the search filter
|
||||
* @param from index to start the search from
|
||||
* @param size the number of search hits to return
|
||||
* @return a valid search request
|
||||
* TODO: This part will be replaced by searchTemplateAPI when the elastic is upgraded to 6.4 or later
|
||||
*/
|
||||
@Nonnull
|
||||
public SearchRequest constructSearchQuery(@Nonnull String input, @Nullable Filter filter,
|
||||
@ -192,9 +194,9 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the aggregations and sub-aggregations by adding other facets' filters if they are set in request
|
||||
* Constructs the aggregations and sub-aggregations by adding other facets' filters if they are set in request.
|
||||
*
|
||||
* Retrieves dynamic aggregation bucket values when the selections change on the fly
|
||||
* <p>Retrieves dynamic aggregation bucket values when the selections change on the fly
|
||||
*
|
||||
* @param searchSourceBuilder the builder to build search source for search request
|
||||
* @param filter the search filters
|
||||
@ -218,7 +220,7 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a list of documents from the raw search response
|
||||
* Extracts a list of documents from the raw search response.
|
||||
*
|
||||
* @param searchResponse the raw search response from search engine
|
||||
* @param from offset from the first result you want to fetch
|
||||
@ -244,7 +246,7 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets list of documents from search hits
|
||||
* Gets list of documents from search hits.
|
||||
*
|
||||
* @param searchResponse the raw search response from search engine
|
||||
* @return List of documents
|
||||
@ -256,7 +258,7 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds data map for documents
|
||||
* Builds data map for documents.
|
||||
*
|
||||
* @param objectMap an object map represents one raw search hit
|
||||
* @return a data map
|
||||
@ -305,7 +307,7 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts SearchResultMetadata section
|
||||
* Extracts SearchResultMetadata section.
|
||||
*
|
||||
* @param searchResponse the raw {@link SearchResponse} as obtained from the search engine
|
||||
* @return {@link SearchResultMetadata} with aggregation and list of urns obtained from {@link SearchResponse}
|
||||
@ -344,7 +346,7 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts term aggregations give a parsed term
|
||||
* Extracts term aggregations give a parsed term.
|
||||
*
|
||||
* @param terms an abstract parse term, input can be either ParsedStringTerms ParsedLongTerms
|
||||
* @return a map with aggregation key and corresponding doc counts
|
||||
@ -369,7 +371,7 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts sub aggregations from one term bucket
|
||||
* Extracts sub aggregations from one term bucket.
|
||||
*
|
||||
* @param bucket a term bucket
|
||||
* @return a parsed filter if exist
|
||||
@ -395,5 +397,4 @@ public class ESSearchDAO<DOCUMENT extends RecordTemplate> extends BaseSearchDAO<
|
||||
throw new RuntimeException("Invalid urn in search document " + e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ public class ESUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs the filter query given filter map
|
||||
* Constructs the filter query given filter map.
|
||||
*
|
||||
* Multiple values can be selected for a filter, and it is currently modeled as string separated by comma
|
||||
* <p>Multiple values can be selected for a filter, and it is currently modeled as string separated by comma
|
||||
*
|
||||
* @param filter the search filter
|
||||
* @return built filter query
|
||||
@ -72,7 +72,7 @@ public class ESUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates source field of search query with the sort order as per the criterion provided
|
||||
* Populates source field of search query with the sort order as per the criterion provided.
|
||||
*
|
||||
* <p>
|
||||
* If no sort criterion is provided then the default sorting criterion is chosen which is descending order of score
|
||||
@ -98,7 +98,7 @@ public class ESUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes the Elasticsearch reserved characters in the given input string
|
||||
* Escapes the Elasticsearch reserved characters in the given input string.
|
||||
*
|
||||
* @param input input string
|
||||
* @return input string in which reserved characters are escaped
|
||||
|
@ -24,7 +24,7 @@ public class SearchUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the request params and create a request map out of it
|
||||
* Validates the request params and create a request map out of it.
|
||||
*
|
||||
* @param requestParams the search request with fields and values
|
||||
* @return a request map
|
||||
@ -45,7 +45,7 @@ public class SearchUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds search query using criterion
|
||||
* Builds search query using criterion.
|
||||
*
|
||||
* @param criterion {@link Criterion} single criterion which contains field, value and a comparison operator
|
||||
* @return QueryBuilder
|
||||
|
@ -40,7 +40,7 @@ public class KafkaMetadataEventProducer<SNAPSHOT extends RecordTemplate, ASPECT_
|
||||
private final Optional<Callback> _callback;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*
|
||||
* @param snapshotClass The snapshot class for the produced events
|
||||
* @param aspectUnionClass The aspect union in the snapshot
|
||||
@ -54,7 +54,7 @@ public class KafkaMetadataEventProducer<SNAPSHOT extends RecordTemplate, ASPECT_
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*
|
||||
* @param snapshotClass The snapshot class for the produced events
|
||||
* @param aspectUnionClass The aspect union in the snapshot
|
||||
|
@ -237,11 +237,11 @@ public class Neo4jQueryDAO extends BaseQueryDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs a query statement with parameters and return StatementResult
|
||||
* Runs a query statement with parameters and return StatementResult.
|
||||
*
|
||||
* @param statement a statement with parameters to be executed
|
||||
* @param mapperFunction lambda to transform query result
|
||||
* @return List<T> list of elements in the query result
|
||||
* @return list of elements in the query result
|
||||
*/
|
||||
@Nonnull
|
||||
private <T> List<T> runQuery(@Nonnull Statement statement, @Nonnull Function<Record, T> mapperFunction) {
|
||||
|
@ -35,7 +35,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts ENTITY to node (field:value map)
|
||||
* Converts ENTITY to node (field:value map).
|
||||
*
|
||||
* @param entity ENTITY defined in models
|
||||
* @return unmodifiable field value map
|
||||
@ -51,7 +51,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts RELATIONSHIP to edge (field:value map), excluding source and destination
|
||||
* Converts RELATIONSHIP to edge (field:value map), excluding source and destination.
|
||||
*
|
||||
* @param relationship RELATIONSHIP defined in models
|
||||
* @return unmodifiable field value map
|
||||
@ -72,7 +72,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts RELATIONSHIP to cypher matching criteria, excluding source and destination, e.g. {key: "value"}
|
||||
* Converts RELATIONSHIP to cypher matching criteria, excluding source and destination, e.g. {key: "value"}.
|
||||
*
|
||||
* @param relationship RELATIONSHIP defined in models
|
||||
* @return Criteria String, or "" if no additional fields in relationship
|
||||
@ -113,7 +113,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts {@link Filter} to neo4j query criteria, filter criterion condition requires to be EQUAL
|
||||
* Converts {@link Filter} to neo4j query criteria, filter criterion condition requires to be EQUAL.
|
||||
*
|
||||
* @param filter Query Filter
|
||||
* @return Neo4j criteria string
|
||||
@ -124,7 +124,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts {@link CriterionArray} to neo4j query string
|
||||
* Converts {@link CriterionArray} to neo4j query string.
|
||||
*
|
||||
* @param criterionArray CriterionArray in a Filter
|
||||
* @return Neo4j criteria string
|
||||
@ -143,7 +143,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts node (field:value map) to ENTITY
|
||||
* Converts node (field:value map) to ENTITY.
|
||||
*
|
||||
* @param entityClass Class of Entity
|
||||
* @param node Neo4j Node of entityClass type
|
||||
@ -156,7 +156,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts node (field:value map) to ENTITY RecordTemplate
|
||||
* Converts node (field:value map) to ENTITY RecordTemplate.
|
||||
*
|
||||
* @param node Neo4j Node of entityClass type
|
||||
* @return RecordTemplate
|
||||
@ -169,10 +169,9 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts path segment (field:value map) list of {@link RecordTemplate}s of nodes & edges
|
||||
* Converts path segment (field:value map) list of {@link RecordTemplate}s of nodes & edges.
|
||||
*
|
||||
* @param segment The segment of a path containing nodes & edges
|
||||
* @return List<RecordTemplate>
|
||||
*/
|
||||
@Nonnull
|
||||
public static List<RecordTemplate> pathSegmentToRecordList(@Nonnull Path.Segment segment) {
|
||||
@ -188,7 +187,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts edge (source-relationship->destination) to RELATIONSHIP
|
||||
* Converts edge (source-relationship->destination) to RELATIONSHIP.
|
||||
*
|
||||
* @param relationshipClass Class of RELATIONSHIP
|
||||
* @param source Neo4j source Node
|
||||
@ -206,7 +205,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts edge (source-relationship->destination) to RELATIONSHIP RecordTemplate
|
||||
* Converts edge (source-relationship->destination) to RELATIONSHIP RecordTemplate.
|
||||
*
|
||||
* @param source Neo4j source Node
|
||||
* @param destination Neo4j destination Node
|
||||
@ -251,7 +250,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create {@link RelationshipFilter} using filter and relationship direction
|
||||
* Create {@link RelationshipFilter} using filter and relationship direction.
|
||||
*
|
||||
* @param filter {@link Filter} filter
|
||||
* @param relationshipDirection {@link RelationshipDirection} relationship direction
|
||||
@ -264,7 +263,7 @@ public class Neo4jUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create {@link RelationshipFilter} using filter conditions and relationship direction
|
||||
* Create {@link RelationshipFilter} using filter conditions and relationship direction.
|
||||
*
|
||||
* @param field field to create a filter on
|
||||
* @param value field value to be filtered
|
||||
|
@ -103,7 +103,7 @@ public class Neo4jGraphWriterDAO extends BaseGraphWriterDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a query statement with parameters and return StatementResult
|
||||
* Run a query statement with parameters and return StatementResult.
|
||||
*
|
||||
* @param statement a statement with parameters to be executed
|
||||
*/
|
||||
@ -208,7 +208,7 @@ public class Neo4jGraphWriterDAO extends BaseGraphWriterDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Node based on Urn, if not exist, creates placeholder node
|
||||
* Gets Node based on Urn, if not exist, creates placeholder node.
|
||||
*/
|
||||
@Nonnull
|
||||
private Statement getOrInsertNode(@Nonnull Urn urn) {
|
||||
|
@ -30,7 +30,7 @@ import static com.linkedin.metadata.restli.RestliConstants.*;
|
||||
/**
|
||||
* A base class for generating rest.li requests against entity-specific action methods.
|
||||
*
|
||||
* See http://go/gma for more details.
|
||||
* <p>See http://go/gma for more details.
|
||||
*
|
||||
* @param <SNAPSHOT> must be a valid snapshot type defined in com.linkedin.metadata.snapshot
|
||||
* @param <URN> must be the URN type used in {@code SNAPSHOT}
|
||||
|
@ -14,7 +14,7 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* A rest.li implementation of {@link BaseRemoteWriterDAO}.
|
||||
*
|
||||
* Uses rest.li snapshot endpoints to update metadata on remote services.
|
||||
* <p>Uses rest.li snapshot endpoints to update metadata on remote services.
|
||||
*/
|
||||
public class RestliRemoteWriterDAO extends BaseRemoteWriterDAO {
|
||||
|
||||
|
@ -11,13 +11,12 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* A base class for all Browse DAOs.
|
||||
*
|
||||
* A browse DAO is a standardized interface to browse metadata.
|
||||
* See http://go/gma for more details.
|
||||
* <p>A browse DAO is a standardized interface to browse metadata. See http://go/gma for more details.
|
||||
*/
|
||||
public abstract class BaseBrowseDAO {
|
||||
|
||||
/**
|
||||
* Gets a list of groups/entities that match given browse request
|
||||
* Gets a list of groups/entities that match given browse request.
|
||||
*
|
||||
* @param path the path to be browsed
|
||||
* @param requestParams the request map with fields and values as filters
|
||||
@ -29,7 +28,7 @@ public abstract class BaseBrowseDAO {
|
||||
public abstract BrowseResult browse(@Nonnull String path, @Nullable Filter requestParams, int from, int size);
|
||||
|
||||
/**
|
||||
* Gets a list of paths for a given urn
|
||||
* Gets a list of paths for a given urn.
|
||||
*
|
||||
* @param urn urn of the entity
|
||||
* @return all paths related to a given urn
|
||||
|
@ -43,7 +43,7 @@ import lombok.Value;
|
||||
/**
|
||||
* A base class for all Local DAOs.
|
||||
*
|
||||
* Local DAO is a standardized interface to store and retrieve aspects from a document store.
|
||||
* <p>Local DAO is a standardized interface to store and retrieve aspects from a document store.
|
||||
*
|
||||
* @param <ASPECT_UNION> must be a valid aspect union type defined in com.linkedin.metadata.aspect
|
||||
* @param <URN> must be the entity URN type in {@code ASPECT_UNION}
|
||||
@ -100,9 +100,10 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
private Clock _clock = Clock.systemUTC();
|
||||
|
||||
/**
|
||||
* Constructor for BaseLocalDAO
|
||||
* Constructor for BaseLocalDAO.
|
||||
*
|
||||
* @param aspectUnionClass containing union of all supported aspects. Must be a valid aspect union defined in com.linkedin.metadata.aspect
|
||||
* @param aspectUnionClass containing union of all supported aspects. Must be a valid aspect union defined in
|
||||
* com.linkedin.metadata.aspect
|
||||
* @param producer {@link BaseMetadataEventProducer} for the metadata event producer
|
||||
*/
|
||||
public BaseLocalDAO(@Nonnull Class<ASPECT_UNION> aspectUnionClass, @Nonnull BaseMetadataEventProducer producer) {
|
||||
@ -112,7 +113,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for BaseLocalDAO
|
||||
* Constructor for BaseLocalDAO.
|
||||
*
|
||||
* @param producer {@link BaseMetadataEventProducer} for the metadata event producer
|
||||
* @param storageConfig {@link LocalDAOStorageConfig} containing storage config of full list of supported aspects
|
||||
@ -124,7 +125,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* For tests to override the internal clock
|
||||
* For tests to override the internal clock.
|
||||
*/
|
||||
public void setClock(@Nonnull Clock clock) {
|
||||
_clock = clock;
|
||||
@ -151,8 +152,8 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
/**
|
||||
* Registers a post-update hook for a specific aspect.
|
||||
*
|
||||
* The hook will be invoked with the latest value of an aspect after it's updated. There's no guarantee on the order
|
||||
* of invocation when multiple hooks are added for a single aspect. Adding the same hook again will result in
|
||||
* <p>The hook will be invoked with the latest value of an aspect after it's updated. There's no guarantee on the
|
||||
* order of invocation when multiple hooks are added for a single aspect. Adding the same hook again will result in
|
||||
* {@link IllegalArgumentException} thrown. Hooks are invoked in the order they're registered.
|
||||
*/
|
||||
public <URN extends Urn, ASPECT extends RecordTemplate> void addPostUpdateHook(@Nonnull Class<ASPECT> aspectClass,
|
||||
@ -213,7 +214,8 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if writes to local secondary index enabled
|
||||
* Sets if writes to local secondary index enabled.
|
||||
*
|
||||
* @deprecated Use {@link #enableLocalSecondaryIndex(boolean)} instead
|
||||
*/
|
||||
public void setWriteToLocalSecondaryIndex(boolean writeToLocalSecondaryIndex) {
|
||||
@ -221,21 +223,21 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables reads from and writes to local secondary index
|
||||
* Enables reads from and writes to local secondary index.
|
||||
*/
|
||||
public void enableLocalSecondaryIndex(boolean enableLocalSecondaryIndex) {
|
||||
_enableLocalSecondaryIndex = enableLocalSecondaryIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if reads and writes to local secondary index are enabled
|
||||
* Gets if reads and writes to local secondary index are enabled.
|
||||
*/
|
||||
public boolean isLocalSecondaryIndexEnabled() {
|
||||
return _enableLocalSecondaryIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets if local secondary index backfilling is enabled
|
||||
* Sets if local secondary index backfilling is enabled.
|
||||
*/
|
||||
public void setBackfillLocalSecondaryIndex(boolean backfillLocalSecondaryIndex) {
|
||||
_backfillLocalSecondaryIndex = backfillLocalSecondaryIndex;
|
||||
@ -244,9 +246,9 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
/**
|
||||
* Adds a new version of aspect for an entity.
|
||||
*
|
||||
* The new aspect will have an automatically assigned version number, which is guaranteed to be positive and
|
||||
* monotonically increasing. Older versions of aspect will be purged automatically based on the retention setting.
|
||||
* A MetadataAuditEvent is also emitted if there's an actual update.
|
||||
* <p>The new aspect will have an automatically assigned version number, which is guaranteed to be positive and
|
||||
* monotonically increasing. Older versions of aspect will be purged automatically based on the retention setting. A
|
||||
* MetadataAuditEvent is also emitted if there's an actual update.
|
||||
*
|
||||
* @param urn the URN for the entity the aspect is attached to
|
||||
* @param auditStamp the audit stamp for the operation
|
||||
@ -351,7 +353,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the latest aspect
|
||||
* Saves the latest aspect.
|
||||
*
|
||||
* @param urn the URN for the entity the aspect is attached to
|
||||
* @param aspectClass the aspectClass of the aspect being saved
|
||||
@ -359,14 +361,14 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
* @param oldAuditStamp the audit stamp of the previous latest aspect, null if new value is the first version
|
||||
* @param newEntry {@link RecordTemplate} of the new latest value of aspect
|
||||
* @param newAuditStamp the audit stamp for the operation
|
||||
* @return the largestVersion
|
||||
* @return the largest version
|
||||
*/
|
||||
protected abstract <ASPECT extends RecordTemplate> long saveLatest(@Nonnull URN urn,
|
||||
@Nonnull Class<ASPECT> aspectClass, @Nullable ASPECT oldEntry, @Nullable AuditStamp oldAuditStamp,
|
||||
@Nonnull ASPECT newEntry, @Nonnull AuditStamp newAuditStamp);
|
||||
|
||||
/**
|
||||
* Saves the new value of an aspect to local secondary index
|
||||
* Saves the new value of an aspect to local secondary index.
|
||||
*
|
||||
* @param urn the URN for the entity the aspect is attached to
|
||||
* @param newValue {@link RecordTemplate} of the new value of aspect
|
||||
@ -387,7 +389,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
public abstract ListResult<Urn> listUrns(@Nonnull IndexFilter indexFilter, @Nullable URN lastUrn, int pageSize);
|
||||
|
||||
/**
|
||||
* Similar to {@link #listUrns(IndexFilter, URN, int)}. This is to get all urns with type URN
|
||||
* Similar to {@link #listUrns(IndexFilter, URN, int)}. This is to get all urns with type URN.
|
||||
*/
|
||||
@Nonnull
|
||||
public ListResult<Urn> listUrns(@Nonnull Class<URN> urnClazz, @Nullable URN lastUrn, int pageSize) {
|
||||
@ -408,7 +410,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
protected abstract <T> T runInTransactionWithRetry(@Nonnull Supplier<T> block, int maxTransactionRetry);
|
||||
|
||||
/**
|
||||
* Gets the latest version of a specific aspect type for an entity
|
||||
* Gets the latest version of a specific aspect type for an entity.
|
||||
*
|
||||
* @param urn {@link Urn} for the entity
|
||||
* @param aspectClass the type of aspect to get
|
||||
@ -441,7 +443,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
long version, boolean insert);
|
||||
|
||||
/**
|
||||
* Applies version-based retention against a specific aspect type for an entity
|
||||
* Applies version-based retention against a specific aspect type for an entity.
|
||||
*
|
||||
* @param aspectClass the type of aspect to apply retention to
|
||||
* @param urn {@link Urn} for the entity
|
||||
@ -452,7 +454,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
@Nonnull URN urn, @Nonnull VersionBasedRetention retention, long largestVersion);
|
||||
|
||||
/**
|
||||
* Applies time-based retention against a specific aspect type for an entity
|
||||
* Applies time-based retention against a specific aspect type for an entity.
|
||||
*
|
||||
* @param aspectClass the type of aspect to apply retention to
|
||||
* @param urn {@link Urn} for the entity
|
||||
@ -463,8 +465,8 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
@Nonnull URN urn, @Nonnull TimeBasedRetention retention, long currentTime);
|
||||
|
||||
/**
|
||||
* Emits backfill MAE for the latest version of an aspect of an entity and also backfills local
|
||||
* secondary index if writes & backfill enabled
|
||||
* Emits backfill MAE for the latest version of an aspect of an entity and also backfills local secondary index if
|
||||
* writes & backfill enabled.
|
||||
*
|
||||
* @param aspectClass the type of aspect to backfill
|
||||
* @param urn {@link Urn} for the entity
|
||||
@ -481,7 +483,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #backfill(Class, URN)} but gets a set of aspect classes and do a batch backfill
|
||||
* Similar to {@link #backfill(Class, URN)} but gets a set of aspect classes and do a batch backfill.
|
||||
*/
|
||||
@Nonnull
|
||||
public Map<Class<? extends RecordTemplate>, Optional<? extends RecordTemplate>> backfill(
|
||||
@ -493,7 +495,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #backfill(Class, URN)} but gets a set of urns and do a batch backfill
|
||||
* Similar to {@link #backfill(Class, URN)} but gets a set of urns and do a batch backfill.
|
||||
*/
|
||||
@Nonnull
|
||||
public <ASPECT extends RecordTemplate> Map<URN, Optional<ASPECT>> backfill(@Nonnull Class<ASPECT> aspectClass,
|
||||
@ -505,7 +507,8 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #backfill(Class, URN)} but gets a set of aspect classes and a set of URNs and do a batch backfill
|
||||
* Similar to {@link #backfill(Class, URN)} but gets a set of aspect classes and a set of URNs and do a batch
|
||||
* backfill.
|
||||
*/
|
||||
@Nonnull
|
||||
public Map<URN, Map<Class<? extends RecordTemplate>, Optional<? extends RecordTemplate>>> backfill(
|
||||
@ -519,7 +522,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #backfill(Class, Set)} but fetches the set of URNs to backfill using local secondary index
|
||||
* Similar to {@link #backfill(Class, Set)} but fetches the set of URNs to backfill using local secondary index.
|
||||
*/
|
||||
@Nonnull
|
||||
public <ASPECT extends RecordTemplate> Map<URN, Optional<ASPECT>> backfill(
|
||||
@ -529,7 +532,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #backfill(Set, Set)} but fetches the set of URNs to backfill using local secondary index
|
||||
* Similar to {@link #backfill(Set, Set)} but fetches the set of URNs to backfill using local secondary index.
|
||||
*/
|
||||
@Nonnull
|
||||
public Map<URN, Map<Class<? extends RecordTemplate>, Optional<? extends RecordTemplate>>> backfill(
|
||||
@ -540,7 +543,8 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Emits backfill MAE for an aspect of an entity and also backfills local secondary index if writes & backfill enabled
|
||||
* Emits backfill MAE for an aspect of an entity and also backfills local secondary index if writes & backfill
|
||||
* enabled.
|
||||
*
|
||||
* @param aspect aspect to backfill
|
||||
* @param urn {@link Urn} for the entity
|
||||
@ -596,7 +600,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
@Nonnull URN urn, int start, int pageSize);
|
||||
|
||||
/**
|
||||
* Paginates over a specific version of a specific aspect for all Urns
|
||||
* Paginates over a specific version of a specific aspect for all Urns.
|
||||
*
|
||||
* @param aspectClass the type of the aspect to query
|
||||
* @param version the version of the aspect
|
||||
@ -610,7 +614,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
long version, int start, int pageSize);
|
||||
|
||||
/**
|
||||
* Paginates over the latest version of a specific aspect for all Urns
|
||||
* Paginates over the latest version of a specific aspect for all Urns.
|
||||
*
|
||||
* @param aspectClass the type of the aspect to query
|
||||
* @param start the starting offset of the page
|
||||
@ -643,7 +647,7 @@ public abstract class BaseLocalDAO<ASPECT_UNION extends UnionTemplate, URN exten
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #newNumericId(String, int)} but uses a single global namespace
|
||||
* Similar to {@link #newNumericId(String, int)} but uses a single global namespace.
|
||||
*/
|
||||
public long newNumericId() {
|
||||
return newNumericId(DEFAULT_ID_NAMESPACE);
|
||||
|
@ -15,19 +15,17 @@ import static com.linkedin.metadata.dao.utils.QueryUtils.*;
|
||||
/**
|
||||
* A base class for all Query DAOs.
|
||||
*
|
||||
* Query DAO is a standardized interface to query the centralized graph DB.
|
||||
* See http://go/gma for more details.
|
||||
* <p>Query DAO is a standardized interface to query the centralized graph DB. See http://go/gma for more details.
|
||||
*/
|
||||
public abstract class BaseQueryDAO {
|
||||
|
||||
/**
|
||||
* Finds a list of entities of a specific type based on the given filter on the entity
|
||||
* Finds a list of entities of a specific type based on the given filter on the entity.
|
||||
*
|
||||
* @param entityClass the entity class to query
|
||||
* @param filter the filter to apply when querying
|
||||
* @param offset the offset query should start at. Ignored if set to a negative value.
|
||||
* @param count the maximum number of entities to return. Ignored if set to a non-positive value.
|
||||
*
|
||||
* @param <ENTITY> returned entity type. Must be a type defined in com.linkedin.metadata.entity.
|
||||
* @return a list of entities that match the conditions specified in {@code filter}
|
||||
*/
|
||||
@ -40,7 +38,6 @@ public abstract class BaseQueryDAO {
|
||||
*
|
||||
* @param entityClass the entity class to query
|
||||
* @param queryStatement a {@link Statement} with query text and parameters
|
||||
*
|
||||
* @param <ENTITY> returned entity type. Must be a type defined in com.linkedin.metadata.entity.
|
||||
* @return a list of entities from the outcome of the query statement
|
||||
*/
|
||||
@ -58,8 +55,9 @@ public abstract class BaseQueryDAO {
|
||||
public abstract List<RecordTemplate> findMixedTypesEntities(@Nonnull Statement queryStatement);
|
||||
|
||||
/**
|
||||
* Finds a list of entities through certain relationships given an entity filter
|
||||
* For more details on design and use cases, refer to interface 1 in go/gma/graph/dao
|
||||
* Finds a list of entities through certain relationships given an entity filter.
|
||||
*
|
||||
* <p>For more details on design and use cases, refer to interface 1 in go/gma/graph/dao.
|
||||
*
|
||||
* @param sourceEntityClass the source entity class to query
|
||||
* @param sourceEntityFilter the filter to apply to the source entity when querying
|
||||
@ -87,7 +85,8 @@ public abstract class BaseQueryDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a list of entities of a specific type via multiple hops traversal based on the given relationship filter and source/destination entity filter.
|
||||
* Finds a list of entities of a specific type via multiple hops traversal based on the given relationship filter and
|
||||
* source/destination entity filter.
|
||||
*
|
||||
* @param sourceEntityClass the source entity class to query
|
||||
* @param sourceEntityFilter the filter to apply to the source entity when querying
|
||||
@ -118,12 +117,16 @@ public abstract class BaseQueryDAO {
|
||||
*
|
||||
* @param sourceEntityClass the source entity class as the starting point for the query
|
||||
* @param sourceEntityFilter the filter to apply to the source entity when querying
|
||||
* @param traversePaths specify the traverse paths via a list of <relationship type, relationship filter, intermediate entities>
|
||||
* @param traversePaths specify the traverse paths via a list of (relationship type, relationship filter,
|
||||
* intermediate entities)
|
||||
* @param count the maximum number of entities to return. Ignored if set to a non-positive value.
|
||||
*
|
||||
* @param <SRC_ENTITY> source ENTITY type. Starting point of the traverse path. Must be a type defined in com.linkedin.metadata.entity.
|
||||
* @param <INTER_ENTITY> intermediate entity type on the traverse path. Must be a type defined in com.linkedin.metadata.entity.
|
||||
* @param <RELATIONSHIP> relationship type on the traverse path. Must be a type defined in com.linkedin.metadata.relationship.
|
||||
* @param <SRC_ENTITY> source ENTITY type. Starting point of the traverse path. Must be a type defined in
|
||||
* com.linkedin.metadata.entity.
|
||||
* @param <INTER_ENTITY> intermediate entity type on the traverse path. Must be a type defined in
|
||||
* com.linkedin.metadata.entity.
|
||||
* @param <RELATIONSHIP> relationship type on the traverse path. Must be a type defined in
|
||||
* com.linkedin.metadata.relationship.
|
||||
* @return a list of entities that match the conditions specified in {@code filter}
|
||||
*/
|
||||
@Nonnull
|
||||
@ -155,7 +158,8 @@ public abstract class BaseQueryDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a list of relationships of a specific type based on the given relationship filter and destination entity filter.
|
||||
* Finds a list of relationships of a specific type based on the given relationship filter and destination entity
|
||||
* filter.
|
||||
*
|
||||
* @param destinationEntityClass the destination entity class
|
||||
* @param destinationEntityFilter the filter to apply to the destination entity when querying
|
||||
@ -177,7 +181,8 @@ public abstract class BaseQueryDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a list of relationships of a specific type based on the given relationship filter and source/destination entity filter.
|
||||
* Finds a list of relationships of a specific type based on the given relationship filter and source/destination
|
||||
* entity filter.
|
||||
*
|
||||
* @param sourceEntityClass the source entity class to query
|
||||
* @param sourceEntityFilter the filter to apply to the source entity when querying
|
||||
|
@ -72,7 +72,7 @@ public abstract class BaseReadDAO<ASPECT_UNION extends UnionTemplate, URN extend
|
||||
/**
|
||||
* Similar to {@link #get(Class, Urn)} but retrieves multiple aspects latest versions associated with multiple URNs.
|
||||
*
|
||||
* The returned {@link Map} contains all the .
|
||||
* <p>The returned {@link Map} contains all the .
|
||||
*/
|
||||
@Nonnull
|
||||
public Map<URN, Map<Class<? extends RecordTemplate>, Optional<? extends RecordTemplate>>> get(
|
||||
|
@ -8,8 +8,8 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* A base class for all Remote DAO.
|
||||
*
|
||||
* Remote DAO is a standardized interface to fetch aspects stored on a remote service.
|
||||
* See http://go/gma for more details.
|
||||
* <p>Remote DAO is a standardized interface to fetch aspects stored on a remote service. See http://go/gma for more
|
||||
* details.
|
||||
*
|
||||
* @param <ASPECT_UNION> must be an aspect union type defined in com.linkedin.metadata.aspect
|
||||
*/
|
||||
|
@ -14,8 +14,7 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* A base class for all Search DAOs.
|
||||
*
|
||||
* A search DAO is a standardized interface to search metadata.
|
||||
* See http://go/gma for more details.
|
||||
* <p>A search DAO is a standardized interface to search metadata. See http://go/gma for more details.
|
||||
*
|
||||
* @param <DOCUMENT> must be a search document type defined in com.linkedin.metadata.search
|
||||
*/
|
||||
@ -56,9 +55,9 @@ public abstract class BaseSearchDAO<DOCUMENT extends RecordTemplate> {
|
||||
public abstract SearchResult<DOCUMENT> filter(@Nullable Filter filters, @Nullable SortCriterion sortCriterion, int from, int size);
|
||||
|
||||
/**
|
||||
* Returns a list of suggestions given type ahead query
|
||||
* Returns a list of suggestions given type ahead query.
|
||||
*
|
||||
* The advanced auto complete can take filters and provides suggestions based on filtered context
|
||||
* <p>The advanced auto complete can take filters and provides suggestions based on filtered context.
|
||||
*
|
||||
* @param query the type ahead query text
|
||||
* @param field the field name for the auto complete
|
||||
|
@ -8,7 +8,7 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* A base class for all Search Writer DAOs.
|
||||
*
|
||||
* Search Writer DAO is a standardized interface to update a search index.
|
||||
* <p>Search Writer DAO is a standardized interface to update a search index.
|
||||
*/
|
||||
public abstract class BaseSearchWriterDAO<DOCUMENT extends RecordTemplate> {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* A base class for all Graph Writer DAOs.
|
||||
*
|
||||
* Graph Writer DAO is a standardized interface to update a centralized graph DB.
|
||||
* <p>Graph Writer DAO is a standardized interface to update a centralized graph DB.
|
||||
*/
|
||||
public abstract class BaseGraphWriterDAO {
|
||||
|
||||
@ -74,7 +74,7 @@ public abstract class BaseGraphWriterDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a relationship in the graph, with removal operations before adding
|
||||
* Adds a relationship in the graph, with removal operations before adding.
|
||||
*
|
||||
* @param relationship the relationship to be persisted
|
||||
* @param removalOption whether to remove existing relationship of the same type
|
||||
@ -99,7 +99,7 @@ public abstract class BaseGraphWriterDAO {
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a batch of relationships in the graph, with removal operations before adding
|
||||
* Adds a batch of relationships in the graph, with removal operations before adding.
|
||||
*
|
||||
* @param relationships the list of relationships to be persisted
|
||||
* @param removalOption whether to remove existing relationship of the same type
|
||||
|
@ -8,13 +8,13 @@ import javax.annotation.Nonnull;
|
||||
/**
|
||||
* A base class for all remote writer DAOs.
|
||||
*
|
||||
* Remote writer DAO allows updating metadata aspects hosted on a remote service without knowing the exact
|
||||
* <p>Remote writer DAO allows updating metadata aspects hosted on a remote service without knowing the exact
|
||||
* URN-to-service mapping.
|
||||
*/
|
||||
public abstract class BaseRemoteWriterDAO {
|
||||
|
||||
/**
|
||||
* Creates a new metadata snapshot against a remote service
|
||||
* Creates a new metadata snapshot against a remote service.
|
||||
*
|
||||
* @param urn the {@link Urn} for the entity
|
||||
* @param snapshot the snapshot containing updated metadata aspects
|
||||
|
@ -11,7 +11,7 @@ import javax.annotation.Nullable;
|
||||
/**
|
||||
* A base class for all metadata event producers.
|
||||
*
|
||||
* See http://go/gma for more details.
|
||||
*<p>See http://go/gma for more details.
|
||||
*/
|
||||
public abstract class BaseMetadataEventProducer<SNAPSHOT extends RecordTemplate, ASPECT_UNION extends UnionTemplate, URN extends Urn> {
|
||||
|
||||
|
@ -10,7 +10,7 @@ import lombok.Value;
|
||||
public class TimeBasedRetention implements Retention {
|
||||
|
||||
/**
|
||||
* Constructs a {@link TimeBasedRetention} object
|
||||
* Constructs a {@link TimeBasedRetention} object.
|
||||
*
|
||||
* @param maxAgeToRetain maximal age (in milliseconds) to retain. Must be positive.
|
||||
*/
|
||||
|
@ -9,7 +9,7 @@ import lombok.Value;
|
||||
public class VersionBasedRetention implements Retention {
|
||||
|
||||
/**
|
||||
* Constructs a {@link VersionBasedRetention} object
|
||||
* Constructs a {@link VersionBasedRetention} object.
|
||||
*
|
||||
* @param maxVersionsToRetain maximal number of versions to retain. Must be greater than 0.
|
||||
*/
|
||||
|
@ -7,39 +7,39 @@ import lombok.Value;
|
||||
|
||||
|
||||
/**
|
||||
* Immutable class that holds the storage config for different paths of different metadata aspects
|
||||
* Immutable class that holds the storage config for different paths of different metadata aspects.
|
||||
*/
|
||||
@Value
|
||||
@Builder
|
||||
public final class LocalDAOStorageConfig {
|
||||
|
||||
/**
|
||||
* Map of corresponding {@link Class} of metadata aspect to {@link AspectStorageConfig} config
|
||||
* Map of corresponding {@link Class} of metadata aspect to {@link AspectStorageConfig} config.
|
||||
*/
|
||||
Map<Class<? extends RecordTemplate>, AspectStorageConfig> aspectStorageConfigMap;
|
||||
|
||||
/**
|
||||
* Immutable class that holds the storage config of different pegasus paths of a given metadata aspect
|
||||
* Immutable class that holds the storage config of different pegasus paths of a given metadata aspect.
|
||||
*/
|
||||
@Value
|
||||
@Builder
|
||||
public final static class AspectStorageConfig {
|
||||
|
||||
/**
|
||||
* Map of string representation of Pegasus Path to {@link PathStorageConfig} config
|
||||
* Map of string representation of Pegasus Path to {@link PathStorageConfig} config.
|
||||
*/
|
||||
Map<String, PathStorageConfig> pathStorageConfigMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Immutable class that holds the storage config of a given pegasus path of a given metadata aspect
|
||||
* Immutable class that holds the storage config of a given pegasus path of a given metadata aspect.
|
||||
*/
|
||||
@Value
|
||||
@Builder
|
||||
public final static class PathStorageConfig {
|
||||
|
||||
/**
|
||||
* Whether to index the pegasus path to local secondary index
|
||||
* Whether to index the pegasus path to local secondary index.
|
||||
*/
|
||||
@Builder.Default
|
||||
boolean strongConsistentSecondaryIndex = false;
|
||||
|
@ -103,7 +103,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a snapshot class given its FQCN
|
||||
* Gets a snapshot class given its FQCN.
|
||||
*
|
||||
* @param className FQCN of snapshot class
|
||||
* @return snapshot class that extends {@link RecordTemplate}, associated with className
|
||||
@ -116,7 +116,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the "urn" field from a snapshot
|
||||
* Extracts the "urn" field from a snapshot.
|
||||
*
|
||||
* @param snapshot the snapshot to extract urn from
|
||||
* @param <SNAPSHOT> must be a valid snapshot model defined in com.linkedin.metadata.snapshot
|
||||
@ -129,7 +129,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #getUrnFromSnapshot(RecordTemplate)} but extracts from a Snapshot union instead
|
||||
* Similar to {@link #getUrnFromSnapshot(RecordTemplate)} but extracts from a Snapshot union instead.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Urn getUrnFromSnapshotUnion(@Nonnull UnionTemplate snapshotUnion) {
|
||||
@ -137,7 +137,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the "urn" field from a delta
|
||||
* Extracts the "urn" field from a delta.
|
||||
*
|
||||
* @param delta the delta to extract urn from
|
||||
* @param <DELTA> must be a valid delta model defined in com.linkedin.metadata.delta
|
||||
@ -150,7 +150,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #getUrnFromDelta(RecordTemplate)} but extracts from a delta union instead
|
||||
* Similar to {@link #getUrnFromDelta(RecordTemplate)} but extracts from a delta union instead.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Urn getUrnFromDeltaUnion(@Nonnull UnionTemplate deltaUnion) {
|
||||
@ -158,7 +158,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the "urn" field from a search document
|
||||
* Extracts the "urn" field from a search document.
|
||||
*
|
||||
* @param document the document to extract urn from
|
||||
* @param <DOCUMENT> must be a valid document model defined in com.linkedin.metadata.search
|
||||
@ -171,7 +171,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the "urn" field from an entity
|
||||
* Extracts the "urn" field from an entity.
|
||||
*
|
||||
* @param entity the entity to extract urn from
|
||||
* @param <ENTITY> must be a valid entity model defined in com.linkedin.metadata.entity
|
||||
@ -184,7 +184,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the fields with type urn from a relationship
|
||||
* Extracts the fields with type urn from a relationship.
|
||||
*
|
||||
* @param relationship the relationship to extract urn from
|
||||
* @param <RELATIONSHIP> must be a valid relationship model defined in com.linkedin.metadata.relationship
|
||||
@ -200,7 +200,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #getUrnFromRelationship} but extracts from a delta union instead
|
||||
* Similar to {@link #getUrnFromRelationship} but extracts from a delta union instead.
|
||||
*/
|
||||
@Nonnull
|
||||
public static <RELATIONSHIP extends RecordTemplate> Urn getSourceUrnFromRelationship(
|
||||
@ -209,7 +209,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #getUrnFromRelationship} but extracts from a delta union instead
|
||||
* Similar to {@link #getUrnFromRelationship} but extracts from a delta union instead.
|
||||
*/
|
||||
@Nonnull
|
||||
public static <RELATIONSHIP extends RecordTemplate> Urn getDestinationUrnFromRelationship(
|
||||
@ -251,7 +251,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #getAspectsFromSnapshot(RecordTemplate)} but extracts from a snapshot union instead
|
||||
* Similar to {@link #getAspectsFromSnapshot(RecordTemplate)} but extracts from a snapshot union instead.
|
||||
*/
|
||||
@Nonnull
|
||||
public static List<RecordTemplate> getAspectsFromSnapshotUnion(@Nonnull UnionTemplate snapshotUnion) {
|
||||
@ -270,7 +270,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a snapshot with its urn field set
|
||||
* Creates a snapshot with its urn field set.
|
||||
*
|
||||
* @param snapshotClass the type of snapshot to create
|
||||
* @param urn value for the urn field
|
||||
@ -492,7 +492,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all entity classes
|
||||
* Returns all entity classes.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Set<Class<? extends RecordTemplate>> getAllEntities() {
|
||||
@ -503,7 +503,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get entity type from urn class
|
||||
* Get entity type from urn class.
|
||||
*/
|
||||
@Nonnull
|
||||
public static String getEntityTypeFromUrnClass(@Nonnull Class<? extends Urn> urnClass) {
|
||||
@ -526,7 +526,7 @@ public class ModelUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the aspect is defined in common namespace
|
||||
* Return true if the aspect is defined in common namespace.
|
||||
*/
|
||||
public static boolean isCommonAspect(@Nonnull Class<? extends RecordTemplate> clazz) {
|
||||
return clazz.getPackage().getName().startsWith("com.linkedin.common");
|
||||
|
@ -68,7 +68,7 @@ public class QueryUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the total page count
|
||||
* Calculates the total page count.
|
||||
*
|
||||
* @param totalCount total count
|
||||
* @param size page size
|
||||
@ -82,7 +82,7 @@ public class QueryUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates whether there is more results
|
||||
* Calculates whether there is more results.
|
||||
*
|
||||
* @param from offset from the first result you want to fetch
|
||||
* @param size page size
|
||||
|
@ -75,7 +75,7 @@ public class RecordUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link RecordTemplate} object from a serialized JSON string
|
||||
* Creates a {@link RecordTemplate} object from a serialized JSON string.
|
||||
*
|
||||
* @param type the type of {@link RecordTemplate} to create
|
||||
* @param jsonString a JSON string serialized using {@link JacksonDataTemplateCodec}
|
||||
@ -95,7 +95,7 @@ public class RecordUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link RecordTemplate} object from a {@link DataMap}
|
||||
* Creates a {@link RecordTemplate} object from a {@link DataMap}.
|
||||
*
|
||||
* @param type the type of {@link RecordTemplate} to create
|
||||
* @param dataMap a {@link DataMap} of the record
|
||||
@ -119,7 +119,7 @@ public class RecordUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link RecordTemplate} object from class FQCN and a {@link DataMap}
|
||||
* Creates a {@link RecordTemplate} object from class FQCN and a {@link DataMap}.
|
||||
*
|
||||
* @param className FQCN of the record class extending RecordTemplate
|
||||
* @param dataMap a {@link DataMap} of the record
|
||||
@ -401,7 +401,8 @@ public class RecordUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #getFieldValue(RecordTemplate, PathSpec)} but takes string representation of Pegasus PathSpec as input
|
||||
* Similar to {@link #getFieldValue(RecordTemplate, PathSpec)} but takes string representation of Pegasus PathSpec as
|
||||
* input.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Optional<Object> getFieldValue(@Nonnull RecordTemplate recordTemplate, @Nonnull String pathSpecAsString) {
|
||||
|
@ -13,7 +13,7 @@ import static com.linkedin.metadata.generator.SchemaGeneratorConstants.*;
|
||||
import static com.linkedin.metadata.generator.SchemaGeneratorUtil.*;
|
||||
|
||||
|
||||
/***
|
||||
/**
|
||||
* Render the property annotations to the MXE pdl schema.
|
||||
*/
|
||||
@Slf4j
|
||||
|
@ -6,8 +6,8 @@ import javax.annotation.Nonnull;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/***
|
||||
* Getter & setter class for schema event metadata.
|
||||
/**
|
||||
* Getter & setter class for schema event metadata.
|
||||
*/
|
||||
@Data
|
||||
public class EventSpec {
|
||||
|
@ -14,7 +14,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import static com.linkedin.metadata.generator.SchemaGeneratorConstants.*;
|
||||
|
||||
|
||||
/***
|
||||
/**
|
||||
* Parse the property annotations from the pdl schema.
|
||||
*/
|
||||
@Slf4j
|
||||
|
@ -7,6 +7,9 @@ import javax.annotation.Nonnull;
|
||||
import org.rythmengine.Rythm;
|
||||
|
||||
|
||||
/**
|
||||
* Generates MXE schemas.
|
||||
*/
|
||||
public class SchemaGenerator {
|
||||
|
||||
private final DataSchemaParser _dataSchemaParser;
|
||||
|
@ -11,7 +11,8 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Base client that all entities supporting browse as well as search should implement in their respective restli MPs
|
||||
* Base client that all entities supporting browse as well as search should implement in their respective restli MPs.
|
||||
*
|
||||
* @param <VALUE> the client's value type
|
||||
* @param <URN> urn type of the entity
|
||||
*/
|
||||
@ -37,7 +38,7 @@ public abstract class BaseBrowsableClient<VALUE extends RecordTemplate, URN exte
|
||||
throws RemoteInvocationException;
|
||||
|
||||
/**
|
||||
* Returns a list of paths for a given urn
|
||||
* Returns a list of paths for a given urn.
|
||||
*
|
||||
* @param urn Urn of the entity
|
||||
* @return all paths that are related to the urn
|
||||
|
@ -19,9 +19,9 @@ import static com.linkedin.metadata.restli.RestliConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
* A base class for the entity rest.li resource that supports CRUD + search + browse methods
|
||||
* A base class for the entity rest.li resource that supports CRUD + search + browse methods.
|
||||
*
|
||||
* See http://go/gma for more details
|
||||
* <p>See http://go/gma for more details
|
||||
*
|
||||
* @param <KEY> the resource's key type
|
||||
* @param <VALUE> the resource's value type
|
||||
|
@ -51,7 +51,7 @@ public abstract class BaseClient implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #get(GetRequest)} but takes a @{link GetRequestBuilderBase} instead
|
||||
* Similar to {@link #get(GetRequest)} but takes a @{link GetRequestBuilderBase} instead.
|
||||
*/
|
||||
protected <K, ASPECT extends RecordTemplate, RB extends GetRequestBuilderBase<K, ASPECT, RB>>
|
||||
ASPECT get(@Nonnull GetRequestBuilderBase<K, ASPECT, RB> requestBuilder) throws RemoteInvocationException {
|
||||
@ -82,8 +82,8 @@ public abstract class BaseClient implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #batchGet(BatchGetEntityRequest, Function)} but
|
||||
* takes a @{link BatchGetEntityRequestBuilder} instead
|
||||
* Similar to {@link #batchGet(BatchGetEntityRequest, Function)} but takes a {@link BatchGetEntityRequestBuilder}
|
||||
* instead.
|
||||
*/
|
||||
protected <URN, KEY extends RecordTemplate, ASPECT extends RecordTemplate> Map<URN, ASPECT> batchGet(
|
||||
@Nonnull BatchGetEntityRequestBuilder<ComplexResourceKey<KEY, EmptyRecord>, ASPECT> requestBuilder,
|
||||
@ -102,7 +102,7 @@ public abstract class BaseClient implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #batchGet(BatchGetEntityRequest)} but takes a @{link BatchGetEntityRequestBuilder} instead
|
||||
* Similar to {@link #batchGet(BatchGetEntityRequest)} but takes a @{link BatchGetEntityRequestBuilder} instead.
|
||||
*/
|
||||
protected <KEY extends RecordTemplate, ASPECT extends RecordTemplate> Map<KEY, ASPECT> batchGet(
|
||||
@Nonnull BatchGetEntityRequestBuilder<ComplexResourceKey<KEY, EmptyRecord>, ASPECT> requestBuilder
|
||||
@ -125,7 +125,7 @@ public abstract class BaseClient implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #getAll(GetAllRequest)} but takes a @{link GetAllRequestBuilderBase} instead
|
||||
* Similar to {@link #getAll(GetAllRequest)} but takes a @{link GetAllRequestBuilderBase} instead.
|
||||
*/
|
||||
protected <K, ASPECT extends RecordTemplate, RB extends GetAllRequestBuilderBase<K, ASPECT, RB>>
|
||||
CollectionResponse<ASPECT> getAll(@Nonnull GetAllRequestBuilderBase<K, ASPECT, RB> requestBuilder)
|
||||
@ -148,7 +148,7 @@ public abstract class BaseClient implements AutoCloseable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #doAction(ActionRequest)} but takes a @{link ActionRequestBuilderBase} instead
|
||||
* Similar to {@link #doAction(ActionRequest)} but takes a @{link ActionRequestBuilderBase} instead.
|
||||
*/
|
||||
protected <K, ASPECT extends RecordTemplate, RB extends ActionRequestBuilderBase<K, ASPECT, RB>>
|
||||
ASPECT doAction(@Nonnull ActionRequestBuilderBase<K, ASPECT, RB> requestBuilder) throws RemoteInvocationException {
|
||||
|
@ -42,7 +42,7 @@ import static com.linkedin.metadata.restli.RestliConstants.*;
|
||||
/**
|
||||
* A base class for the entity rest.li resource, that supports CRUD methods.
|
||||
*
|
||||
* See http://go/gma for more details
|
||||
* <p>See http://go/gma for more details
|
||||
*
|
||||
* @param <KEY> the resource's key type
|
||||
* @param <VALUE> the resource's value type
|
||||
@ -335,7 +335,7 @@ public abstract class BaseEntityResource<
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of {@link VALUE} models given the collection of {@link URN}s and set of aspect classes
|
||||
* Returns a map of {@link VALUE} models given the collection of {@link URN}s and set of aspect classes.
|
||||
*
|
||||
* @param urns collection of urns
|
||||
* @param aspectClasses set of aspect classes
|
||||
|
@ -34,7 +34,7 @@ import static com.linkedin.metadata.restli.RestliConstants.*;
|
||||
/**
|
||||
* A base class for the entity rest.li resource where the key is of a primitive (simple) type.
|
||||
*
|
||||
* See http://go/gma for more details
|
||||
* <p>See http://go/gma for more details
|
||||
*
|
||||
* @param <KEY> the resource's simple key type
|
||||
* @param <VALUE> the resource's value type
|
||||
@ -229,7 +229,7 @@ public abstract class BaseEntitySimpleKeyResource<
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of {@link VALUE} models given the collection of {@link URN}s and set of aspect classes
|
||||
* Returns a map of {@link VALUE} models given the collection of {@link URN}s and set of aspect classes.
|
||||
*
|
||||
* @param urns collection of urns
|
||||
* @param aspectClasses set of aspect classes
|
||||
|
@ -11,8 +11,10 @@ import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* Base client that all entities supporting search should implement in their respective restli MPs
|
||||
* Base client that all entities supporting search should implement in their respective restli MPs.
|
||||
*
|
||||
* @param <VALUE> the client's value type
|
||||
*/
|
||||
public abstract class BaseSearchableClient<VALUE extends RecordTemplate> extends BaseClient {
|
||||
@ -22,7 +24,8 @@ public abstract class BaseSearchableClient<VALUE extends RecordTemplate> extends
|
||||
}
|
||||
|
||||
/**
|
||||
* Search method that the client inheriting this class must implement. Returns {@link CollectionResponse} containing list of aspects
|
||||
* Search method that the client inheriting this class must implement. Returns {@link CollectionResponse} containing
|
||||
* list of aspects.
|
||||
*
|
||||
* @param input Input query
|
||||
* @param aspectNames List of aspects to be returned in the VALUE model
|
||||
@ -34,11 +37,13 @@ public abstract class BaseSearchableClient<VALUE extends RecordTemplate> extends
|
||||
* @throws RemoteInvocationException when the rest.li request fails
|
||||
*/
|
||||
@Nonnull
|
||||
public abstract CollectionResponse<VALUE> search(@Nonnull String input, @Nullable StringArray aspectNames, @Nullable Map<String, String> requestFilters,
|
||||
@Nullable SortCriterion sortCriterion, int start, int count) throws RemoteInvocationException;
|
||||
public abstract CollectionResponse<VALUE> search(@Nonnull String input, @Nullable StringArray aspectNames,
|
||||
@Nullable Map<String, String> requestFilters, @Nullable SortCriterion sortCriterion, int start, int count)
|
||||
throws RemoteInvocationException;
|
||||
|
||||
/**
|
||||
* Similar to {@link #search(String, StringArray, Map, SortCriterion, int, int)} with null for aspect names, meaning all aspects will be returned
|
||||
* Similar to {@link #search(String, StringArray, Map, SortCriterion, int, int)} with null for aspect names, meaning
|
||||
* all aspects will be returned.
|
||||
*/
|
||||
@Nonnull
|
||||
public CollectionResponse<VALUE> search(@Nonnull String input, @Nullable Map<String, String> requestFilters,
|
||||
@ -47,7 +52,7 @@ public abstract class BaseSearchableClient<VALUE extends RecordTemplate> extends
|
||||
}
|
||||
|
||||
/**
|
||||
* Autocomplete method that the client will override only if they need this capability. It returns {@link AutoCompleteResult} containing list of suggestions.
|
||||
* Autocomplete method that the client will override only if they need this capability.
|
||||
*
|
||||
* @param query Input query
|
||||
* @param field Field against which the query needs autocompletion
|
||||
@ -61,5 +66,4 @@ public abstract class BaseSearchableClient<VALUE extends RecordTemplate> extends
|
||||
@Nullable Map<String, String> requestFilters, int limit) throws RemoteInvocationException {
|
||||
throw new UnsupportedOperationException("Not implemented yet.");
|
||||
}
|
||||
|
||||
}
|
@ -33,9 +33,9 @@ import static com.linkedin.metadata.restli.RestliConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
* A base class for the entity rest.li resource that supports CRUD + search methods
|
||||
* A base class for the entity rest.li resource that supports CRUD + search methods.
|
||||
*
|
||||
* See http://go/gma for more details
|
||||
* <p>See http://go/gma for more details
|
||||
*
|
||||
* @param <KEY> the resource's key type
|
||||
* @param <VALUE> the resource's value type
|
||||
|
@ -145,10 +145,11 @@ public abstract class BaseSingleAspectEntitySimpleKeyResource<
|
||||
|
||||
/**
|
||||
* Gets all {@link VALUE} objects from DB for an entity with single aspect
|
||||
* Warning: this works only if the aspect is not shared with other entities.
|
||||
*
|
||||
* It paginates over the latest version of a specific aspect for all Urns
|
||||
* By default the list is sorted in ascending order of urn
|
||||
* <p>Warning: this works only if the aspect is not shared with other entities.
|
||||
*
|
||||
* <p>It paginates over the latest version of a specific aspect for all Urns. By default the list is sorted in
|
||||
* ascending order of urn
|
||||
*
|
||||
* @param pagingContext Paging context.
|
||||
* @return collection of latest resource(s).
|
||||
|
@ -25,8 +25,8 @@ import javax.annotation.Nonnull;
|
||||
* A base resource class for serving a versioned single-aspect entity values as sub resource. This resource class is
|
||||
* meant to be used as a child resource for classes extending from {@link BaseSingleAspectEntitySimpleKeyResource}.
|
||||
*
|
||||
* The key for the sub-resource is typically a version field which is a Long value. The versioned resources
|
||||
* are retrieved using {@link #get(Long)} and {@link #getAllWithMetadata(PagingContext)}.
|
||||
* <p>The key for the sub-resource is typically a version field which is a Long value. The versioned resources are
|
||||
* retrieved using {@link #get(Long)} and {@link #getAllWithMetadata(PagingContext)}.
|
||||
*
|
||||
* @param <VALUE> the resource's value type
|
||||
* @param <URN> must be a valid {@link Urn} type
|
||||
@ -40,7 +40,7 @@ public abstract class BaseSingleAspectEntitySimpleKeyVersionedSubResource<
|
||||
ASPECT extends RecordTemplate,
|
||||
ASPECT_UNION extends UnionTemplate>
|
||||
extends CollectionResourceTaskTemplate<Long, VALUE> {
|
||||
// @formatter:on
|
||||
// @formatter:on
|
||||
|
||||
private final Class<ASPECT> _aspectClass;
|
||||
private final Class<VALUE> _valueClass;
|
||||
|
@ -18,7 +18,7 @@ import static com.linkedin.metadata.dao.BaseReadDAO.*;
|
||||
/**
|
||||
* A base class for the single aspect entity rest.li resource that supports CRUD + search methods.
|
||||
*
|
||||
* See http://go/gma for more details
|
||||
* <p>See http://go/gma for more details.
|
||||
*
|
||||
* @param <KEY> the resource's key type
|
||||
* @param <VALUE> the resource's value type
|
||||
|
@ -31,7 +31,7 @@ import static com.linkedin.metadata.dao.BaseReadDAO.*;
|
||||
/**
|
||||
* A base class for an aspect rest.li subresource with versioning support.
|
||||
*
|
||||
* See http://go/gma for more details
|
||||
* <p>See http://go/gma for more details
|
||||
*
|
||||
* @param <URN> must be a valid {@link Urn} type
|
||||
* @param <ASPECT_UNION> must be a valid union of aspect models defined in com.linkedin.metadata.aspect
|
||||
@ -112,7 +112,7 @@ public abstract class BaseVersionedAspectResource<URN extends Urn, ASPECT_UNION
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #create(RecordTemplate)} but uses a create lambda instead
|
||||
* Similar to {@link #create(RecordTemplate)} but uses a create lambda instead.
|
||||
*/
|
||||
@Nonnull
|
||||
public Task<CreateResponse> create(@Nonnull Class<ASPECT> aspectClass,
|
||||
@ -126,7 +126,8 @@ public abstract class BaseVersionedAspectResource<URN extends Urn, ASPECT_UNION
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to {@link #create(Class, Function)} but returns {@link CreateKVResponse} containing latest version and created aspect
|
||||
* Similar to {@link #create(Class, Function)} but returns {@link CreateKVResponse} containing latest version and
|
||||
* created aspect.
|
||||
*/
|
||||
@RestMethod.Create
|
||||
@ReturnEntity
|
||||
@ -142,7 +143,7 @@ public abstract class BaseVersionedAspectResource<URN extends Urn, ASPECT_UNION
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates using the provided default value only if the aspect is not set already
|
||||
* Creates using the provided default value only if the aspect is not set already.
|
||||
*
|
||||
* @param defaultValue provided default value
|
||||
* @return {@link CreateKVResponse} containing lastest version and created aspect
|
||||
|
@ -10,7 +10,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* Interface which all entities supporting browse should implement in their respective restli MPs
|
||||
* Interface which all entities supporting browse should implement in their respective restli MPs.
|
||||
*
|
||||
* @deprecated Use {@link BaseBrowsableClient} instead
|
||||
*/
|
||||
|
@ -11,9 +11,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* Interface that all entities that support search and autocomplete should implement in their respective restli MPs
|
||||
* @param <VALUE> the client's value type
|
||||
* Interface that all entities that support search and autocomplete should implement in their respective restli MPs.
|
||||
*
|
||||
* @param <VALUE> the client's value type.
|
||||
* @deprecated Use {@link BaseSearchableClient} instead
|
||||
*/
|
||||
public interface SearchableClient<VALUE extends RecordTemplate> {
|
||||
|
@ -81,7 +81,7 @@ public class TestUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all test entity classes
|
||||
* Returns all test entity classes.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Set<Class<? extends RecordTemplate>> getAllTestEntities() {
|
||||
@ -95,7 +95,7 @@ public class TestUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all test relationship classes
|
||||
* Returns all test relationship classes.
|
||||
*/
|
||||
@Nonnull
|
||||
public static Set<Class<? extends RecordTemplate>> getAllTestRelationships() {
|
||||
|
@ -9,7 +9,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class AspectValidator {
|
||||
/**
|
||||
* Utility class to validate aspects are part of the union schemas.
|
||||
*/
|
||||
public final class AspectValidator {
|
||||
|
||||
// A cache of validated classes
|
||||
private static final Set<Class<? extends UnionTemplate>> VALIDATED = ConcurrentHashMap.newKeySet();
|
||||
|
@ -8,7 +8,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class DeltaValidator {
|
||||
/**
|
||||
* Utility class to validate delta event schemas.
|
||||
*/
|
||||
public final class DeltaValidator {
|
||||
|
||||
// A cache of validated classes
|
||||
private static final Set<Class<? extends RecordTemplate>> VALIDATED = ConcurrentHashMap.newKeySet();
|
||||
|
@ -9,7 +9,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class DocumentValidator {
|
||||
/**
|
||||
* Utility class to validate search document schemas.
|
||||
*/
|
||||
public final class DocumentValidator {
|
||||
|
||||
// Allowed non-optional fields. All other fields must be optional.
|
||||
private static final Set<String> NON_OPTIONAL_FIELDS = Collections.unmodifiableSet(new HashSet<String>() {
|
||||
|
@ -9,7 +9,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class EntityValidator {
|
||||
/**
|
||||
* Utility class to validate entity schemas.
|
||||
*/
|
||||
public final class EntityValidator {
|
||||
|
||||
// Allowed non-optional fields. All other fields must be optional.
|
||||
private static final Set<String> NON_OPTIONAL_FIELDS = Collections.unmodifiableSet(new HashSet<String>() {
|
||||
@ -61,7 +64,7 @@ public class EntityValidator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an entity schema is valid
|
||||
* Checks if an entity schema is valid.
|
||||
*/
|
||||
public static boolean isValidEntitySchema(@Nonnull Class<? extends RecordTemplate> clazz) {
|
||||
if (!VALIDATED.contains(clazz)) {
|
||||
|
@ -56,9 +56,9 @@ public class SnapshotValidator {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that the URN class is unique across all snapshots
|
||||
* Validates that the URN class is unique across all snapshots.
|
||||
*
|
||||
* @param classes a collection of snapshot classes.
|
||||
* @param snapshotClasses a collection of snapshot classes.
|
||||
*/
|
||||
public static void validateUniqueUrn(@Nonnull Collection<? extends Class> snapshotClasses) {
|
||||
Set<Class> urnClasses = new HashSet<>();
|
||||
|
@ -18,7 +18,10 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class ValidationUtils {
|
||||
/**
|
||||
* Utility class for schema validation classes.
|
||||
*/
|
||||
public final class ValidationUtils {
|
||||
|
||||
public static final Set<DataSchema.Type> PRIMITIVE_TYPES =
|
||||
Collections.unmodifiableSet(new HashSet<DataSchema.Type>() {
|
||||
@ -90,7 +93,7 @@ public class ValidationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Java class for an URN typeref field
|
||||
* Returns the Java class for an URN typeref field.
|
||||
*/
|
||||
public static Class getUrnClass(@Nonnull RecordDataSchema.Field field) {
|
||||
try {
|
||||
@ -108,7 +111,7 @@ public class ValidationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the non-whitelisted, non-optional fields in a {@link RecordDataSchema}
|
||||
* Returns all the non-whitelisted, non-optional fields in a {@link RecordDataSchema}.
|
||||
*/
|
||||
@Nonnull
|
||||
public static List<RecordDataSchema.Field> nonOptionalFields(@Nonnull RecordDataSchema schema,
|
||||
@ -124,7 +127,7 @@ public class ValidationUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the non-whitelisted, optional fields in a {@link RecordDataSchema}
|
||||
* Returns all the non-whitelisted, optional fields in a {@link RecordDataSchema}.
|
||||
*/
|
||||
@Nonnull
|
||||
public static List<RecordDataSchema.Field> optionalFields(@Nonnull RecordDataSchema schema,
|
||||
|
Loading…
x
Reference in New Issue
Block a user