entity.setSuperTypes(superTypes); entity.setAttributeDefs(attributes); });
public AtlasEntityDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs, Set<String> superTypes, Map<String, String> options) { super(TypeCategory.ENTITY, name, description, typeVersion, attributeDefs, options); setSuperTypes(superTypes); }
public AtlasEntityDef(String name, String description, String typeVersion, List<AtlasAttributeDef> attributeDefs, Set<String> superTypes, Map<String, String> options) { super(TypeCategory.ENTITY, name, description, typeVersion, attributeDefs, options); setSuperTypes(superTypes); }
public AtlasEntityDef(AtlasEntityDef other) { super(other); setSuperTypes(other != null ? other.getSuperTypes() : null); }
public AtlasEntityDef(AtlasEntityDef other) { super(other); setSuperTypes(other != null ? other.getSuperTypes() : null); }
entity.setSuperTypes(superTypes); entity.setAttributeDefs(attributes); });
private AtlasEntityDef toEntityDef(AtlasVertex vertex) throws AtlasBaseException { AtlasEntityDef ret = null; if (vertex != null && typeDefStore.isTypeVertex(vertex, TypeCategory.CLASS)) { ret = new AtlasEntityDef(); AtlasStructDefStoreV2.toStructDef(vertex, ret, typeDefStore); ret.setSuperTypes(typeDefStore.getSuperTypeNames(vertex)); } return ret; } }
private AtlasEntityDef toEntityDef(AtlasVertex vertex) throws AtlasBaseException { AtlasEntityDef ret = null; if (vertex != null && typeDefStore.isTypeVertex(vertex, TypeCategory.CLASS)) { ret = new AtlasEntityDef(); AtlasStructDefStoreV2.toStructDef(vertex, ret, typeDefStore); ret.setSuperTypes(typeDefStore.getSuperTypeNames(vertex)); } return ret; } }
@Test public void testEntityDefSetSuperTypes() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes(); Set<String> oldSuperTypes = entityDef.getSuperTypes(); Set<String> newSuperTypes = new HashSet<>(); newSuperTypes.add("newType-abcd-1234"); entityDef.setSuperTypes(newSuperTypes); for (String superType : oldSuperTypes) { assertFalse(entityDef.hasSuperType(superType)); } for (String superType : newSuperTypes) { assertTrue(entityDef.hasSuperType(superType)); } // restore old sypertypes entityDef.setSuperTypes(oldSuperTypes); }
@Test public void testEntityDefSetSuperTypes() { AtlasEntityDef entityDef = ModelTestUtil.newEntityDefWithSuperTypes(); Set<String> oldSuperTypes = entityDef.getSuperTypes(); Set<String> newSuperTypes = new HashSet<>(); newSuperTypes.add("newType-abcd-1234"); entityDef.setSuperTypes(newSuperTypes); for (String superType : oldSuperTypes) { assertFalse(entityDef.hasSuperType(superType)); } for (String superType : newSuperTypes) { assertTrue(entityDef.hasSuperType(superType)); } // restore old sypertypes entityDef.setSuperTypes(oldSuperTypes); }