private void addSubType(AtlasEntityType subType) { subTypes.add(subType.getTypeName()); }
private void addToAllSubTypes(AtlasEntityType subType) { allSubTypes.add(subType.getTypeName()); typeAndAllSubTypes.add(subType.getTypeName()); }
public boolean isSuperTypeOf(AtlasEntityType entityType) { return entityType != null && allSubTypes.contains(entityType.getTypeName()); }
private void addSubType(AtlasEntityType subType) { allSubTypes.add(subType.getTypeName()); typeAndAllSubTypes.add(subType.getTypeName()); }
public boolean isSubTypeOf(AtlasEntityType entityType) { return entityType != null && allSuperTypes.contains(entityType.getTypeName()); }
/** * Check whether the supplied entityType can be applied to this classification. * * @param entityType * @return whether can apply */ public boolean canApplyToEntityType(AtlasEntityType entityType) { return CollectionUtils.isEmpty(this.entityTypes) || this.entityTypes.contains(entityType.getTypeName()); }
public AtlasEntityType(AtlasEntityDef entityDef) { super(entityDef); this.entityDef = entityDef; this.typeQryStr = AtlasAttribute.escapeIndexQueryValue(Collections.singleton(getTypeName())); }
@Override public AtlasType getTypeForAttribute() { AtlasType attributeType = new AtlasObjectIdType(getTypeName()); if (LOG.isDebugEnabled()) { LOG.debug("getTypeForAttribute(): {} ==> {}", getTypeName(), attributeType.getTypeName()); } return attributeType; }
@Override public AtlasType getTypeForAttribute() { AtlasType attributeType = new AtlasObjectIdType(getTypeName()); if (LOG.isDebugEnabled()) { LOG.debug("getTypeForAttribute(): {} ==> {}", getTypeName(), attributeType.getTypeName()); } return attributeType; }
private void addEntityType(AtlasEntityType entityType, ExportContext context) { if (!context.entityTypes.contains(entityType.getTypeName())) { context.entityTypes.add(entityType.getTypeName()); addAttributeTypes(entityType, context); if (CollectionUtils.isNotEmpty(entityType.getAllSuperTypes())) { for (String superType : entityType.getAllSuperTypes()) { addEntityType(superType, context); } } } }
public static AtlasVertex getVertexByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> attrValues) throws AtlasBaseException { AtlasVertex vertex = findByUniqueAttributes(entityType, attrValues); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND, entityType.getTypeName(), attrValues.toString()); } return vertex; }
public static AtlasVertex getVertexByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> attrValues) throws AtlasBaseException { AtlasVertex vertex = findByUniqueAttributes(entityType, attrValues); if (vertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND, entityType.getTypeName(), attrValues.toString()); } return vertex; }
public AtlasEntityType(AtlasEntityDef entityDef, AtlasTypeRegistry typeRegistry) throws AtlasBaseException { super(entityDef); this.entityDef = entityDef; this.typeQryStr = AtlasAttribute.escapeIndexQueryValue(Collections.singleton(getTypeName())); resolveReferences(typeRegistry); }
private void addEntityType(AtlasEntityType entityType, ExportService.ExportContext context) { if (!context.entityTypes.contains(entityType.getTypeName())) { context.entityTypes.add(entityType.getTypeName()); addAttributeTypes(entityType, context); addRelationshipTypes(entityType, context); if (CollectionUtils.isNotEmpty(entityType.getAllSuperTypes())) { for (String superType : entityType.getAllSuperTypes()) { addEntityType(superType, context); } } } }
boolean isAssignableFrom(AtlasObjectId objId) { boolean ret = AtlasTypeUtil.isValid(objId) && (StringUtils.equals(objId.getTypeName(), getTypeName()) || isSuperTypeOf(objId.getTypeName())); return ret; } }
boolean isAssignableFrom(AtlasObjectId objId) { boolean ret = AtlasTypeUtil.isValid(objId) && (StringUtils.equals(objId.getTypeName(), getTypeName()) || isSuperTypeOf(objId.getTypeName())); return ret; }
@Test public void testEntityTypeDefaultValue() { AtlasEntity defValue = entityType.createDefaultValue(); assertNotNull(defValue); assertEquals(defValue.getTypeName(), entityType.getTypeName()); }
@Test public void testEntityTypeDefaultValue() { AtlasEntity defValue = entityType.createDefaultValue(); assertNotNull(defValue); assertEquals(defValue.getTypeName(), entityType.getTypeName()); }
private AtlasVertex getGlossaryTermVertex(String termName) { AtlasVertex ret = null; if (StringUtils.isNotEmpty(termName)) { AtlasEntityType termType = getTermEntityType(); AtlasAttribute attrName = termType.getAttribute(TermSearchProcessor.ATLAS_GLOSSARY_TERM_ATTR_QNAME); AtlasGraphQuery query = graph.query().has(Constants.ENTITY_TYPE_PROPERTY_KEY, termType.getTypeName()) .has(attrName.getVertexPropertyName(), termName) .has(Constants.STATE_PROPERTY_KEY, AtlasEntity.Status.ACTIVE.name()); Iterator<AtlasVertex> results = query.vertices().iterator(); ret = results.hasNext() ? results.next() : null; } return ret; }
private String[] setupUpdater(String entityHeaderFileName, String entityFileName, int expectedSummaryLength) throws IOException { AtlasEntityHeaders entityHeaderMap = getEntityHeaderMapFromFile(entityHeaderFileName); AtlasEntityType hiveTable = mock(AtlasEntityType.class); AtlasEntityStore entitiesStore = mock(AtlasEntityStore.class); AtlasTypeRegistry typeRegistry = mock(AtlasTypeRegistry.class); when(typeRegistry.getEntityTypeByName(anyString())).thenReturn(hiveTable); when(hiveTable.getTypeName()).thenReturn("hive_column"); ClassificationAssociatorUpdaterForSpy updater = new ClassificationAssociatorUpdaterForSpy(typeRegistry, entitiesStore, entityFileName); String summary = updater.setClassifications(entityHeaderMap.getGuidHeaderMap()); TypeReference<String[]> typeReference = new TypeReference<String[]>() {}; String[] summaryArray = AtlasJson.fromJson(summary, typeReference); assertEquals(summaryArray.length, expectedSummaryLength); return summaryArray; }