private void addToAllSubTypes(AtlasClassificationType subType) { allSubTypes.add(subType.getTypeName()); typeAndAllSubTypes.add(subType.getTypeName()); }
private void addSubType(AtlasClassificationType subType) { allSubTypes.add(subType.getTypeName()); typeAndAllSubTypes.add(subType.getTypeName()); }
private void addSubType(AtlasClassificationType subType) { subTypes.add(subType.getTypeName()); }
public boolean isSuperTypeOf(AtlasClassificationType classificationType) { return classificationType != null && allSubTypes.contains(classificationType.getTypeName()); }
public boolean isSubTypeOf(AtlasClassificationType classificationType) { return classificationType != null && allSuperTypes.contains(classificationType.getTypeName()); }
public boolean isSubTypeOf(AtlasClassificationType classificationType) { return classificationType != null && allSuperTypes.contains(classificationType.getTypeName()); }
public boolean isSuperTypeOf(AtlasClassificationType classificationType) { return classificationType != null && allSubTypes.contains(classificationType.getTypeName()); }
private AtlasClassificationType getClassificationType(String classificationName) { AtlasClassificationType ret; if (StringUtils.equals(classificationName, MATCH_ALL_WILDCARD_CLASSIFICATION.getTypeName())) { ret = MATCH_ALL_WILDCARD_CLASSIFICATION; } else if (StringUtils.equals(classificationName, MATCH_ALL_CLASSIFIED.getTypeName())) { ret = MATCH_ALL_CLASSIFIED; } else if (StringUtils.equals(classificationName, MATCH_ALL_NOT_CLASSIFIED.getTypeName())) { ret = MATCH_ALL_NOT_CLASSIFIED; } else { ret = typeRegistry.getClassificationTypeByName(classificationName); } return ret; }
/** * Note this constructor does NOT run resolveReferences - so some fields are not setup. * @param classificationDef */ public AtlasClassificationType(AtlasClassificationDef classificationDef) { super(classificationDef); this.classificationDef = classificationDef; this.typeQryStr = AtlasAttribute.escapeIndexQueryValue(Collections.singleton(getTypeName())); }
private void addClassificationType(AtlasClassificationType classificationType, ExportContext context) { if (!context.classificationTypes.contains(classificationType.getTypeName())) { context.classificationTypes.add(classificationType.getTypeName()); addAttributeTypes(classificationType, context); if (CollectionUtils.isNotEmpty(classificationType.getAllSuperTypes())) { for (String superType : classificationType.getAllSuperTypes()) { addClassificationType(superType, context); } } } }
private void addClassificationType(AtlasClassificationType classificationType, ExportService.ExportContext context) { if (!context.classificationTypes.contains(classificationType.getTypeName())) { context.classificationTypes.add(classificationType.getTypeName()); addAttributeTypes(classificationType, context); if (CollectionUtils.isNotEmpty(classificationType.getAllSuperTypes())) { for (String superType : classificationType.getAllSuperTypes()) { addClassificationType(superType, context); } } } }
/** * ClassificationType needs to be constructed with a type registry so that is can resolve references * at constructor time. This is only used by junits. * * @param classificationDef * @param typeRegistry * @throws AtlasBaseException */ public AtlasClassificationType(AtlasClassificationDef classificationDef, AtlasTypeRegistry typeRegistry) throws AtlasBaseException { super(classificationDef); this.classificationDef = classificationDef; this.typeQryStr = AtlasAttribute.escapeIndexQueryValue(Collections.singleton(getTypeName())); resolveReferences(typeRegistry); }
@Override void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException { super.resolveReferences(typeRegistry); List<AtlasClassificationType> s = new ArrayList<>(); Set<String> allS = new HashSet<>(); Map<String, AtlasAttribute> allA = new HashMap<>(); getTypeHierarchyInfo(typeRegistry, allS, allA); for (String superTypeName : classificationDef.getSuperTypes()) { AtlasType superType = typeRegistry.getType(superTypeName); if (superType instanceof AtlasClassificationType) { s.add((AtlasClassificationType)superType); } else { throw new AtlasBaseException(AtlasErrorCode.INCOMPATIBLE_SUPERTYPE, superTypeName, classificationDef.getName()); } } this.superTypes = Collections.unmodifiableList(s); this.allSuperTypes = Collections.unmodifiableSet(allS); this.allAttributes = Collections.unmodifiableMap(allA); this.uniqAttributes = getUniqueAttributes(this.allAttributes); this.subTypes = new HashSet<>(); // this will be populated in resolveReferencesPhase2() this.allSubTypes = new HashSet<>(); // this will be populated in resolveReferencesPhase2() this.typeAndAllSubTypes = new HashSet<>(); // this will be populated in resolveReferencesPhase2() this.entityTypes = new HashSet<>(); // this will be populated in resolveReferencesPhase3() this.typeAndAllSubTypes.add(this.getTypeName()); this.typeAndAllSuperTypes = new HashSet<>(this.allSuperTypes); this.typeAndAllSuperTypes.add(this.getTypeName()); this.typeAndAllSuperTypes = Collections.unmodifiableSet(this.typeAndAllSuperTypes); }
@Override public void resolveReferences(AtlasTypeRegistry typeRegistry) throws AtlasBaseException { super.resolveReferences(typeRegistry); List<AtlasClassificationType> s = new ArrayList<>(); Set<String> allS = new HashSet<>(); Map<String, AtlasAttribute> allA = new HashMap<>(); getTypeHierarchyInfo(typeRegistry, allS, allA); for (String superTypeName : classificationDef.getSuperTypes()) { AtlasType superType = typeRegistry.getType(superTypeName); if (superType instanceof AtlasClassificationType) { s.add((AtlasClassificationType)superType); } else { throw new AtlasBaseException(AtlasErrorCode.INCOMPATIBLE_SUPERTYPE, superTypeName, classificationDef.getName()); } } this.superTypes = Collections.unmodifiableList(s); this.allSuperTypes = Collections.unmodifiableSet(allS); this.allAttributes = Collections.unmodifiableMap(allA); this.uniqAttributes = getUniqueAttributes(this.allAttributes); this.allSubTypes = new HashSet<>(); // this will be populated in resolveReferencesPhase2() this.typeAndAllSubTypes = new HashSet<>(); // this will be populated in resolveReferencesPhase2() this.typeAndAllSubTypes.add(this.getTypeName()); }
@Test public void testClassificationTypeDefaultValue() { AtlasClassification defValue = classificationType.createDefaultValue(); assertNotNull(defValue); assertEquals(defValue.getTypeName(), classificationType.getTypeName()); }
public FullTextSearchProcessor(SearchContext context) { super(context); SearchParameters searchParameters = context.getSearchParameters(); StringBuilder queryString = new StringBuilder(); queryString.append("v.\"").append(Constants.ENTITY_TEXT_PROPERTY_KEY).append("\":(").append(searchParameters.getQuery()); // if search includes entity-type criteria, adding a filter here can help avoid unnecessary // processing (and rejection) by subsequent EntitySearchProcessor if (context.getEntityType() != null) { String typeAndSubTypeNamesQryStr = context.getEntityType().getTypeAndAllSubTypesQryStr(); if (typeAndSubTypeNamesQryStr.length() <= MAX_QUERY_STR_LENGTH_TYPES) { queryString.append(AND_STR).append(typeAndSubTypeNamesQryStr); } else { LOG.warn("'{}' has too many subtypes (query-string-length={}) to include in index-query; might cause poor performance", context.getEntityType().getTypeName(), typeAndSubTypeNamesQryStr.length()); } } // if search includes classification criteria, adding a filter here can help avoid unnecessary // processing (and rejection) by subsequent ClassificationSearchProcessor or EntitySearchProcessor if (context.getClassificationType() != null) { String typeAndSubTypeNamesStr = context.getClassificationType().getTypeAndAllSubTypesQryStr(); if (typeAndSubTypeNamesStr.length() <= MAX_QUERY_STR_LENGTH_TAGS) { queryString.append(AND_STR).append(typeAndSubTypeNamesStr); } else { LOG.warn("'{}' has too many subtypes (query-string-length={}) to include in index-query; might cause poor performance", context.getClassificationType().getTypeName(), typeAndSubTypeNamesStr.length()); } } queryString.append(")"); indexQuery = context.getGraph().indexQuery(Constants.FULLTEXT_INDEX, queryString.toString()); }
@Test public void testClassificationTypeDefaultValue() { AtlasClassification defValue = classificationType.createDefaultValue(); assertNotNull(defValue); assertEquals(defValue.getTypeName(), classificationType.getTypeName()); }
} else { LOG.warn("'{}' has too many subtypes (query-string-length={}) to include in index-query; might cause poor performance", context.getClassificationType().getTypeName(), typeAndSubTypeNamesStr.length());
typeAndSubTypesQryStr = classificationType.getTypeAndAllSubTypesQryStr(); } else { typeAndSubTypes = Collections.singleton(classificationType.getTypeName()); typeAndSubTypesQryStr = classificationType.getTypeQryStr();
classificationTypeAndSubTypes = classificationType.getTypeAndAllSubTypes(); } else { classificationTypeAndSubTypes = Collections.singleton(classificationType.getTypeName());