public AttributeInfo(TypeSystem t, AttributeDefinition def, Map<String, IDataType> tempTypes) throws AtlasException { this.name = def.name; this.dataType = (tempTypes != null && tempTypes.containsKey(def.dataTypeName)) ? tempTypes.get(def.dataTypeName) : t.getDataType(IDataType.class, def.dataTypeName); this.multiplicity = def.multiplicity; this.isComposite = def.isComposite; this.isUnique = def.isUnique; this.isIndexable = def.isIndexable; this.reverseAttributeName = def.reverseAttributeName; this.isSoftRef = def.isSoftRef; }
private IDataType dataType(String name) throws AtlasException { if (transientTypes.containsKey(name)) { return transientTypes.get(name); } return TypeSystem.this.getDataType(IDataType.class, name); }
/** * Given type must be a SubType of this type. * @param typeName * @throws AtlasException */ public boolean isSubType(String typeName) throws AtlasException { HierarchicalType cType = typeSystem.getDataType(HierarchicalType.class, typeName); return (cType == this || cType.superTypePaths.containsKey(getName())); }
public <T extends IDataType> T getDataType(Class<T> cls, String name) throws AtlasException { try { IDataType dt = getDataType(name); return cls.cast(dt); } catch (ClassCastException cce) { throw new AtlasException(cce); } }
public TraitType defineTraitType(HierarchicalTypeDefinition<TraitType> traitDef) throws AtlasException { defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(), ImmutableList.of(traitDef), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of()); return getDataType(TraitType.class, traitDef.typeName); }
@Override protected int getNumberOfFields(TypeSystem ts, String typeName) throws Exception { return ts.getDataType(HierarchicalType.class, typeName).numFields; } }
public ClassType defineClassType(HierarchicalTypeDefinition<ClassType> classDef) throws AtlasException { defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.of(classDef)); return getDataType(ClassType.class, classDef.typeName); }
public ClassType defineClassType(HierarchicalTypeDefinition<ClassType> classDef) throws AtlasException { defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.of(classDef)); return getDataType(ClassType.class, classDef.typeName); }
@Override protected int getNumberOfFields(TypeSystem ts, String typeName) throws Exception { return ts.getDataType(HierarchicalType.class, typeName).numFields; } }
public TraitType defineTraitType(HierarchicalTypeDefinition<TraitType> traitDef) throws AtlasException { defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(), ImmutableList.of(traitDef), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of()); return getDataType(TraitType.class, traitDef.typeName); }
/** * Given type must be a SubType of this type. * @param typeName * @throws AtlasException */ public boolean isSubType(String typeName) throws AtlasException { HierarchicalType cType = typeSystem.getDataType(HierarchicalType.class, typeName); return (cType == this || cType.superTypePaths.containsKey(getName())); }
public StructType defineStructType(String name, String description, boolean errorIfExists, AttributeDefinition... attrDefs) throws AtlasException { StructTypeDefinition structDef = new StructTypeDefinition(name, description, attrDefs); defineTypes(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.of(structDef), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of()); return getDataType(StructType.class, structDef.typeName); }
public ST getDefinedType(String attrName) throws AtlasException { if (!attributeNameToType.containsKey(attrName)) { throw new AtlasException(String.format("Unknown attribute %s in type %s", attrName, getName())); } return typeSystem.getDataType(superTypeClass, attributeNameToType.get(attrName)); }
public void recordEntityDelete(String entityId, String typeName) throws AtlasException { ClassType type = typeSystem.getDataType(ClassType.class, typeName); ITypedReferenceableInstance entity = type.createInstance(new Id(entityId, 0, typeName)); if (deletedEntityIds.add(entityId)) { deletedEntities.add(entity); } }
protected HierarchicalType createDataType(String type) { try { return TypeSystem.getInstance().getDataType(HierarchicalType.class, type); } catch (AtlasException e) { throw new CatalogRuntimeException("Unable to get type instance from type system for type: " + type, e); } }
@Override public String getSignatureHash(MessageDigest digester) throws AtlasException { ClassType classType = TypeSystem.getInstance().getDataType(ClassType.class, getTypeName()); classType.updateSignatureHash(digester, this); byte[] digest = digester.digest(); return SHA256Utils.toString(digest); } }
@Override public String getSignatureHash(MessageDigest digester) throws AtlasException { StructType structType = TypeSystem.getInstance().getDataType(StructType.class, getTypeName()); structType.updateSignatureHash(digester, this); byte[] digest = digester.digest(); return SHA256Utils.toString(digest); }
@Override public String getSignatureHash(MessageDigest digester) throws AtlasException { StructType structType = TypeSystem.getInstance().getDataType(StructType.class, getTypeName()); structType.updateSignatureHash(digester, this); byte[] digest = digester.digest(); return SHA256Utils.toString(digest); }
@BeforeMethod public void setup() throws Exception { super.setup(); structType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_1); recursiveStructType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_2); invalidStructType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_3); }
@BeforeMethod public void setup() throws Exception { super.setup(); structType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_1); recursiveStructType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_2); invalidStructType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_3); }