@Override public AtlasClassificationDef update(AtlasClassificationDef classifiDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasClassificationDefStoreV1.update({})", classifiDef); } validateType(classifiDef); AtlasClassificationDef ret = StringUtils.isNotBlank(classifiDef.getGuid()) ? updateByGuid(classifiDef.getGuid(), classifiDef) : updateByName(classifiDef.getName(), classifiDef); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasClassificationDefStoreV1.update({}): {}", classifiDef, ret); } return ret; }
@Override public AtlasClassificationDef update(AtlasClassificationDef classifiDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasClassificationDefStoreV1.update({})", classifiDef); } validateType(classifiDef); AtlasClassificationDef ret = StringUtils.isNotBlank(classifiDef.getGuid()) ? updateByGuid(classifiDef.getGuid(), classifiDef) : updateByName(classifiDef.getName(), classifiDef); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasClassificationDefStoreV1.update({}): {}", classifiDef, ret); } return ret; }
if (StringUtils.isNotBlank(classifiDef.getGuid())) { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByGuid(classifiDef.getGuid())); } else { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByName(classifiDef.getName())); int i = 0; for (AtlasClassificationDef classifiDef : typesDef.getClassificationDefs()) { if (StringUtils.isNotBlank(classifiDef.getGuid())) { classifiDefStore.deleteByGuid(classifiDef.getGuid(), preDeleteClassifiDefs.get(i)); } else { classifiDefStore.deleteByName(classifiDef.getName(), preDeleteClassifiDefs.get(i));
AtlasClassificationDef createdDef = classifiDefStore.create(classifiDef, preCreateClassifiDefs.get(i)); ttr.updateGuid(createdDef.getName(), createdDef.getGuid());
assertTrue(createdTypesDef.getClassificationDefs().get(0).getAttributeDefs().get(0).getIsIndexable()); String guid = createdTypesDef.getClassificationDefs().get(0).getGuid(); Date createdTime = createdTypesDef.getClassificationDefs().get(0).getCreateTime(); assertEquals("test_classification_11", getBackFromCache.getName()); assertTrue(getBackFromCache.getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, getBackFromCache.getGuid()); assertNotNull(getBackFromCache.getCreatedBy()); assertEquals(createdTime, getBackFromCache.getCreateTime()); assertEquals("test_classification_11", updatedTypesDef.getClassificationDefs().get(0).getName()); assertFalse(updatedTypesDef.getClassificationDefs().get(0).getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, updatedTypesDef.getClassificationDefs().get(0).getGuid()); assertEquals(createdTime, updatedTypesDef.getClassificationDefs().get(0).getCreateTime()); assertEquals("test_classification_11", getBackFromCache.getName()); assertFalse(getBackFromCache.getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, getBackFromCache.getGuid()); assertEquals(createdTime, getBackFromCache.getCreateTime()); getBackFromCache = typeDefStore.getClassificationDefByGuid(guid); assertEquals("test_classification_11", getBackFromCache.getName()); assertFalse(getBackFromCache.getAttributeDefs().get(0).getIsIndexable()); assertEquals(guid, getBackFromCache.getGuid()); assertEquals(createdTime, getBackFromCache.getCreateTime());
AtlasClassificationDef updated = typeDefStore.updateClassificationDefByGuid(classificationDef.getGuid(), classificationDef); assertNotNull(updated);
AtlasEntityDef updated = typeDefStore.updateEntityDefByGuid(entityDef.getGuid(), entityDef); assertNotNull(updated);