@Override @GraphTransaction public List<String> getEntityGUIDS(final String typename) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> getEntityGUIDS({})", typename); } if (StringUtils.isEmpty(typename) || !typeRegistry.isRegisteredType(typename)) { throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_TYPENAME); } List<String> ret = AtlasGraphUtilsV2.findEntityGUIDsByType(typename); if (LOG.isDebugEnabled()) { LOG.debug("<== getEntityGUIDS({})", typename); } return ret; }
@Override @GraphTransaction public List<String> getEntityGUIDS(final String typename) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> getEntityGUIDS({})", typename); } if (StringUtils.isEmpty(typename) || !typeRegistry.isRegisteredType(typename)) { throw new AtlasBaseException(AtlasErrorCode.UNKNOWN_TYPENAME); } List<String> ret = AtlasGraphUtilsV2.findEntityGUIDsByType(typename); if (LOG.isDebugEnabled()) { LOG.debug("<== getEntityGUIDS({})", typename); } return ret; }
if (!typeRegistry.isRegisteredType(enumDef.getName())) { typesToCreate.getEnumDefs().add(enumDef); if (!typeRegistry.isRegisteredType(structDef.getName())) { typesToCreate.getStructDefs().add(structDef); if (!typeRegistry.isRegisteredType(classificationDef.getName())) { typesToCreate.getClassificationDefs().add(classificationDef); if (!typeRegistry.isRegisteredType(entityDef.getName())) { typesToCreate.getEntityDefs().add(entityDef); if (!typeRegistry.isRegisteredType(relationshipDef.getName())) { typesToCreate.getRelationshipDefs().add(relationshipDef);
@Test public void testNestedUpdates() { AtlasTypeRegistry typeRegistry = new AtlasTypeRegistry(); AtlasTransientTypeRegistry ttr = null; boolean commit = false; String failureMsg = null; AtlasClassificationDef testTag1 = new AtlasClassificationDef("testTag1"); AtlasClassificationDef testTag2 = new AtlasClassificationDef("testTag2"); try { ttr = typeRegistry.lockTypeRegistryForUpdate(); ttr.addType(testTag1); // changes should not be seen in typeRegistry until lock is released assertFalse(typeRegistry.isRegisteredType(testTag1.getName()), "type added should be seen in typeRegistry only after commit"); boolean isNestedUpdateSuccess = addType(typeRegistry, testTag2); assertTrue(isNestedUpdateSuccess); // changes made in nested commit, inside addType(), should not be seen in typeRegistry until lock is released here assertFalse(typeRegistry.isRegisteredType(testTag2.getName()), "type added within nested commit should be seen in typeRegistry only after outer commit"); commit = true; } catch (AtlasBaseException excp) { failureMsg = excp.getMessage(); } finally { typeRegistry.releaseTypeRegistryForUpdate(ttr, commit); } assertNull(failureMsg); assertTrue(typeRegistry.isRegisteredType(testTag1.getName())); assertTrue(typeRegistry.isRegisteredType(testTag2.getName())); }
@Test public void testNestedUpdates() { AtlasTypeRegistry typeRegistry = new AtlasTypeRegistry(); AtlasTransientTypeRegistry ttr = null; boolean commit = false; String failureMsg = null; AtlasClassificationDef testTag1 = new AtlasClassificationDef("testTag1"); AtlasClassificationDef testTag2 = new AtlasClassificationDef("testTag2"); try { ttr = typeRegistry.lockTypeRegistryForUpdate(); ttr.addType(testTag1); // changes should not be seen in typeRegistry until lock is released assertFalse(typeRegistry.isRegisteredType(testTag1.getName()), "type added should be seen in typeRegistry only after commit"); boolean isNestedUpdateSuccess = addType(typeRegistry, testTag2); assertTrue(isNestedUpdateSuccess); // changes made in nested commit, inside addType(), should not be seen in typeRegistry until lock is released here assertFalse(typeRegistry.isRegisteredType(testTag2.getName()), "type added within nested commit should be seen in typeRegistry only after outer commit"); commit = true; } catch (AtlasBaseException excp) { failureMsg = excp.getMessage(); } finally { typeRegistry.releaseTypeRegistryForUpdate(ttr, commit); } assertNull(failureMsg); assertTrue(typeRegistry.isRegisteredType(testTag1.getName())); assertTrue(typeRegistry.isRegisteredType(testTag2.getName())); }