package com.linkedin.metadata.models; import com.linkedin.data.schema.RecordDataSchema; import com.linkedin.data.schema.TyperefDataSchema; import com.linkedin.metadata.models.annotation.EntityAnnotation; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * A specification of a DataHub Entity */ public interface EntitySpec { String getName(); EntityAnnotation getEntityAnnotation(); String getKeyAspectName(); AspectSpec getKeyAspectSpec(); List getAspectSpecs(); Map getAspectSpecMap(); Boolean hasAspect(String name); AspectSpec getAspectSpec(String name); RecordDataSchema getSnapshotSchema(); TyperefDataSchema getAspectTyperefSchema(); default List getSearchableFieldSpecs() { return getAspectSpecs().stream() .map(AspectSpec::getSearchableFieldSpecs) .flatMap(List::stream) .collect(Collectors.toList()); } default List getSearchScoreFieldSpecs() { return getAspectSpecs().stream() .map(AspectSpec::getSearchScoreFieldSpecs) .flatMap(List::stream) .collect(Collectors.toList()); } default List getRelationshipFieldSpecs() { return getAspectSpecs().stream() .map(AspectSpec::getRelationshipFieldSpecs) .flatMap(List::stream) .collect(Collectors.toList()); } }