public static AtlasEntityDef newEntityDef(AtlasTypeRegistry typesRegistry, AtlasEntityDef[] superTypes) { int entDefIdx = IDX_ENTITY_DEF.getAndIncrement(); AtlasEntityDef ret = new AtlasEntityDef(); ret.setName(PREFIX_ENTITY_DEF + entDefIdx); ret.setDescription(ret.getName()); ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME)); if (superTypes != null) { for (AtlasEntityDef superType : superTypes) { ret.addSuperType(superType.getName()); } } AtlasTransientTypeRegistry ttr = null; boolean commit = false; try { ttr = typesRegistry.lockTypeRegistryForUpdate(); ttr.addType(ret); commit = true; } catch (AtlasBaseException excp) { LOG.error("failed to create entity-def", excp); ret = null; } finally { typesRegistry.releaseTypeRegistryForUpdate(ttr, commit); } return ret; }
public static AtlasEntityDef newEntityDef(AtlasTypeRegistry typesRegistry, AtlasEntityDef[] superTypes) { int entDefIdx = IDX_ENTITY_DEF.getAndIncrement(); AtlasEntityDef ret = new AtlasEntityDef(); ret.setName(PREFIX_ENTITY_DEF + entDefIdx); ret.setDescription(ret.getName()); ret.setAttributeDefs(newAttributeDefsWithAllBuiltInTypes(PREFIX_ATTRIBUTE_NAME)); if (superTypes != null) { for (AtlasEntityDef superType : superTypes) { ret.addSuperType(superType.getName()); } } AtlasTransientTypeRegistry ttr = null; boolean commit = false; try { ttr = typesRegistry.lockTypeRegistryForUpdate(); ttr.addType(ret); commit = true; } catch (AtlasBaseException excp) { LOG.error("failed to create entity-def", excp); ret = null; } finally { typesRegistry.releaseTypeRegistryForUpdate(ttr, commit); } return ret; }