@Override public AtlasType getType(String typeName) throws AtlasBaseException { AtlasType ret; if (typeName.equalsIgnoreCase(ALL_CLASSIFICATIONS)) { ret = MATCH_ALL_CLASSIFIED; } else if (typeName.equalsIgnoreCase(NO_CLASSIFICATIONS)) { ret = MATCH_ALL_NOT_CLASSIFIED; } else { ret = typeRegistry.getType(typeName); } return ret; }
private AtlasStructType getStructType(String typeName) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(typeName); if (!(objType instanceof AtlasStructType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, typeName); } return (AtlasStructType)objType; }
private static boolean isDataSet(String typeName, AtlasTypeRegistry registry) throws AtlasBaseException { boolean ret = false; AtlasType type = registry.getType(typeName); if (type instanceof AtlasEntityType) { AtlasEntityType entityType = (AtlasEntityType) type; ret = entityType.getAllSuperTypes().contains(AtlasBaseTypeDef.ATLAS_TYPE_DATASET); } return ret; }
private void addType(String typeName, ExportService.ExportContext context) { AtlasType type = null; try { type = typeRegistry.getType(typeName); addType(type, context); } catch (AtlasBaseException excp) { LOG.error("unknown type {}", typeName); } }
@Override public AtlasBaseTypeDef getByName(String name) throws AtlasBaseException { if (StringUtils.isBlank(name)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, "", name); } AtlasType type = typeRegistry.getType(name); return getTypeDefFromType(type); }
private AtlasEntityType getEntityType(String typeName) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(typeName); if (!(objType instanceof AtlasEntityType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, typeName); } return (AtlasEntityType)objType; }
private AtlasEntityType getEntityType(String typeName) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(typeName); if (!(objType instanceof AtlasEntityType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, typeName); } return (AtlasEntityType)objType; }
private AtlasStructType getStructType(String typeName) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(typeName); if (!(objType instanceof AtlasStructType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, typeName); } return (AtlasStructType)objType; }
private AtlasEntity fromV1toV2Entity(Referenceable referenceable, AtlasFormatConverter.ConverterContext context) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> fromV1toV2Entity({})", referenceable); } AtlasEntityFormatConverter converter = (AtlasEntityFormatConverter) instanceFormatters.getConverter(TypeCategory.ENTITY); AtlasEntity entity = converter.fromV1ToV2(referenceable, typeRegistry.getType(referenceable.getTypeName()), context); if (LOG.isDebugEnabled()) { LOG.debug("<== fromV1toV2Entity({}): {}", referenceable, entity); } return entity; }
@Override public AtlasBaseTypeDef getByName(String name) throws AtlasBaseException { if (StringUtils.isBlank(name)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, "", name); } AtlasType type = typeRegistry.getType(name); return getTypeDefFromType(type); }
@Test public void checkTypeRegistered() throws AtlasBaseException { AtlasType auditEntryType = typeRegistry.getType("__" + ExportImportAuditEntry.class.getSimpleName()); assertNotNull(auditEntryType); }
private String getVertexPropertyName(AtlasEntity entity, String attributeName) throws AtlasBaseException { AtlasEntityType type = (AtlasEntityType) typeRegistry.getType(entity.getTypeName()); AtlasStructType.AtlasAttribute attribute = type.getAttribute(attributeName); return attribute.getVertexPropertyName(); } }
public Referenceable getReferenceable(AtlasEntity entity, final ConverterContext ctx) throws AtlasBaseException { AtlasFormatConverter converter = instanceFormatters.getConverter(TypeCategory.ENTITY); AtlasType entityType = typeRegistry.getType(entity.getTypeName()); Referenceable ref = (Referenceable) converter.fromV2ToV1(entity, entityType, ctx); return ref; }
public Struct getTrait(AtlasClassification classification) throws AtlasBaseException { AtlasFormatConverter converter = instanceFormatters.getConverter(TypeCategory.CLASSIFICATION); AtlasType classificationType = typeRegistry.getType(classification.getTypeName()); Struct trait = (Struct)converter.fromV2ToV1(classification, classificationType, new ConverterContext()); return trait; }
protected AtlasAttribute getAttributeForEdge(String edgeLabel) throws AtlasBaseException { AtlasEdgeLabel atlasEdgeLabel = new AtlasEdgeLabel(edgeLabel); AtlasType parentType = typeRegistry.getType(atlasEdgeLabel.getTypeName()); AtlasStructType parentStructType = (AtlasStructType) parentType; return parentStructType.getAttribute(atlasEdgeLabel.getAttributeName()); }
private void mapAttributes(AtlasVertex entityVertex, AtlasStruct struct, AtlasEntityExtInfo entityExtInfo, boolean isMinExtInfo) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(struct.getTypeName()); if (!(objType instanceof AtlasStructType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, struct.getTypeName()); } AtlasStructType structType = (AtlasStructType) objType; for (AtlasAttribute attribute : structType.getAllAttributes().values()) { Object attrValue = mapVertexToAttribute(entityVertex, attribute, entityExtInfo, isMinExtInfo); struct.setAttribute(attribute.getName(), attrValue); } }
private AtlasEntity getDefaultTableEntity(String name) throws AtlasBaseException { AtlasEntityType type = (AtlasEntityType) typeRegistry.getType(TYPE_RDBMS_TABLES); AtlasEntity ret = type.createDefaultValue(); ret.setAttribute("name", name); return ret; }
private void mapAttributes(AtlasVertex entityVertex, AtlasStruct struct, AtlasEntityExtInfo entityExtInfo, boolean isMinExtInfo) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(struct.getTypeName()); if (!(objType instanceof AtlasStructType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, struct.getTypeName()); } AtlasStructType structType = (AtlasStructType) objType; for (AtlasAttribute attribute : structType.getAllAttributes().values()) { Object attrValue = mapVertexToAttribute(entityVertex, attribute, entityExtInfo, isMinExtInfo); struct.setAttribute(attribute.getName(), attrValue); } }
@BeforeClass public void setup() throws IOException, AtlasBaseException { basicSetup(typeDefStore, typeRegistry); createEntities(entityStore, ENTITIES_SUB_DIR, new String[]{"db", "table-columns"}); AtlasType refType = typeRegistry.getType("Referenceable"); AtlasEntityDef entityDef = (AtlasEntityDef) typeDefStore.getByName(refType.getTypeName()); assertNotNull(entityDef); }