target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test(dependsOnMethods = "verifySavedSearchesForUser") public void verifyQueryConversionFromJSON() throws AtlasBaseException { List<AtlasUserSavedSearch> list = userProfileService.getSavedSearches("first-0"); for (int i = 0; i < NUM_SEARCHES; i++) { SearchParameters sp = list.get(i).getSearchParameters(); String json = AtlasType.toJson(sp); assertEquals(AtlasType.toJson(getActualSearchParameters()).replace("\n", "").replace(" ", ""), json); } }
public List<AtlasUserSavedSearch> getSavedSearches(String userName) throws AtlasBaseException { AtlasUserProfile profile = null; try { profile = getUserProfile(userName); } catch (AtlasBaseException excp) { } return (profile != null) ? profile.getSavedSearches() : null; }
UserProfileService { public List<AtlasUserSavedSearch> getSavedSearches(String userName) throws AtlasBaseException { AtlasUserProfile profile = null; try { profile = getUserProfile(userName); } catch (AtlasBaseException excp) { } return (profile != null) ? profile.getSavedSearches() : null; } }
UserProfileService { public List<AtlasUserSavedSearch> getSavedSearches(String userName) throws AtlasBaseException { AtlasUserProfile profile = null; try { profile = getUserProfile(userName); } catch (AtlasBaseException excp) { } return (profile != null) ? profile.getSavedSearches() : null; } @Inject UserProfileService(DataAccess dataAccess); }
UserProfileService { public List<AtlasUserSavedSearch> getSavedSearches(String userName) throws AtlasBaseException { AtlasUserProfile profile = null; try { profile = getUserProfile(userName); } catch (AtlasBaseException excp) { } return (profile != null) ? profile.getSavedSearches() : null; } @Inject UserProfileService(DataAccess dataAccess); AtlasUserProfile saveUserProfile(AtlasUserProfile profile); AtlasUserProfile getUserProfile(String userName); AtlasUserSavedSearch addSavedSearch(AtlasUserSavedSearch savedSearch); AtlasUserSavedSearch updateSavedSearch(AtlasUserSavedSearch savedSearch); List<AtlasUserSavedSearch> getSavedSearches(String userName); AtlasUserSavedSearch getSavedSearch(String userName, String searchName); AtlasUserSavedSearch getSavedSearch(String guid); void deleteUserProfile(String userName); void deleteSavedSearch(String guid); void deleteSearchBySearchName(String userName, String searchName); }
UserProfileService { public List<AtlasUserSavedSearch> getSavedSearches(String userName) throws AtlasBaseException { AtlasUserProfile profile = null; try { profile = getUserProfile(userName); } catch (AtlasBaseException excp) { } return (profile != null) ? profile.getSavedSearches() : null; } @Inject UserProfileService(DataAccess dataAccess); AtlasUserProfile saveUserProfile(AtlasUserProfile profile); AtlasUserProfile getUserProfile(String userName); AtlasUserSavedSearch addSavedSearch(AtlasUserSavedSearch savedSearch); AtlasUserSavedSearch updateSavedSearch(AtlasUserSavedSearch savedSearch); List<AtlasUserSavedSearch> getSavedSearches(String userName); AtlasUserSavedSearch getSavedSearch(String userName, String searchName); AtlasUserSavedSearch getSavedSearch(String guid); void deleteUserProfile(String userName); void deleteSavedSearch(String guid); void deleteSearchBySearchName(String userName, String searchName); }
@Test public void testDefaultValueForPrimitiveTypes() throws Exception { init(); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(primitiveEntity), false); List<AtlasEntityHeader> entitiesCreatedResponse = response.getEntitiesByOperation(EntityOperation.CREATE); List<AtlasEntityHeader> entitiesCreatedwithdefault = response.getMutatedEntities().get(EntityOperation.CREATE); AtlasEntity entityCreated = getEntityFromStore(entitiesCreatedResponse.get(0)); Map attributesMap = entityCreated.getAttributes(); String description = (String) attributesMap.get("description"); String check = (String) attributesMap.get("check"); String sourceCode = (String) attributesMap.get("sourcecode"); float diskUsage = (float) attributesMap.get("diskUsage"); boolean isstoreUse = (boolean) attributesMap.get("isstoreUse"); int cost = (int) attributesMap.get("Cost"); assertEquals(description,"test"); assertEquals(check,"check"); assertEquals(diskUsage,70.5f); assertEquals(isstoreUse,true); assertEquals(sourceCode,"Hello World"); assertEquals(cost,30); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(priority = -1) public void testCreate() throws Exception { init(); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(deptEntity), false); validateMutationResponse(response, EntityOperation.CREATE, 5); AtlasEntityHeader dept1 = response.getFirstCreatedEntityByTypeName(TestUtilsV2.DEPARTMENT_TYPE); validateEntity(deptEntity, getEntityFromStore(dept1), deptEntity.getEntities().get(0)); final Map<EntityOperation, List<AtlasEntityHeader>> entitiesMutated = response.getMutatedEntities(); List<AtlasEntityHeader> entitiesCreated = entitiesMutated.get(EntityOperation.CREATE); assertTrue(entitiesCreated.size() >= deptEntity.getEntities().size()); for (int i = 0; i < deptEntity.getEntities().size(); i++) { AtlasEntity expected = deptEntity.getEntities().get(i); AtlasEntity actual = getEntityFromStore(entitiesCreated.get(i)); validateEntity(deptEntity, actual, expected); } init(); EntityMutationResponse dbCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(dbEntity), false); validateMutationResponse(dbCreationResponse, EntityOperation.CREATE, 1); dbEntityGuid = dbCreationResponse.getCreatedEntities().get(0).getGuid(); AtlasEntityHeader db1 = dbCreationResponse.getFirstCreatedEntityByTypeName(TestUtilsV2.DATABASE_TYPE); validateEntity(dbEntity, getEntityFromStore(db1)); AtlasObjectId dbObjectId = (AtlasObjectId) tblEntity.getEntity().getAttribute("database"); dbObjectId.setGuid(db1.getGuid()); tblEntity.addReferredEntity(dbEntity.getEntity()); init(); EntityMutationResponse tableCreationResponse = entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); validateMutationResponse(tableCreationResponse, EntityOperation.CREATE, 1); tblEntityGuid = tableCreationResponse.getCreatedEntities().get(0).getGuid(); AtlasEntityHeader tableEntity = tableCreationResponse.getFirstCreatedEntityByTypeName(TABLE_TYPE); validateEntity(tblEntity, getEntityFromStore(tableEntity)); init(); EntityMutationResponse entityMutationResponse = entityStore.createOrUpdate(new AtlasEntityStream(nestedCollectionAttrEntity), false); validateMutationResponse(entityMutationResponse, EntityOperation.CREATE, 1); AtlasEntityHeader createdEntity = entityMutationResponse.getFirstCreatedEntityByTypeName(TestUtilsV2.ENTITY_TYPE_WITH_NESTED_COLLECTION_ATTR); validateEntity(nestedCollectionAttrEntity, getEntityFromStore(createdEntity)); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testCreate") public void testMapOfPrimitivesUpdate() throws Exception { AtlasEntity tableEntity = new AtlasEntity(tblEntity.getEntity()); AtlasEntitiesWithExtInfo entitiesInfo = new AtlasEntitiesWithExtInfo(tableEntity); entitiesInfo.addReferredEntity(tableEntity); Map<String, String> paramsMap = (Map<String, String>) tableEntity.getAttribute("parametersMap"); paramsMap.put("newParam", "value"); init(); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); validateMutationResponse(response, EntityMutations.EntityOperation.UPDATE, 1); AtlasEntityHeader updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); paramsMap.remove("key1"); tableEntity.setAttribute("parametersMap", paramsMap); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); validateMutationResponse(response, EntityMutations.EntityOperation.UPDATE, 1); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testCreate") public void testArrayOfStructs() throws Exception { AtlasEntity tableEntity = new AtlasEntity(tblEntity.getEntity()); AtlasEntitiesWithExtInfo entitiesInfo = new AtlasEntitiesWithExtInfo(tableEntity); List<AtlasStruct> partitions = new ArrayList<AtlasStruct>(){{ add(new AtlasStruct(TestUtilsV2.PARTITION_STRUCT_TYPE, NAME, "part1")); add(new AtlasStruct(TestUtilsV2.PARTITION_STRUCT_TYPE, NAME, "part2")); }}; tableEntity.setAttribute("partitions", partitions); init(); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); AtlasEntityHeader updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); partitions.add(new AtlasStruct(TestUtilsV2.PARTITION_STRUCT_TYPE, NAME, "part3")); tableEntity.setAttribute("partitions", partitions); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); partitions.remove(1); tableEntity.setAttribute("partitions", partitions); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); partitions.get(0).setAttribute(NAME, "part4"); tableEntity.setAttribute("partitions", partitions); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); partitions.add(new AtlasStruct(TestUtilsV2.PARTITION_STRUCT_TYPE, NAME, "part4")); tableEntity.setAttribute("partitions", partitions); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); partitions.clear(); tableEntity.setAttribute("partitions", partitions); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testCreate") public void testStructs() throws Exception { AtlasEntity databaseEntity = dbEntity.getEntity(); AtlasEntity tableEntity = new AtlasEntity(tblEntity.getEntity()); AtlasEntitiesWithExtInfo entitiesInfo = new AtlasEntitiesWithExtInfo(tableEntity); AtlasStruct serdeInstance = new AtlasStruct(TestUtilsV2.SERDE_TYPE, NAME, "serde1Name"); serdeInstance.setAttribute("serde", "test"); serdeInstance.setAttribute("description", "testDesc"); tableEntity.setAttribute("serde1", serdeInstance); tableEntity.setAttribute("database", new AtlasObjectId(databaseEntity.getTypeName(), NAME, databaseEntity.getAttribute(NAME))); init(); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); AtlasEntityHeader updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); serdeInstance.setAttribute("serde", "testUpdated"); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); tableEntity.setAttribute("description", null); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(entitiesInfo), false); updatedTable = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); Assert.assertNull(updatedTable.getAttribute("description")); validateEntity(entitiesInfo, getEntityFromStore(updatedTable)); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testCreate") public void testClassUpdate() throws Exception { init(); final AtlasEntity databaseInstance = TestUtilsV2.createDBEntity(); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(databaseInstance), false); final AtlasEntityHeader dbCreated = response.getFirstCreatedEntityByTypeName(TestUtilsV2.DATABASE_TYPE); init(); Map<String, AtlasEntity> tableCloneMap = new HashMap<>(); AtlasEntity tableClone = new AtlasEntity(tblEntity.getEntity()); tableClone.setAttribute("database", new AtlasObjectId(dbCreated.getGuid(), TestUtilsV2.DATABASE_TYPE)); tableCloneMap.put(dbCreated.getGuid(), databaseInstance); tableCloneMap.put(tableClone.getGuid(), tableClone); response = entityStore.createOrUpdate(new InMemoryMapEntityStream(tableCloneMap), false); final AtlasEntityHeader tableDefinition = response.getFirstUpdatedEntityByTypeName(TABLE_TYPE); AtlasEntity updatedTableDefinition = getEntityFromStore(tableDefinition); assertNotNull(updatedTableDefinition.getAttribute("database")); Assert.assertEquals(((AtlasObjectId) updatedTableDefinition.getAttribute("database")).getGuid(), dbCreated.getGuid()); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test public void testMapTypeGetNormalizedValue() { assertNull(intIntMapType.getNormalizedValue(null), "value=" + null); for (Object value : validValues) { if (value == null) { continue; } Map<Object, Object> normalizedValue = intIntMapType.getNormalizedValue(value); assertNotNull(normalizedValue, "value=" + value); } for (Object value : invalidValues) { assertNull(intIntMapType.getNormalizedValue(value), "value=" + value); } }
@Override public Map<Object, Object> getNormalizedValue(Object obj) { if (obj == null) { return null; } if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), Map.class); } if (obj instanceof Map) { Map<Object, Object> ret = new HashMap<>(); Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object normalizedKey = keyType.getNormalizedValue(e.getKey()); if (normalizedKey != null) { Object value = e.getValue(); if (value != null) { Object normalizedValue = valueType.getNormalizedValue(e.getValue()); if (normalizedValue != null) { ret.put(normalizedKey, normalizedValue); } else { return null; } } else { ret.put(normalizedKey, value); } } else { return null; } } return ret; } return null; }
AtlasMapType extends AtlasType { @Override public Map<Object, Object> getNormalizedValue(Object obj) { if (obj == null) { return null; } if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), Map.class); } if (obj instanceof Map) { Map<Object, Object> ret = new HashMap<>(); Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object normalizedKey = keyType.getNormalizedValue(e.getKey()); if (normalizedKey != null) { Object value = e.getValue(); if (value != null) { Object normalizedValue = valueType.getNormalizedValue(e.getValue()); if (normalizedValue != null) { ret.put(normalizedKey, normalizedValue); } else { return null; } } else { ret.put(normalizedKey, value); } } else { return null; } } return ret; } return null; } }
AtlasMapType extends AtlasType { @Override public Map<Object, Object> getNormalizedValue(Object obj) { if (obj == null) { return null; } if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), Map.class); } if (obj instanceof Map) { Map<Object, Object> ret = new HashMap<>(); Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object normalizedKey = keyType.getNormalizedValue(e.getKey()); if (normalizedKey != null) { Object value = e.getValue(); if (value != null) { Object normalizedValue = valueType.getNormalizedValue(e.getValue()); if (normalizedValue != null) { ret.put(normalizedKey, normalizedValue); } else { return null; } } else { ret.put(normalizedKey, value); } } else { return null; } } return ret; } return null; } AtlasMapType(AtlasType keyType, AtlasType valueType); AtlasMapType(String keyTypeName, String valueTypeName, AtlasTypeRegistry typeRegistry); }
AtlasMapType extends AtlasType { @Override public Map<Object, Object> getNormalizedValue(Object obj) { if (obj == null) { return null; } if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), Map.class); } if (obj instanceof Map) { Map<Object, Object> ret = new HashMap<>(); Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object normalizedKey = keyType.getNormalizedValue(e.getKey()); if (normalizedKey != null) { Object value = e.getValue(); if (value != null) { Object normalizedValue = valueType.getNormalizedValue(e.getValue()); if (normalizedValue != null) { ret.put(normalizedKey, normalizedValue); } else { return null; } } else { ret.put(normalizedKey, value); } } else { return null; } } return ret; } return null; } AtlasMapType(AtlasType keyType, AtlasType valueType); AtlasMapType(String keyTypeName, String valueTypeName, AtlasTypeRegistry typeRegistry); String getKeyTypeName(); String getValueTypeName(); AtlasType getKeyType(); AtlasType getValueType(); void setKeyType(AtlasType keyType); @Override Map<Object, Object> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Map<Object, Object> getNormalizedValue(Object obj); @Override Map<Object, Object> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
AtlasMapType extends AtlasType { @Override public Map<Object, Object> getNormalizedValue(Object obj) { if (obj == null) { return null; } if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), Map.class); } if (obj instanceof Map) { Map<Object, Object> ret = new HashMap<>(); Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object normalizedKey = keyType.getNormalizedValue(e.getKey()); if (normalizedKey != null) { Object value = e.getValue(); if (value != null) { Object normalizedValue = valueType.getNormalizedValue(e.getValue()); if (normalizedValue != null) { ret.put(normalizedKey, normalizedValue); } else { return null; } } else { ret.put(normalizedKey, value); } } else { return null; } } return ret; } return null; } AtlasMapType(AtlasType keyType, AtlasType valueType); AtlasMapType(String keyTypeName, String valueTypeName, AtlasTypeRegistry typeRegistry); String getKeyTypeName(); String getValueTypeName(); AtlasType getKeyType(); AtlasType getValueType(); void setKeyType(AtlasType keyType); @Override Map<Object, Object> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Map<Object, Object> getNormalizedValue(Object obj); @Override Map<Object, Object> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
@Test public void testCheckOptionalAttrValueRetention() throws Exception { AtlasEntity dbEntity = TestUtilsV2.createDBEntity(); init(); EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(dbEntity), false); AtlasEntity firstEntityCreated = getEntityFromStore(response.getFirstCreatedEntityByTypeName(TestUtilsV2.DATABASE_TYPE)); final String isReplicatedAttr = "isReplicated"; final String paramsAttr = "parameters"; assertNotNull(firstEntityCreated.getAttribute(isReplicatedAttr)); Assert.assertEquals(firstEntityCreated.getAttribute(isReplicatedAttr), Boolean.FALSE); Assert.assertNull(firstEntityCreated.getAttribute(paramsAttr)); dbEntity.setAttribute(isReplicatedAttr, Boolean.TRUE); final HashMap<String, String> params = new HashMap<String, String>() {{ put("param1", "val1"); put("param2", "val2"); }}; dbEntity.setAttribute(paramsAttr, params); init(); response = entityStore.createOrUpdate(new AtlasEntityStream(dbEntity), false); AtlasEntity firstEntityUpdated = getEntityFromStore(response.getFirstUpdatedEntityByTypeName(TestUtilsV2.DATABASE_TYPE)); assertNotNull(firstEntityUpdated); assertNotNull(firstEntityUpdated.getAttribute(isReplicatedAttr)); Assert.assertEquals(firstEntityUpdated.getAttribute(isReplicatedAttr), Boolean.TRUE); Assert.assertEquals(firstEntityUpdated.getAttribute(paramsAttr), params); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(enabled = false) public void testSpecialCharacters() throws Exception { final String typeName = TestUtilsV2.randomString(10); String strAttrName = randomStrWithReservedChars(); String arrayAttrName = randomStrWithReservedChars(); String mapAttrName = randomStrWithReservedChars(); AtlasEntityDef typeDefinition = AtlasTypeUtil.createClassTypeDef(typeName, "Special chars test type", ImmutableSet.<String>of(), AtlasTypeUtil.createOptionalAttrDef(strAttrName, "string"), AtlasTypeUtil.createOptionalAttrDef(arrayAttrName, "array<string>"), AtlasTypeUtil.createOptionalAttrDef(mapAttrName, "map<string,string>")); AtlasTypesDef atlasTypesDef = new AtlasTypesDef(null, null, null, Arrays.asList(typeDefinition)); typeDefStore.createTypesDef(atlasTypesDef); AtlasEntity entity = new AtlasEntity(); entity.setAttribute(strAttrName, randomStrWithReservedChars()); entity.setAttribute(arrayAttrName, new String[]{randomStrWithReservedChars()}); entity.setAttribute(mapAttrName, new HashMap<String, String>() {{ put(randomStrWithReservedChars(), randomStrWithReservedChars()); }}); AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(entity); final EntityMutationResponse response = entityStore.createOrUpdate(new AtlasEntityStream(entityWithExtInfo), false); final AtlasEntityHeader firstEntityCreated = response.getFirstEntityCreated(); validateEntity(entityWithExtInfo, getEntityFromStore(firstEntityCreated)); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(expectedExceptions = AtlasBaseException.class) public void testCreateRequiredAttrNull() throws Exception { Map<String, AtlasEntity> tableCloneMap = new HashMap<>(); AtlasEntity tableEntity = new AtlasEntity(TABLE_TYPE); tableEntity.setAttribute(NAME, "table_" + TestUtilsV2.randomString()); tableCloneMap.put(tableEntity.getGuid(), tableEntity); entityStore.createOrUpdate(new InMemoryMapEntityStream(tableCloneMap), false); Assert.fail("Expected exception while creating with required attribute null"); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "testCreate") public void addCustomAttributesToEntity() throws AtlasBaseException { AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Map<String, String> customAttributes = new HashMap<>(); customAttributes.put("key1", "val1"); customAttributes.put("key2", "val2"); customAttributes.put("key3", "val3"); customAttributes.put("key4", "val4"); customAttributes.put("key5", "val5"); tblEntity.setCustomAttributes(customAttributes); entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); tblEntity = getEntityFromStore(tblEntityGuid); assertEquals(customAttributes, tblEntity.getCustomAttributes()); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "addCustomAttributesToEntity") public void updateCustomAttributesToEntity() throws AtlasBaseException { AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Map<String, String> customAttributes = new HashMap<>(); customAttributes.put("key1", "val1"); customAttributes.put("key2", "val2"); tblEntity.setCustomAttributes(customAttributes); entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); tblEntity = getEntityFromStore(tblEntityGuid); assertEquals(customAttributes, tblEntity.getCustomAttributes()); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "updateCustomAttributesToEntity") public void deleteCustomAttributesToEntity() throws AtlasBaseException { AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Map<String, String> emptyCustomAttributes = new HashMap<>(); tblEntity.setCustomAttributes(emptyCustomAttributes); entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); tblEntity = getEntityFromStore(tblEntityGuid); assertEquals(emptyCustomAttributes, tblEntity.getCustomAttributes()); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "deleteCustomAttributesToEntity") public void nullCustomAttributesToEntity() throws AtlasBaseException { AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Map<String, String> customAttributes = new HashMap<>(); customAttributes.put("key1", "val1"); customAttributes.put("key2", "val2"); tblEntity.setCustomAttributes(customAttributes); entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); tblEntity.setCustomAttributes(null); entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); tblEntity = getEntityFromStore(tblEntityGuid); assertEquals(customAttributes, tblEntity.getCustomAttributes()); }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "nullCustomAttributesToEntity") public void addInvalidKeysToEntityCustomAttributes() throws AtlasBaseException { AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Map<String, String> invalidCustomAttributes = new HashMap<>(); invalidCustomAttributes.put("key0_65765-6565", "val0"); invalidCustomAttributes.put("key1-aaa_bbb-ccc", "val1"); invalidCustomAttributes.put("key2!@#$%&*()", "val2"); tblEntity.setCustomAttributes(invalidCustomAttributes); try { entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); } catch (AtlasBaseException ex) { assertEquals(ex.getAtlasErrorCode(), INVALID_CUSTOM_ATTRIBUTE_KEY_CHARACTERS); } invalidCustomAttributes = new HashMap<>(); invalidCustomAttributes.put("bigValue_lengthEquals_50", randomAlphanumeric(50)); invalidCustomAttributes.put("bigValue_lengthEquals_51", randomAlphanumeric(51)); tblEntity.setCustomAttributes(invalidCustomAttributes); try { entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); } catch (AtlasBaseException ex) { assertEquals(ex.getAtlasErrorCode(), INVALID_CUSTOM_ATTRIBUTE_KEY_LENGTH); } }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "addInvalidKeysToEntityCustomAttributes") public void addInvalidValuesToEntityCustomAttributes() throws AtlasBaseException { AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Map<String, String> invalidCustomAttributes = new HashMap<>(); invalidCustomAttributes.put("key1", randomAlphanumeric(500)); invalidCustomAttributes.put("key2", randomAlphanumeric(501)); tblEntity.setCustomAttributes(invalidCustomAttributes); try { entityStore.createOrUpdate(new AtlasEntityStream(tblEntity), false); } catch (AtlasBaseException ex) { assertEquals(ex.getAtlasErrorCode(), INVALID_CUSTOM_ATTRIBUTE_VALUE); } }
@Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate) throws AtlasBaseException { return createOrUpdate(entityStream, isPartialUpdate, false, false); } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testCreate") public void addLabelsToEntity() throws AtlasBaseException { Set<String> labels = new HashSet<>(); labels.add("label_1"); labels.add("label_2"); labels.add("label_3"); labels.add("label_4"); labels.add("label_5"); entityStore.setLabels(tblEntityGuid, labels); AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); assertEquals(labels, tblEntity.getLabels()); }
@Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test public void testMapTypeValidateValue() { List<String> messages = new ArrayList<>(); for (Object value : validValues) { assertTrue(intIntMapType.validateValue(value, "testObj", messages)); assertEquals(messages.size(), 0, "value=" + value); } for (Object value : invalidValues) { assertFalse(intIntMapType.validateValue(value, "testObj", messages)); assertTrue(messages.size() > 0, "value=" + value); messages.clear(); } }
@Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof Map) { Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object key = e.getKey(); if (!keyType.isValidValue(key)) { ret = false; messages.add(objName + "." + key + ": invalid key for type " + getTypeName()); } else { Object value = e.getValue(); ret = valueType.validateValue(value, objName + "." + key, messages) && ret; } } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; }
AtlasMapType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof Map) { Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object key = e.getKey(); if (!keyType.isValidValue(key)) { ret = false; messages.add(objName + "." + key + ": invalid key for type " + getTypeName()); } else { Object value = e.getValue(); ret = valueType.validateValue(value, objName + "." + key, messages) && ret; } } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } }
AtlasMapType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof Map) { Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object key = e.getKey(); if (!keyType.isValidValue(key)) { ret = false; messages.add(objName + "." + key + ": invalid key for type " + getTypeName()); } else { Object value = e.getValue(); ret = valueType.validateValue(value, objName + "." + key, messages) && ret; } } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } AtlasMapType(AtlasType keyType, AtlasType valueType); AtlasMapType(String keyTypeName, String valueTypeName, AtlasTypeRegistry typeRegistry); }
AtlasMapType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof Map) { Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object key = e.getKey(); if (!keyType.isValidValue(key)) { ret = false; messages.add(objName + "." + key + ": invalid key for type " + getTypeName()); } else { Object value = e.getValue(); ret = valueType.validateValue(value, objName + "." + key, messages) && ret; } } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } AtlasMapType(AtlasType keyType, AtlasType valueType); AtlasMapType(String keyTypeName, String valueTypeName, AtlasTypeRegistry typeRegistry); String getKeyTypeName(); String getValueTypeName(); AtlasType getKeyType(); AtlasType getValueType(); void setKeyType(AtlasType keyType); @Override Map<Object, Object> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Map<Object, Object> getNormalizedValue(Object obj); @Override Map<Object, Object> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
AtlasMapType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof Map) { Map<Object, Objects> map = (Map<Object, Objects>) obj; for (Map.Entry e : map.entrySet()) { Object key = e.getKey(); if (!keyType.isValidValue(key)) { ret = false; messages.add(objName + "." + key + ": invalid key for type " + getTypeName()); } else { Object value = e.getValue(); ret = valueType.validateValue(value, objName + "." + key, messages) && ret; } } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } AtlasMapType(AtlasType keyType, AtlasType valueType); AtlasMapType(String keyTypeName, String valueTypeName, AtlasTypeRegistry typeRegistry); String getKeyTypeName(); String getValueTypeName(); AtlasType getKeyType(); AtlasType getValueType(); void setKeyType(AtlasType keyType); @Override Map<Object, Object> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Map<Object, Object> getNormalizedValue(Object obj); @Override Map<Object, Object> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
@Test (dependsOnMethods = "addLabelsToEntity") public void updateLabelsToEntity() throws AtlasBaseException { Set<String> labels = new HashSet<>(); labels.add("label_1_update"); labels.add("label_2_update"); labels.add("label_3_update"); entityStore.setLabels(tblEntityGuid, labels); AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); assertEquals(labels, tblEntity.getLabels()); }
@Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "updateLabelsToEntity") public void clearLabelsToEntity() throws AtlasBaseException { HashSet<String> emptyLabels = new HashSet<>(); entityStore.setLabels(tblEntityGuid, emptyLabels); AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Assert.assertTrue(tblEntity.getLabels().isEmpty()); }
@Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "clearLabelsToEntity") public void emptyLabelsToEntity() throws AtlasBaseException { entityStore.setLabels(tblEntityGuid, null); AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); Assert.assertTrue(tblEntity.getLabels().isEmpty()); }
@Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "emptyLabelsToEntity") public void invalidLabelLengthToEntity() throws AtlasBaseException { Set<String> labels = new HashSet<>(); labels.add(randomAlphanumeric(50)); labels.add(randomAlphanumeric(51)); try { entityStore.setLabels(tblEntityGuid, labels); } catch (AtlasBaseException ex) { assertEquals(ex.getAtlasErrorCode(), INVALID_LABEL_LENGTH); } }
@Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "invalidLabelLengthToEntity") public void invalidLabelCharactersToEntity() { Set<String> labels = new HashSet<>(); labels.add("label-1_100_45"); labels.add("LABEL-1_200-55"); labels.add("LaBeL-1-)(*U&%^%#$@!~"); try { entityStore.setLabels(tblEntityGuid, labels); } catch (AtlasBaseException ex) { assertEquals(ex.getAtlasErrorCode(), INVALID_LABEL_CHARACTERS); } }
@Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void setLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> setLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } validateLabels(labels); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Set<String> addedLabels = Collections.emptySet(); Set<String> removedLabels = Collections.emptySet(); if (CollectionUtils.isEmpty(entityHeader.getLabels())) { addedLabels = labels; } else if (CollectionUtils.isEmpty(labels)) { removedLabels = entityHeader.getLabels(); } else { addedLabels = new HashSet<String>(CollectionUtils.subtract(labels, entityHeader.getLabels())); removedLabels = new HashSet<String>(CollectionUtils.subtract(entityHeader.getLabels(), labels)); } if (addedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_ADD_LABEL, entityHeader); for (String label : addedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add label: guid=", guid, ", label=", label); } } if (removedLabels != null) { AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : removedLabels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } } entityGraphMapper.setLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== setLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test (dependsOnMethods = "addMoreLabelsToEntity") public void deleteLabelsToEntity() throws AtlasBaseException { Set<String> labels = new HashSet<>(); labels.add("label_1_add"); labels.add("label_2_add"); entityStore.removeLabels(tblEntityGuid, labels); AtlasEntity tblEntity = getEntityFromStore(tblEntityGuid); assertNotNull(tblEntity.getLabels()); Assert.assertEquals(tblEntity.getLabels().size(), 1); labels.clear(); labels.add("label_4_add"); entityStore.removeLabels(tblEntityGuid, labels); tblEntity = getEntityFromStore(tblEntityGuid); assertNotNull(tblEntity.getLabels()); Assert.assertEquals(tblEntity.getLabels().size(), 1); labels.clear(); labels.add("label_3_add"); entityStore.removeLabels(tblEntityGuid, labels); tblEntity = getEntityFromStore(tblEntityGuid); Assert.assertTrue(tblEntity.getLabels().isEmpty()); }
@Override @GraphTransaction public void removeLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> removeLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (CollectionUtils.isEmpty(labels)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "labels is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : labels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } validateLabels(labels); entityGraphMapper.removeLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== removeLabels()"); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void removeLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> removeLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (CollectionUtils.isEmpty(labels)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "labels is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : labels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } validateLabels(labels); entityGraphMapper.removeLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== removeLabels()"); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void removeLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> removeLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (CollectionUtils.isEmpty(labels)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "labels is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : labels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } validateLabels(labels); entityGraphMapper.removeLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== removeLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void removeLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> removeLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (CollectionUtils.isEmpty(labels)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "labels is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : labels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } validateLabels(labels); entityGraphMapper.removeLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== removeLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void removeLabels(String guid, Set<String> labels) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> removeLabels()"); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (CollectionUtils.isEmpty(labels)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "labels is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_REMOVE_LABEL, entityHeader); for (String label : labels) { requestBuilder.setLabel(label); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "remove label: guid=", guid, ", label=", label); } validateLabels(labels); entityGraphMapper.removeLabels(entityVertex, labels); if (LOG.isDebugEnabled()) { LOG.debug("<== removeLabels()"); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test public void testAddBusinessAttributesStringMaxLengthCheck_2() throws Exception { Map<String, Map<String, Object>> bmMapReq = new HashMap<>(); Map<String, Object> bmAttrMapReq = new HashMap<>(); bmAttrMapReq.put("attr8", "012345678901234567890"); bmMapReq.put("bmWithAllTypes", bmAttrMapReq); try { entityStore.addOrUpdateBusinessAttributes(dbEntity.getEntity().getGuid(), bmMapReq, false); } catch (AtlasBaseException e) { Assert.assertEquals(AtlasErrorCode.INSTANCE_CRUD_INVALID_PARAMS, e.getAtlasErrorCode()); return; } Assert.fail(); }
@Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testAddBusinessAttributesStringMaxLengthCheck") public void testUpdateBusinessAttributesStringMaxLengthCheck_2() throws Exception { Map<String, Map<String, Object>> bmMapReq = new HashMap<>(); Map<String, Object> bmAttrMapReq = new HashMap<>(); bmAttrMapReq.put("attr8", "012345678901234567890"); bmMapReq.put("bmWithAllTypes", bmAttrMapReq); try { entityStore.addOrUpdateBusinessAttributes(dbEntity.getEntity().getGuid(), bmMapReq, true); } catch (AtlasBaseException e) { Assert.assertEquals(AtlasErrorCode.INSTANCE_CRUD_INVALID_PARAMS, e.getAtlasErrorCode()); return; } Assert.fail(); }
@Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testAddBusinessAttributesStringMaxLengthCheck") public void testUpdateBusinessAttributesStringMaxLengthCheck_4() throws Exception { Map<String, Map<String, Object>> bmAttrMapReq = new HashMap<>(); Map<String, Object> attrValueMapReq = new HashMap<>(); List<String> stringList = new ArrayList<>(); stringList.add("0123456789"); stringList.add("012345678901234567890"); attrValueMapReq.put("attr18", stringList); bmAttrMapReq.put("bmWithAllTypesMV", attrValueMapReq); try { entityStore.addOrUpdateBusinessAttributes(dbEntity.getEntity().getGuid(), bmAttrMapReq, true); } catch (AtlasBaseException e) { Assert.assertEquals(AtlasErrorCode.INSTANCE_CRUD_INVALID_PARAMS, e.getAtlasErrorCode()); return; } Assert.fail(); }
@Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } if (StringUtils.isEmpty(guid)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "guid is null/empty"); } if (MapUtils.isEmpty(businessAttrbutes)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "businessAttributes is null/empty"); } AtlasVertex entityVertex = AtlasGraphUtilsV2.findByGuid(graph, guid); if (entityVertex == null) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); } String typeName = getTypeName(entityVertex); AtlasEntityType entityType = typeRegistry.getEntityTypeByName(typeName); AtlasEntityHeader entityHeader = entityRetriever.toAtlasEntityHeaderWithClassifications(entityVertex); Map<String, Map<String, Object>> currEntityBusinessAttributes = entityRetriever.getBusinessMetadata(entityVertex); Set<String> updatedBusinessMetadataNames = new HashSet<>(); for (String bmName : entityType.getBusinessAttributes().keySet()) { Map<String, Object> bmAttrs = businessAttrbutes.get(bmName); Map<String, Object> currBmAttrs = currEntityBusinessAttributes != null ? currEntityBusinessAttributes.get(bmName) : null; if (bmAttrs == null && !isOverwrite) { continue; } else if (MapUtils.isEmpty(bmAttrs) && MapUtils.isEmpty(currBmAttrs)) { continue; } else if (Objects.equals(bmAttrs, currBmAttrs)) { continue; } updatedBusinessMetadataNames.add(bmName); } AtlasEntityAccessRequestBuilder requestBuilder = new AtlasEntityAccessRequestBuilder(typeRegistry, AtlasPrivilege.ENTITY_UPDATE_BUSINESS_METADATA, entityHeader); for (String bmName : updatedBusinessMetadataNames) { requestBuilder.setBusinessMetadata(bmName); AtlasAuthorizationUtils.verifyAccess(requestBuilder.build(), "add/update business-metadata: guid=", guid, ", business-metadata-name=", bmName); } validateBusinessAttributes(entityVertex, entityType, businessAttrbutes, isOverwrite); if (isOverwrite) { entityGraphMapper.setBusinessAttributes(entityVertex, entityType, businessAttrbutes); } else { entityGraphMapper.addOrUpdateBusinessAttributes(entityVertex, entityType, businessAttrbutes); } if (LOG.isDebugEnabled()) { LOG.debug("<== addOrUpdateBusinessAttributes(guid={}, businessAttributes={}, isOverwrite={})", guid, businessAttrbutes, isOverwrite); } } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test public void testEmptyFileException() { InputStream inputStream = getFile(CSV_FILES, "empty.csv"); try { entityStore.bulkCreateOrUpdateBusinessAttributes(inputStream, "empty.csv"); fail("Error occurred : Failed to recognize the empty file."); } catch (AtlasBaseException e) { assertEquals(e.getMessage(), "No data found in the uploaded file"); } finally { if (inputStream != null) { try { inputStream.close(); } catch (Exception e) { } } } }
@Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test public void testArrayTypeDefaultValue() { Collection defValue = intArrayType.createDefaultValue(); assertEquals(defValue.size(), 1); }
@Override public Collection<?> createDefaultValue() { Collection<Object> ret = new ArrayList<>(); ret.add(elementType.createDefaultValue()); if (minCount != COUNT_NOT_SET) { for (int i = 1; i < minCount; i++) { ret.add(elementType.createDefaultValue()); } } return ret; }
AtlasArrayType extends AtlasType { @Override public Collection<?> createDefaultValue() { Collection<Object> ret = new ArrayList<>(); ret.add(elementType.createDefaultValue()); if (minCount != COUNT_NOT_SET) { for (int i = 1; i < minCount; i++) { ret.add(elementType.createDefaultValue()); } } return ret; } }
AtlasArrayType extends AtlasType { @Override public Collection<?> createDefaultValue() { Collection<Object> ret = new ArrayList<>(); ret.add(elementType.createDefaultValue()); if (minCount != COUNT_NOT_SET) { for (int i = 1; i < minCount; i++) { ret.add(elementType.createDefaultValue()); } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); }
AtlasArrayType extends AtlasType { @Override public Collection<?> createDefaultValue() { Collection<Object> ret = new ArrayList<>(); ret.add(elementType.createDefaultValue()); if (minCount != COUNT_NOT_SET) { for (int i = 1; i < minCount; i++) { ret.add(elementType.createDefaultValue()); } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
AtlasArrayType extends AtlasType { @Override public Collection<?> createDefaultValue() { Collection<Object> ret = new ArrayList<>(); ret.add(elementType.createDefaultValue()); if (minCount != COUNT_NOT_SET) { for (int i = 1; i < minCount; i++) { ret.add(elementType.createDefaultValue()); } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
@Test(dependsOnMethods = "testCreate") public void testBulkAddOrUpdateBusinessAttributes() { try { AtlasEntity hive_db_1 = getEntityFromStore(dbEntityGuid); String dbName = (String) hive_db_1.getAttribute("name"); String data = TestUtilsV2.getFileData(CSV_FILES, "template_2.csv"); data = data.replaceAll("hive_db_1", dbName); InputStream inputStream1 = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8)); BulkImportResponse bulkImportResponse = entityStore.bulkCreateOrUpdateBusinessAttributes(inputStream1, "template_2.csv"); assertEquals(CollectionUtils.isEmpty(bulkImportResponse.getSuccessImportInfoList()), false); assertEquals(CollectionUtils.isEmpty(bulkImportResponse.getFailedImportInfoList()), true); } catch (Exception e) { fail("The BusinessMetadata Attribute should have been assigned " +e); } }
@Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
AtlasEntityStoreV2 implements AtlasEntityStore { @Override @GraphTransaction public BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName) throws AtlasBaseException { BulkImportResponse ret = new BulkImportResponse(); try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.FILE_NAME_NOT_FOUND, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); Map<String, AtlasEntity> attributesToAssociate = getBusinessMetadataDefList(fileData, ret); for (AtlasEntity entity : attributesToAssociate.values()) { try { addOrUpdateBusinessAttributes(entity.getGuid(), entity.getBusinessAttributes(), true); BulkImportResponse.ImportInfo successImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString()); ret.setSuccessImportInfoList(successImportInfo); }catch (Exception e) { LOG.error("Error occurred while updating BusinessMetadata Attributes for Entity " + entity.getGuid()); BulkImportResponse.ImportInfo failedImportInfo = new BulkImportResponse.ImportInfo(entity.getGuid(), entity.getBusinessAttributes().toString(), BulkImportResponse.ImportStatus.FAILED, e.getMessage()); ret.getFailedImportInfoList().add(failedImportInfo); } } } catch (IOException e) { LOG.error("An Exception occurred while uploading the file {}", fileName, e); throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject AtlasEntityStoreV2(AtlasGraph graph, DeleteHandlerDelegate deleteDelegate, AtlasTypeRegistry typeRegistry, IAtlasEntityChangeNotifier entityChangeNotifier, EntityGraphMapper entityGraphMapper); @Override @GraphTransaction List<String> getEntityGUIDS(final String typename); @Override @GraphTransaction AtlasEntityWithExtInfo getById(String guid); @Override @GraphTransaction AtlasEntityWithExtInfo getById(final String guid, final boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getHeaderById(final String guid); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids); @Override @GraphTransaction AtlasEntitiesWithExtInfo getByIds(List<String> guids, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntitiesWithExtInfo getEntitiesByUniqueAttributes(AtlasEntityType entityType, List<Map<String, Object>> uniqueAttributes , boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasEntityWithExtInfo getByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, boolean isMinExtInfo, boolean ignoreRelationships); @Override @GraphTransaction AtlasEntityHeader getEntityHeaderByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction AtlasCheckStateResult checkState(AtlasCheckStateRequest request); @Override @GraphTransaction EntityMutationResponse createOrUpdate(EntityStream entityStream, boolean isPartialUpdate); @Override @GraphTransaction(logRollback = false) EntityMutationResponse createOrUpdateForImport(EntityStream entityStream); @Override EntityMutationResponse createOrUpdateForImportNoCommit(EntityStream entityStream); @Override @GraphTransaction EntityMutationResponse updateEntity(AtlasObjectId objectId, AtlasEntityWithExtInfo updatedEntityInfo, boolean isPartialUpdate); @Override @GraphTransaction EntityMutationResponse updateByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes, AtlasEntityWithExtInfo updatedEntityInfo); @Override @GraphTransaction EntityMutationResponse updateEntityAttributeByGuid(String guid, String attrName, Object attrValue); @Override @GraphTransaction EntityMutationResponse deleteById(final String guid); @Override @GraphTransaction EntityMutationResponse deleteByIds(final List<String> guids); @Override @GraphTransaction EntityMutationResponse purgeByIds(Set<String> guids); @Override @GraphTransaction EntityMutationResponse deleteByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction String getGuidByUniqueAttributes(AtlasEntityType entityType, Map<String, Object> uniqAttributes); @Override @GraphTransaction void addClassifications(final String guid, final List<AtlasClassification> classifications); @Override @GraphTransaction void updateClassifications(String guid, List<AtlasClassification> classifications); @Override @GraphTransaction void addClassification(final List<String> guids, final AtlasClassification classification); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName); @Override @GraphTransaction void deleteClassification(final String guid, final String classificationName, final String associatedEntityGuid); @GraphTransaction List<AtlasClassification> retrieveClassifications(String guid); @Override @GraphTransaction List<AtlasClassification> getClassifications(String guid); @Override @GraphTransaction AtlasClassification getClassification(String guid, String classificationName); @Override @GraphTransaction String setClassifications(AtlasEntityHeaders entityHeaders); @Override @GraphTransaction void addOrUpdateBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttrbutes, boolean isOverwrite); @Override @GraphTransaction void removeBusinessAttributes(String guid, Map<String, Map<String, Object>> businessAttributes); @Override @GraphTransaction void setLabels(String guid, Set<String> labels); @Override @GraphTransaction void removeLabels(String guid, Set<String> labels); @Override @GraphTransaction void addLabels(String guid, Set<String> labels); @Override @GraphTransaction BulkImportResponse bulkCreateOrUpdateBusinessAttributes(InputStream inputStream, String fileName); }
@Test(dataProvider = "traitRegexString") public void testIsValidName(String data, boolean expected) { assertEquals(classificationDefStore.isValidName(data), expected); }
@Override public boolean isValidName(String typeName) { Matcher m = TRAIT_NAME_PATTERN.matcher(typeName); return m.matches(); }
AtlasClassificationDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasClassificationDef> { @Override public boolean isValidName(String typeName) { Matcher m = TRAIT_NAME_PATTERN.matcher(typeName); return m.matches(); } }
AtlasClassificationDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasClassificationDef> { @Override public boolean isValidName(String typeName) { Matcher m = TRAIT_NAME_PATTERN.matcher(typeName); return m.matches(); } AtlasClassificationDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasClassificationDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasClassificationDef> { @Override public boolean isValidName(String typeName) { Matcher m = TRAIT_NAME_PATTERN.matcher(typeName); return m.matches(); } AtlasClassificationDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasClassificationDef classificationDef); @Override AtlasClassificationDef create(AtlasClassificationDef classificationDef, AtlasVertex preCreateResult); @Override List<AtlasClassificationDef> getAll(); @Override AtlasClassificationDef getByName(String name); @Override AtlasClassificationDef getByGuid(String guid); @Override AtlasClassificationDef update(AtlasClassificationDef classifiDef); @Override AtlasClassificationDef updateByName(String name, AtlasClassificationDef classificationDef); @Override AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); @Override boolean isValidName(String typeName); }
AtlasClassificationDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasClassificationDef> { @Override public boolean isValidName(String typeName) { Matcher m = TRAIT_NAME_PATTERN.matcher(typeName); return m.matches(); } AtlasClassificationDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasClassificationDef classificationDef); @Override AtlasClassificationDef create(AtlasClassificationDef classificationDef, AtlasVertex preCreateResult); @Override List<AtlasClassificationDef> getAll(); @Override AtlasClassificationDef getByName(String name); @Override AtlasClassificationDef getByGuid(String guid); @Override AtlasClassificationDef update(AtlasClassificationDef classifiDef); @Override AtlasClassificationDef updateByName(String name, AtlasClassificationDef classificationDef); @Override AtlasClassificationDef updateByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); @Override boolean isValidName(String typeName); }
@Test(dataProvider = "invalidAttributeNameWithReservedKeywords") public void testCreateTypeWithReservedKeywords(AtlasRelationshipDef atlasRelationshipDef) throws AtlasException { try { ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV2.ALLOW_RESERVED_KEYWORDS, false); relationshipDefStore.create(atlasRelationshipDef, null); } catch (AtlasBaseException e) { Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID); } }
@Override public AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.create({}, {})", relationshipDef, preCreateResult); } verifyTypeReadAccess(relationshipDef.getEndDef1().getType()); verifyTypeReadAccess(relationshipDef.getEndDef2().getType()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, relationshipDef), "create relationship-def ", relationshipDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(relationshipDef) : preCreateResult; AtlasRelationshipDef ret = toRelationshipDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.create({}, {}): {}", relationshipDef, preCreateResult, ret); } return ret; }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { @Override public AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.create({}, {})", relationshipDef, preCreateResult); } verifyTypeReadAccess(relationshipDef.getEndDef1().getType()); verifyTypeReadAccess(relationshipDef.getEndDef2().getType()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, relationshipDef), "create relationship-def ", relationshipDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(relationshipDef) : preCreateResult; AtlasRelationshipDef ret = toRelationshipDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.create({}, {}): {}", relationshipDef, preCreateResult, ret); } return ret; } }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { @Override public AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.create({}, {})", relationshipDef, preCreateResult); } verifyTypeReadAccess(relationshipDef.getEndDef1().getType()); verifyTypeReadAccess(relationshipDef.getEndDef2().getType()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, relationshipDef), "create relationship-def ", relationshipDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(relationshipDef) : preCreateResult; AtlasRelationshipDef ret = toRelationshipDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.create({}, {}): {}", relationshipDef, preCreateResult, ret); } return ret; } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { @Override public AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.create({}, {})", relationshipDef, preCreateResult); } verifyTypeReadAccess(relationshipDef.getEndDef1().getType()); verifyTypeReadAccess(relationshipDef.getEndDef2().getType()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, relationshipDef), "create relationship-def ", relationshipDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(relationshipDef) : preCreateResult; AtlasRelationshipDef ret = toRelationshipDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.create({}, {}): {}", relationshipDef, preCreateResult, ret); } return ret; } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { @Override public AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasRelationshipDefStoreV1.create({}, {})", relationshipDef, preCreateResult); } verifyTypeReadAccess(relationshipDef.getEndDef1().getType()); verifyTypeReadAccess(relationshipDef.getEndDef2().getType()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, relationshipDef), "create relationship-def ", relationshipDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(relationshipDef) : preCreateResult; AtlasRelationshipDef ret = toRelationshipDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasRelationshipDefStoreV1.create({}, {}): {}", relationshipDef, preCreateResult, ret); } return ret; } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
@Test(dataProvider = "updateValidProperties") public void testupdateVertexPreUpdatepropagateTags(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef) throws AtlasBaseException { AtlasRelationshipDefStoreV2.preUpdateCheck(existingRelationshipDef, newRelationshipDef); }
private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
@Test(dataProvider = "updateRename") public void testupdateVertexPreUpdateRename(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef) { try { AtlasRelationshipDefStoreV2.preUpdateCheck(existingRelationshipDef, newRelationshipDef); fail("expected error"); } catch (AtlasBaseException e) { if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_NAME_UPDATE)){ fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode()); } } }
private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
@Test(dataProvider = "updateRelCat") public void testupdateVertexPreUpdateRelcat(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef) { try { AtlasRelationshipDefStoreV2.preUpdateCheck(existingRelationshipDef, newRelationshipDef); fail("expected error"); } catch (AtlasBaseException e) { if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_CATEGORY_UPDATE)){ fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode()); } } }
private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
@Test(dataProvider = "updateEnd1") public void testupdateVertexPreUpdateEnd1(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef) { try { AtlasRelationshipDefStoreV2.preUpdateCheck(existingRelationshipDef, newRelationshipDef); fail("expected error"); } catch (AtlasBaseException e) { if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END1_UPDATE)){ fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode()); } } }
private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
@Test(dataProvider = "updateEnd2") public void testupdateVertexPreUpdateEnd2(AtlasRelationshipDef existingRelationshipDef,AtlasRelationshipDef newRelationshipDef) { try { AtlasRelationshipDefStoreV2.preUpdateCheck(existingRelationshipDef, newRelationshipDef); fail("expected error"); } catch (AtlasBaseException e) { if (!e.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END2_UPDATE)){ fail("unexpected AtlasErrorCode "+e.getAtlasErrorCode()); } } }
private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
AtlasRelationshipDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasRelationshipDef> { private void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipType relationshipType, AtlasVertex vertex) throws AtlasBaseException { AtlasRelationshipDef existingRelationshipDef = toRelationshipDef(vertex); preUpdateCheck(newRelationshipDef, existingRelationshipDef); AtlasStructDefStoreV2.updateVertexPreUpdate(newRelationshipDef, relationshipType, vertex, typeDefStore); setVertexPropertiesFromRelationshipDef(newRelationshipDef, vertex); } @Inject AtlasRelationshipDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef create(AtlasRelationshipDef relationshipDef, AtlasVertex preCreateResult); @Override List<AtlasRelationshipDef> getAll(); @Override AtlasRelationshipDef getByName(String name); @Override AtlasRelationshipDef getByGuid(String guid); @Override AtlasRelationshipDef update(AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByName(String name, AtlasRelationshipDef relationshipDef); @Override AtlasRelationshipDef updateByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef); static void setVertexPropertiesFromRelationshipDef(AtlasRelationshipDef relationshipDef, AtlasVertex vertex); }
@Test(dataProvider = "invalidAttributeNameWithReservedKeywords") public void testCreateTypeWithReservedKeywords(AtlasEntityDef atlasEntityDef) throws AtlasException { try { ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV2.ALLOW_RESERVED_KEYWORDS, false); entityDefStore.create(atlasEntityDef, null); } catch (AtlasBaseException e) { Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID); } }
@Override public AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasEntityDefStoreV1.create({}, {})", entityDef, preCreateResult); } verifyAttributeTypeReadAccess(entityDef.getAttributeDefs()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, entityDef), "create entity-def ", entityDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(entityDef) : preCreateResult; updateVertexAddReferences(entityDef, vertex); AtlasEntityDef ret = toEntityDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasEntityDefStoreV1.create({}, {}): {}", entityDef, preCreateResult, ret); } return ret; }
AtlasEntityDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEntityDef> { @Override public AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasEntityDefStoreV1.create({}, {})", entityDef, preCreateResult); } verifyAttributeTypeReadAccess(entityDef.getAttributeDefs()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, entityDef), "create entity-def ", entityDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(entityDef) : preCreateResult; updateVertexAddReferences(entityDef, vertex); AtlasEntityDef ret = toEntityDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasEntityDefStoreV1.create({}, {}): {}", entityDef, preCreateResult, ret); } return ret; } }
AtlasEntityDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEntityDef> { @Override public AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasEntityDefStoreV1.create({}, {})", entityDef, preCreateResult); } verifyAttributeTypeReadAccess(entityDef.getAttributeDefs()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, entityDef), "create entity-def ", entityDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(entityDef) : preCreateResult; updateVertexAddReferences(entityDef, vertex); AtlasEntityDef ret = toEntityDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasEntityDefStoreV1.create({}, {}): {}", entityDef, preCreateResult, ret); } return ret; } @Inject AtlasEntityDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); }
AtlasEntityDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEntityDef> { @Override public AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasEntityDefStoreV1.create({}, {})", entityDef, preCreateResult); } verifyAttributeTypeReadAccess(entityDef.getAttributeDefs()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, entityDef), "create entity-def ", entityDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(entityDef) : preCreateResult; updateVertexAddReferences(entityDef, vertex); AtlasEntityDef ret = toEntityDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasEntityDefStoreV1.create({}, {}): {}", entityDef, preCreateResult, ret); } return ret; } @Inject AtlasEntityDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasEntityDef entityDef); @Override AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult); @Override List<AtlasEntityDef> getAll(); @Override AtlasEntityDef getByName(String name); @Override AtlasEntityDef getByGuid(String guid); @Override AtlasEntityDef update(AtlasEntityDef entityDef); @Override AtlasEntityDef updateByName(String name, AtlasEntityDef entityDef); @Override AtlasEntityDef updateByGuid(String guid, AtlasEntityDef entityDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); }
AtlasEntityDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEntityDef> { @Override public AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasEntityDefStoreV1.create({}, {})", entityDef, preCreateResult); } verifyAttributeTypeReadAccess(entityDef.getAttributeDefs()); AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_CREATE, entityDef), "create entity-def ", entityDef.getName()); AtlasVertex vertex = (preCreateResult == null) ? preCreate(entityDef) : preCreateResult; updateVertexAddReferences(entityDef, vertex); AtlasEntityDef ret = toEntityDef(vertex); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasEntityDefStoreV1.create({}, {}): {}", entityDef, preCreateResult, ret); } return ret; } @Inject AtlasEntityDefStoreV2(AtlasTypeDefGraphStoreV2 typeDefStore, AtlasTypeRegistry typeRegistry); @Override AtlasVertex preCreate(AtlasEntityDef entityDef); @Override AtlasEntityDef create(AtlasEntityDef entityDef, AtlasVertex preCreateResult); @Override List<AtlasEntityDef> getAll(); @Override AtlasEntityDef getByName(String name); @Override AtlasEntityDef getByGuid(String guid); @Override AtlasEntityDef update(AtlasEntityDef entityDef); @Override AtlasEntityDef updateByName(String name, AtlasEntityDef entityDef); @Override AtlasEntityDef updateByGuid(String guid, AtlasEntityDef entityDef); @Override AtlasVertex preDeleteByName(String name); @Override AtlasVertex preDeleteByGuid(String guid); }
@Test public void testGet() { try { AtlasTypesDef typesDef = typeDefStore.searchTypesDef(new SearchFilter()); assertNotNull(typesDef.getEnumDefs()); assertEquals(typesDef.getStructDefs().size(), 0); assertNotNull(typesDef.getStructDefs()); assertEquals(typesDef.getClassificationDefs().size(), 0); assertNotNull(typesDef.getClassificationDefs()); assertEquals(typesDef.getEntityDefs().size(), 0); assertNotNull(typesDef.getEntityDefs()); } catch (AtlasBaseException e) { fail("Search of types shouldn't have failed"); } }
@Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test public void testArrayTypeIsValidValue() { for (Object value : validValues) { assertTrue(intArrayType.isValidValue(value), "value=" + value); } for (Object value : invalidValues) { assertFalse(intArrayType.isValidValue(value), "value=" + value); } }
@Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { return false; } for (Object element : objList) { if (!elementType.isValidValue(element)) { return false; } } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { return false; } for (int i = 0; i < arrayLen; i++) { if (!elementType.isValidValue(Array.get(obj, i))) { return false; } } } else { return false; } } return true; }
AtlasArrayType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { return false; } for (Object element : objList) { if (!elementType.isValidValue(element)) { return false; } } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { return false; } for (int i = 0; i < arrayLen; i++) { if (!elementType.isValidValue(Array.get(obj, i))) { return false; } } } else { return false; } } return true; } }
AtlasArrayType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { return false; } for (Object element : objList) { if (!elementType.isValidValue(element)) { return false; } } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { return false; } for (int i = 0; i < arrayLen; i++) { if (!elementType.isValidValue(Array.get(obj, i))) { return false; } } } else { return false; } } return true; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); }
AtlasArrayType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { return false; } for (Object element : objList) { if (!elementType.isValidValue(element)) { return false; } } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { return false; } for (int i = 0; i < arrayLen; i++) { if (!elementType.isValidValue(Array.get(obj, i))) { return false; } } } else { return false; } } return true; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
AtlasArrayType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { return false; } for (Object element : objList) { if (!elementType.isValidValue(element)) { return false; } } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { return false; } for (int i = 0; i < arrayLen; i++) { if (!elementType.isValidValue(Array.get(obj, i))) { return false; } } } else { return false; } } return true; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
@Test(enabled = false, dependsOnMethods = {"testCreateDept"}) public void testUpdateWithMandatoryFields(){ AtlasTypesDef atlasTypesDef = TestUtilsV2.defineInvalidUpdatedDeptEmployeeTypes(); List<AtlasEnumDef> enumDefsToUpdate = atlasTypesDef.getEnumDefs(); List<AtlasClassificationDef> classificationDefsToUpdate = atlasTypesDef.getClassificationDefs(); List<AtlasStructDef> structDefsToUpdate = atlasTypesDef.getStructDefs(); List<AtlasEntityDef> entityDefsToUpdate = atlasTypesDef.getEntityDefs(); AtlasTypesDef onlyEnums = new AtlasTypesDef(enumDefsToUpdate, Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST); AtlasTypesDef onlyStructs = new AtlasTypesDef(Collections.EMPTY_LIST, structDefsToUpdate, Collections.EMPTY_LIST, Collections.EMPTY_LIST); AtlasTypesDef onlyClassification = new AtlasTypesDef(Collections.EMPTY_LIST, Collections.EMPTY_LIST, classificationDefsToUpdate, Collections.EMPTY_LIST); AtlasTypesDef onlyEntities = new AtlasTypesDef(Collections.EMPTY_LIST, Collections.EMPTY_LIST, Collections.EMPTY_LIST, entityDefsToUpdate); try { AtlasTypesDef updated = typeDefStore.updateTypesDef(onlyEnums); assertNotNull(updated); } catch (AtlasBaseException ignored) {} try { AtlasTypesDef updated = typeDefStore.updateTypesDef(onlyClassification); assertNotNull(updated); assertEquals(updated.getClassificationDefs().size(), 0, "Updates should've failed"); } catch (AtlasBaseException ignored) {} try { AtlasTypesDef updated = typeDefStore.updateTypesDef(onlyStructs); assertNotNull(updated); assertEquals(updated.getStructDefs().size(), 0, "Updates should've failed"); } catch (AtlasBaseException ignored) {} try { AtlasTypesDef updated = typeDefStore.updateTypesDef(onlyEntities); assertNotNull(updated); assertEquals(updated.getEntityDefs().size(), 0, "Updates should've failed"); } catch (AtlasBaseException ignored) {} }
@Override @GraphTransaction public AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships{}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); try { ttr.updateTypes(typesDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_NAME_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } AtlasTypesDef ret = updateGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships{}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); try { ttr.updateTypes(typesDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_NAME_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } AtlasTypesDef ret = updateGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships{}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); try { ttr.updateTypes(typesDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_NAME_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } AtlasTypesDef ret = updateGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships{}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); try { ttr.updateTypes(typesDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_NAME_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } AtlasTypesDef ret = updateGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships{}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); try { ttr.updateTypes(typesDef); } catch (AtlasBaseException e) { if (AtlasErrorCode.TYPE_NAME_NOT_FOUND == e.getAtlasErrorCode()) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, e.getMessage()); } else { throw e; } } AtlasTypesDef ret = updateGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.updateTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = {"testUpdate"}, dataProvider = "allCreatedTypes") public void testDelete(AtlasTypesDef atlasTypesDef){ try { typeDefStore.deleteTypesDef(atlasTypesDef); } catch (AtlasBaseException e) { fail("Deletion should've succeeded"); } }
@Override @GraphTransaction public void deleteTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); AtlasDefStore<AtlasEnumDef> enumDefStore = getEnumDefStore(ttr); AtlasDefStore<AtlasStructDef> structDefStore = getStructDefStore(ttr); AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr); AtlasDefStore<AtlasEntityDef> entityDefStore = getEntityDefStore(ttr); AtlasDefStore<AtlasRelationshipDef> relationshipDefStore = getRelationshipDefStore(ttr); AtlasDefStore<AtlasBusinessMetadataDef> businessMetadataDefStore = getBusinessMetadataDefStore(ttr); List<AtlasVertex> preDeleteStructDefs = new ArrayList<>(); List<AtlasVertex> preDeleteClassifiDefs = new ArrayList<>(); List<AtlasVertex> preDeleteEntityDefs = new ArrayList<>(); List<AtlasVertex> preDeleteRelationshipDefs = new ArrayList<>(); if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByGuid(relationshipDef.getGuid())); } else { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByName(relationshipDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { preDeleteStructDefs.add(structDefStore.preDeleteByGuid(structDef.getGuid())); } else { preDeleteStructDefs.add(structDefStore.preDeleteByName(structDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { for (AtlasClassificationDef classifiDef : typesDef.getClassificationDefs()) { if (StringUtils.isNotBlank(classifiDef.getGuid())) { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByGuid(classifiDef.getGuid())); } else { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByName(classifiDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { preDeleteEntityDefs.add(entityDefStore.preDeleteByGuid(entityDef.getGuid())); } else { preDeleteEntityDefs.add(entityDefStore.preDeleteByName(entityDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { int i = 0; for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { relationshipDefStore.deleteByGuid(relationshipDef.getGuid(), preDeleteRelationshipDefs.get(i)); } else { relationshipDefStore.deleteByName(relationshipDef.getName(), preDeleteRelationshipDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { int i = 0; for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { structDefStore.deleteByGuid(structDef.getGuid(), preDeleteStructDefs.get(i)); } else { structDefStore.deleteByName(structDef.getName(), preDeleteStructDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { 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)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { int i = 0; for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { entityDefStore.deleteByGuid(entityDef.getGuid(), preDeleteEntityDefs.get(i)); } else { entityDefStore.deleteByName(entityDef.getName(), preDeleteEntityDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) { for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) { if (StringUtils.isNotBlank(enumDef.getGuid())) { enumDefStore.deleteByGuid(enumDef.getGuid(), null); } else { enumDefStore.deleteByName(enumDef.getName(), null); } } } if (CollectionUtils.isNotEmpty(typesDef.getBusinessMetadataDefs())) { for (AtlasBusinessMetadataDef businessMetadataDef : typesDef.getBusinessMetadataDefs()) { if (StringUtils.isNotBlank(businessMetadataDef.getGuid())) { businessMetadataDefStore.deleteByGuid(businessMetadataDef.getGuid(), null); } else { businessMetadataDefStore.deleteByName(businessMetadataDef.getName(), null); } } } ttr.removeTypesDef(typesDef); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs())); } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); AtlasDefStore<AtlasEnumDef> enumDefStore = getEnumDefStore(ttr); AtlasDefStore<AtlasStructDef> structDefStore = getStructDefStore(ttr); AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr); AtlasDefStore<AtlasEntityDef> entityDefStore = getEntityDefStore(ttr); AtlasDefStore<AtlasRelationshipDef> relationshipDefStore = getRelationshipDefStore(ttr); AtlasDefStore<AtlasBusinessMetadataDef> businessMetadataDefStore = getBusinessMetadataDefStore(ttr); List<AtlasVertex> preDeleteStructDefs = new ArrayList<>(); List<AtlasVertex> preDeleteClassifiDefs = new ArrayList<>(); List<AtlasVertex> preDeleteEntityDefs = new ArrayList<>(); List<AtlasVertex> preDeleteRelationshipDefs = new ArrayList<>(); if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByGuid(relationshipDef.getGuid())); } else { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByName(relationshipDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { preDeleteStructDefs.add(structDefStore.preDeleteByGuid(structDef.getGuid())); } else { preDeleteStructDefs.add(structDefStore.preDeleteByName(structDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { for (AtlasClassificationDef classifiDef : typesDef.getClassificationDefs()) { if (StringUtils.isNotBlank(classifiDef.getGuid())) { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByGuid(classifiDef.getGuid())); } else { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByName(classifiDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { preDeleteEntityDefs.add(entityDefStore.preDeleteByGuid(entityDef.getGuid())); } else { preDeleteEntityDefs.add(entityDefStore.preDeleteByName(entityDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { int i = 0; for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { relationshipDefStore.deleteByGuid(relationshipDef.getGuid(), preDeleteRelationshipDefs.get(i)); } else { relationshipDefStore.deleteByName(relationshipDef.getName(), preDeleteRelationshipDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { int i = 0; for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { structDefStore.deleteByGuid(structDef.getGuid(), preDeleteStructDefs.get(i)); } else { structDefStore.deleteByName(structDef.getName(), preDeleteStructDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { 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)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { int i = 0; for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { entityDefStore.deleteByGuid(entityDef.getGuid(), preDeleteEntityDefs.get(i)); } else { entityDefStore.deleteByName(entityDef.getName(), preDeleteEntityDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) { for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) { if (StringUtils.isNotBlank(enumDef.getGuid())) { enumDefStore.deleteByGuid(enumDef.getGuid(), null); } else { enumDefStore.deleteByName(enumDef.getName(), null); } } } if (CollectionUtils.isNotEmpty(typesDef.getBusinessMetadataDefs())) { for (AtlasBusinessMetadataDef businessMetadataDef : typesDef.getBusinessMetadataDefs()) { if (StringUtils.isNotBlank(businessMetadataDef.getGuid())) { businessMetadataDefStore.deleteByGuid(businessMetadataDef.getGuid(), null); } else { businessMetadataDefStore.deleteByName(businessMetadataDef.getName(), null); } } } ttr.removeTypesDef(typesDef); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs())); } } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); AtlasDefStore<AtlasEnumDef> enumDefStore = getEnumDefStore(ttr); AtlasDefStore<AtlasStructDef> structDefStore = getStructDefStore(ttr); AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr); AtlasDefStore<AtlasEntityDef> entityDefStore = getEntityDefStore(ttr); AtlasDefStore<AtlasRelationshipDef> relationshipDefStore = getRelationshipDefStore(ttr); AtlasDefStore<AtlasBusinessMetadataDef> businessMetadataDefStore = getBusinessMetadataDefStore(ttr); List<AtlasVertex> preDeleteStructDefs = new ArrayList<>(); List<AtlasVertex> preDeleteClassifiDefs = new ArrayList<>(); List<AtlasVertex> preDeleteEntityDefs = new ArrayList<>(); List<AtlasVertex> preDeleteRelationshipDefs = new ArrayList<>(); if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByGuid(relationshipDef.getGuid())); } else { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByName(relationshipDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { preDeleteStructDefs.add(structDefStore.preDeleteByGuid(structDef.getGuid())); } else { preDeleteStructDefs.add(structDefStore.preDeleteByName(structDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { for (AtlasClassificationDef classifiDef : typesDef.getClassificationDefs()) { if (StringUtils.isNotBlank(classifiDef.getGuid())) { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByGuid(classifiDef.getGuid())); } else { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByName(classifiDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { preDeleteEntityDefs.add(entityDefStore.preDeleteByGuid(entityDef.getGuid())); } else { preDeleteEntityDefs.add(entityDefStore.preDeleteByName(entityDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { int i = 0; for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { relationshipDefStore.deleteByGuid(relationshipDef.getGuid(), preDeleteRelationshipDefs.get(i)); } else { relationshipDefStore.deleteByName(relationshipDef.getName(), preDeleteRelationshipDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { int i = 0; for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { structDefStore.deleteByGuid(structDef.getGuid(), preDeleteStructDefs.get(i)); } else { structDefStore.deleteByName(structDef.getName(), preDeleteStructDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { 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)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { int i = 0; for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { entityDefStore.deleteByGuid(entityDef.getGuid(), preDeleteEntityDefs.get(i)); } else { entityDefStore.deleteByName(entityDef.getName(), preDeleteEntityDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) { for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) { if (StringUtils.isNotBlank(enumDef.getGuid())) { enumDefStore.deleteByGuid(enumDef.getGuid(), null); } else { enumDefStore.deleteByName(enumDef.getName(), null); } } } if (CollectionUtils.isNotEmpty(typesDef.getBusinessMetadataDefs())) { for (AtlasBusinessMetadataDef businessMetadataDef : typesDef.getBusinessMetadataDefs()) { if (StringUtils.isNotBlank(businessMetadataDef.getGuid())) { businessMetadataDefStore.deleteByGuid(businessMetadataDef.getGuid(), null); } else { businessMetadataDefStore.deleteByName(businessMetadataDef.getName(), null); } } } ttr.removeTypesDef(typesDef); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs())); } } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); AtlasDefStore<AtlasEnumDef> enumDefStore = getEnumDefStore(ttr); AtlasDefStore<AtlasStructDef> structDefStore = getStructDefStore(ttr); AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr); AtlasDefStore<AtlasEntityDef> entityDefStore = getEntityDefStore(ttr); AtlasDefStore<AtlasRelationshipDef> relationshipDefStore = getRelationshipDefStore(ttr); AtlasDefStore<AtlasBusinessMetadataDef> businessMetadataDefStore = getBusinessMetadataDefStore(ttr); List<AtlasVertex> preDeleteStructDefs = new ArrayList<>(); List<AtlasVertex> preDeleteClassifiDefs = new ArrayList<>(); List<AtlasVertex> preDeleteEntityDefs = new ArrayList<>(); List<AtlasVertex> preDeleteRelationshipDefs = new ArrayList<>(); if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByGuid(relationshipDef.getGuid())); } else { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByName(relationshipDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { preDeleteStructDefs.add(structDefStore.preDeleteByGuid(structDef.getGuid())); } else { preDeleteStructDefs.add(structDefStore.preDeleteByName(structDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { for (AtlasClassificationDef classifiDef : typesDef.getClassificationDefs()) { if (StringUtils.isNotBlank(classifiDef.getGuid())) { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByGuid(classifiDef.getGuid())); } else { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByName(classifiDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { preDeleteEntityDefs.add(entityDefStore.preDeleteByGuid(entityDef.getGuid())); } else { preDeleteEntityDefs.add(entityDefStore.preDeleteByName(entityDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { int i = 0; for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { relationshipDefStore.deleteByGuid(relationshipDef.getGuid(), preDeleteRelationshipDefs.get(i)); } else { relationshipDefStore.deleteByName(relationshipDef.getName(), preDeleteRelationshipDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { int i = 0; for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { structDefStore.deleteByGuid(structDef.getGuid(), preDeleteStructDefs.get(i)); } else { structDefStore.deleteByName(structDef.getName(), preDeleteStructDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { 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)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { int i = 0; for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { entityDefStore.deleteByGuid(entityDef.getGuid(), preDeleteEntityDefs.get(i)); } else { entityDefStore.deleteByName(entityDef.getName(), preDeleteEntityDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) { for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) { if (StringUtils.isNotBlank(enumDef.getGuid())) { enumDefStore.deleteByGuid(enumDef.getGuid(), null); } else { enumDefStore.deleteByName(enumDef.getName(), null); } } } if (CollectionUtils.isNotEmpty(typesDef.getBusinessMetadataDefs())) { for (AtlasBusinessMetadataDef businessMetadataDef : typesDef.getBusinessMetadataDefs()) { if (StringUtils.isNotBlank(businessMetadataDef.getGuid())) { businessMetadataDefStore.deleteByGuid(businessMetadataDef.getGuid(), null); } else { businessMetadataDefStore.deleteByName(businessMetadataDef.getName(), null); } } } ttr.removeTypesDef(typesDef); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs())); } } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); AtlasDefStore<AtlasEnumDef> enumDefStore = getEnumDefStore(ttr); AtlasDefStore<AtlasStructDef> structDefStore = getStructDefStore(ttr); AtlasDefStore<AtlasClassificationDef> classifiDefStore = getClassificationDefStore(ttr); AtlasDefStore<AtlasEntityDef> entityDefStore = getEntityDefStore(ttr); AtlasDefStore<AtlasRelationshipDef> relationshipDefStore = getRelationshipDefStore(ttr); AtlasDefStore<AtlasBusinessMetadataDef> businessMetadataDefStore = getBusinessMetadataDefStore(ttr); List<AtlasVertex> preDeleteStructDefs = new ArrayList<>(); List<AtlasVertex> preDeleteClassifiDefs = new ArrayList<>(); List<AtlasVertex> preDeleteEntityDefs = new ArrayList<>(); List<AtlasVertex> preDeleteRelationshipDefs = new ArrayList<>(); if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByGuid(relationshipDef.getGuid())); } else { preDeleteRelationshipDefs.add(relationshipDefStore.preDeleteByName(relationshipDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { preDeleteStructDefs.add(structDefStore.preDeleteByGuid(structDef.getGuid())); } else { preDeleteStructDefs.add(structDefStore.preDeleteByName(structDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { for (AtlasClassificationDef classifiDef : typesDef.getClassificationDefs()) { if (StringUtils.isNotBlank(classifiDef.getGuid())) { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByGuid(classifiDef.getGuid())); } else { preDeleteClassifiDefs.add(classifiDefStore.preDeleteByName(classifiDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { preDeleteEntityDefs.add(entityDefStore.preDeleteByGuid(entityDef.getGuid())); } else { preDeleteEntityDefs.add(entityDefStore.preDeleteByName(entityDef.getName())); } } } if (CollectionUtils.isNotEmpty(typesDef.getRelationshipDefs())) { int i = 0; for (AtlasRelationshipDef relationshipDef : typesDef.getRelationshipDefs()) { if (StringUtils.isNotBlank(relationshipDef.getGuid())) { relationshipDefStore.deleteByGuid(relationshipDef.getGuid(), preDeleteRelationshipDefs.get(i)); } else { relationshipDefStore.deleteByName(relationshipDef.getName(), preDeleteRelationshipDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) { int i = 0; for (AtlasStructDef structDef : typesDef.getStructDefs()) { if (StringUtils.isNotBlank(structDef.getGuid())) { structDefStore.deleteByGuid(structDef.getGuid(), preDeleteStructDefs.get(i)); } else { structDefStore.deleteByName(structDef.getName(), preDeleteStructDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) { 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)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) { int i = 0; for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) { if (StringUtils.isNotBlank(entityDef.getGuid())) { entityDefStore.deleteByGuid(entityDef.getGuid(), preDeleteEntityDefs.get(i)); } else { entityDefStore.deleteByName(entityDef.getName(), preDeleteEntityDefs.get(i)); } i++; } } if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) { for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) { if (StringUtils.isNotBlank(enumDef.getGuid())) { enumDefStore.deleteByGuid(enumDef.getGuid(), null); } else { enumDefStore.deleteByName(enumDef.getName(), null); } } } if (CollectionUtils.isNotEmpty(typesDef.getBusinessMetadataDefs())) { for (AtlasBusinessMetadataDef businessMetadataDef : typesDef.getBusinessMetadataDefs()) { if (StringUtils.isNotBlank(businessMetadataDef.getGuid())) { businessMetadataDefStore.deleteByGuid(businessMetadataDef.getGuid(), null); } else { businessMetadataDefStore.deleteByName(businessMetadataDef.getName(), null); } } } ttr.removeTypesDef(typesDef); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.deleteTypesDef(enums={}, structs={}, classfications={}, entities={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs())); } } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test public void deleteTypeByName() throws IOException { try { final String HIVEDB_v2_JSON = "hiveDBv2"; final String hiveDB2 = "hive_db_v2"; final String relationshipDefName = "cluster_hosts_relationship"; final String hostEntityDef = "host"; final String clusterEntityDef = "cluster"; AtlasTypesDef typesDef = TestResourceFileUtils.readObjectFromJson(".", HIVEDB_v2_JSON, AtlasTypesDef.class); typeDefStore.createTypesDef(typesDef); typeDefStore.deleteTypeByName(hiveDB2); typeDefStore.deleteTypeByName(relationshipDefName); typeDefStore.deleteTypeByName(hostEntityDef); typeDefStore.deleteTypeByName(clusterEntityDef); } catch (AtlasBaseException e) { fail("Deletion should've succeeded"); } }
@Override @GraphTransaction public void deleteTypeByName(String typeName) throws AtlasBaseException { AtlasType atlasType = typeRegistry.getType(typeName); if (atlasType == null) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS.TYPE_NAME_NOT_FOUND, typeName); } AtlasTypesDef typesDef = new AtlasTypesDef(); AtlasBaseTypeDef baseTypeDef = getByNameNoAuthz(typeName); if (baseTypeDef instanceof AtlasClassificationDef) { typesDef.setClassificationDefs(Collections.singletonList((AtlasClassificationDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEntityDef) { typesDef.setEntityDefs(Collections.singletonList((AtlasEntityDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEnumDef) { typesDef.setEnumDefs(Collections.singletonList((AtlasEnumDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasRelationshipDef) { typesDef.setRelationshipDefs(Collections.singletonList((AtlasRelationshipDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasBusinessMetadataDef) { typesDef.setBusinessMetadataDefs(Collections.singletonList((AtlasBusinessMetadataDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasStructDef) { typesDef.setStructDefs(Collections.singletonList((AtlasStructDef) baseTypeDef)); } deleteTypesDef(typesDef); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypeByName(String typeName) throws AtlasBaseException { AtlasType atlasType = typeRegistry.getType(typeName); if (atlasType == null) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS.TYPE_NAME_NOT_FOUND, typeName); } AtlasTypesDef typesDef = new AtlasTypesDef(); AtlasBaseTypeDef baseTypeDef = getByNameNoAuthz(typeName); if (baseTypeDef instanceof AtlasClassificationDef) { typesDef.setClassificationDefs(Collections.singletonList((AtlasClassificationDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEntityDef) { typesDef.setEntityDefs(Collections.singletonList((AtlasEntityDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEnumDef) { typesDef.setEnumDefs(Collections.singletonList((AtlasEnumDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasRelationshipDef) { typesDef.setRelationshipDefs(Collections.singletonList((AtlasRelationshipDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasBusinessMetadataDef) { typesDef.setBusinessMetadataDefs(Collections.singletonList((AtlasBusinessMetadataDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasStructDef) { typesDef.setStructDefs(Collections.singletonList((AtlasStructDef) baseTypeDef)); } deleteTypesDef(typesDef); } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypeByName(String typeName) throws AtlasBaseException { AtlasType atlasType = typeRegistry.getType(typeName); if (atlasType == null) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS.TYPE_NAME_NOT_FOUND, typeName); } AtlasTypesDef typesDef = new AtlasTypesDef(); AtlasBaseTypeDef baseTypeDef = getByNameNoAuthz(typeName); if (baseTypeDef instanceof AtlasClassificationDef) { typesDef.setClassificationDefs(Collections.singletonList((AtlasClassificationDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEntityDef) { typesDef.setEntityDefs(Collections.singletonList((AtlasEntityDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEnumDef) { typesDef.setEnumDefs(Collections.singletonList((AtlasEnumDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasRelationshipDef) { typesDef.setRelationshipDefs(Collections.singletonList((AtlasRelationshipDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasBusinessMetadataDef) { typesDef.setBusinessMetadataDefs(Collections.singletonList((AtlasBusinessMetadataDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasStructDef) { typesDef.setStructDefs(Collections.singletonList((AtlasStructDef) baseTypeDef)); } deleteTypesDef(typesDef); } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypeByName(String typeName) throws AtlasBaseException { AtlasType atlasType = typeRegistry.getType(typeName); if (atlasType == null) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS.TYPE_NAME_NOT_FOUND, typeName); } AtlasTypesDef typesDef = new AtlasTypesDef(); AtlasBaseTypeDef baseTypeDef = getByNameNoAuthz(typeName); if (baseTypeDef instanceof AtlasClassificationDef) { typesDef.setClassificationDefs(Collections.singletonList((AtlasClassificationDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEntityDef) { typesDef.setEntityDefs(Collections.singletonList((AtlasEntityDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEnumDef) { typesDef.setEnumDefs(Collections.singletonList((AtlasEnumDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasRelationshipDef) { typesDef.setRelationshipDefs(Collections.singletonList((AtlasRelationshipDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasBusinessMetadataDef) { typesDef.setBusinessMetadataDefs(Collections.singletonList((AtlasBusinessMetadataDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasStructDef) { typesDef.setStructDefs(Collections.singletonList((AtlasStructDef) baseTypeDef)); } deleteTypesDef(typesDef); } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public void deleteTypeByName(String typeName) throws AtlasBaseException { AtlasType atlasType = typeRegistry.getType(typeName); if (atlasType == null) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS.TYPE_NAME_NOT_FOUND, typeName); } AtlasTypesDef typesDef = new AtlasTypesDef(); AtlasBaseTypeDef baseTypeDef = getByNameNoAuthz(typeName); if (baseTypeDef instanceof AtlasClassificationDef) { typesDef.setClassificationDefs(Collections.singletonList((AtlasClassificationDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEntityDef) { typesDef.setEntityDefs(Collections.singletonList((AtlasEntityDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasEnumDef) { typesDef.setEnumDefs(Collections.singletonList((AtlasEnumDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasRelationshipDef) { typesDef.setRelationshipDefs(Collections.singletonList((AtlasRelationshipDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasBusinessMetadataDef) { typesDef.setBusinessMetadataDefs(Collections.singletonList((AtlasBusinessMetadataDef) baseTypeDef)); } else if (baseTypeDef instanceof AtlasStructDef) { typesDef.setStructDefs(Collections.singletonList((AtlasStructDef) baseTypeDef)); } deleteTypesDef(typesDef); } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testCreateWithValidAttributes(){ AtlasTypesDef hiveTypes = TestUtilsV2.defineHiveTypes(); try { AtlasTypesDef createdTypes = typeDefStore.createTypesDef(hiveTypes); assertEquals(hiveTypes.getEnumDefs(), createdTypes.getEnumDefs(), "Data integrity issue while persisting"); assertEquals(hiveTypes.getStructDefs(), createdTypes.getStructDefs(), "Data integrity issue while persisting"); assertEquals(hiveTypes.getClassificationDefs(), createdTypes.getClassificationDefs(), "Data integrity issue while persisting"); assertEquals(hiveTypes.getEntityDefs(), createdTypes.getEntityDefs(), "Data integrity issue while persisting"); } catch (AtlasBaseException e) { fail("Hive Type creation should've succeeded"); } }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testCreateWithNestedContainerAttributes() { AtlasTypesDef typesDef = TestUtilsV2.defineTypeWithNestedCollectionAttributes(); try { AtlasTypesDef createdTypes = typeDefStore.createTypesDef(typesDef); assertEquals(typesDef.getEnumDefs(), createdTypes.getEnumDefs(), "Data integrity issue while persisting"); assertEquals(typesDef.getStructDefs(), createdTypes.getStructDefs(), "Data integrity issue while persisting"); assertEquals(typesDef.getClassificationDefs(), createdTypes.getClassificationDefs(), "Data integrity issue while persisting"); assertEquals(typesDef.getEntityDefs(), createdTypes.getEntityDefs(), "Data integrity issue while persisting"); } catch (AtlasBaseException e) { fail("creation of type with nested-container attributes should've succeeded"); } }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testCreateWithValidSuperTypes(){ List<AtlasClassificationDef> classificationDefs = TestUtilsV2.getClassificationWithValidSuperType(); AtlasTypesDef toCreate = new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), classificationDefs, Collections.<AtlasEntityDef>emptyList()); try { AtlasTypesDef created = typeDefStore.createTypesDef(toCreate); assertEquals(created.getClassificationDefs(), toCreate.getClassificationDefs(), "Classification creation with valid supertype should've succeeded"); } catch (AtlasBaseException e) { fail("Classification creation with valid supertype should've succeeded"); } List<AtlasEntityDef> entityDefs = TestUtilsV2.getEntityWithValidSuperType(); toCreate = new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), Collections.<AtlasClassificationDef>emptyList(), entityDefs); try { AtlasTypesDef created = typeDefStore.createTypesDef(toCreate); assertEquals(created.getEntityDefs(), toCreate.getEntityDefs(), "Entity creation with valid supertype should've succeeded"); } catch (AtlasBaseException e) { fail("Entity creation with valid supertype should've succeeded"); } }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testCreateWithInvalidSuperTypes(){ AtlasTypesDef typesDef; AtlasClassificationDef classificationDef = TestUtilsV2.getClassificationWithInvalidSuperType(); typesDef = new AtlasTypesDef(); typesDef.getClassificationDefs().add(classificationDef); try { AtlasTypesDef created = typeDefStore.createTypesDef(typesDef); fail("Classification creation with invalid supertype should've failed"); } catch (AtlasBaseException e) { typesDef = null; } AtlasEntityDef entityDef = TestUtilsV2.getEntityWithInvalidSuperType(); typesDef = new AtlasTypesDef(); typesDef.getEntityDefs().add(entityDef); try { AtlasTypesDef created = typeDefStore.createTypesDef(typesDef); fail("Entity creation with invalid supertype should've failed"); } catch (AtlasBaseException e) {} }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testCreateClassificationDefWithValidEntityType(){ final String entityTypeName ="testCreateClassificationDefWithValidEntityTypeEntity1"; final String classificationTypeName ="testCreateClassificationDefWithValidEntityTypeClassification1"; List<AtlasEntityDef> entityDefs = TestUtilsV2.getEntityWithName(entityTypeName); List<AtlasClassificationDef> classificationDefs = TestUtilsV2.getClassificationWithName(classificationTypeName); Set<String> entityTypeNames = new HashSet<String>(); entityTypeNames.add(entityTypeName); classificationDefs.get(0).setEntityTypes(entityTypeNames); AtlasTypesDef toCreate = new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), classificationDefs, entityDefs); try { AtlasTypesDef created = typeDefStore.createTypesDef(toCreate); assertEquals(created.getClassificationDefs(), toCreate.getClassificationDefs(), "Classification creation with valid entitytype should've succeeded"); } catch (AtlasBaseException e) { fail("Classification creation with valid entitytype should've succeeded. Failed with " + e.getMessage()); } }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testCreateWithInvalidEntityType(){ final String classificationTypeName ="testCreateClassificationDefWithInvalidEntityTypeClassification1"; List<AtlasClassificationDef> classificationDefs = TestUtilsV2.getClassificationWithName(classificationTypeName); Set<String> entityTypeNames = new HashSet<String>(); entityTypeNames.add("cccc"); classificationDefs.get(0).setEntityTypes(entityTypeNames); AtlasTypesDef toCreate = new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), classificationDefs, Collections.<AtlasEntityDef>emptyList()); try { AtlasTypesDef created = typeDefStore.createTypesDef(toCreate); fail("Classification creation with invalid entitytype should've failed"); } catch (AtlasBaseException e) { } }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testCreateWithInvalidEntityType2(){ final String classificationTypeName1 ="testCreateClassificationDefWithInvalidEntityType2Classification1"; final String classificationTypeName2 ="testCreateClassificationDefWithInvalidEntityType2Classification2"; final String entityTypeName1 ="testCreateClassificationDefWithInvalidEntityType2Entity1"; AtlasClassificationDef classificationDef1 = TestUtilsV2.getSingleClassificationWithName(classificationTypeName1); AtlasClassificationDef classificationDef2 = TestUtilsV2.getSingleClassificationWithName(classificationTypeName2); List<AtlasEntityDef> entityDefs = TestUtilsV2.getEntityWithName(entityTypeName1); Set<String> entityTypeNames = new HashSet<String>(); entityTypeNames.add(entityTypeName1); Set<String> superTypes = new HashSet<String>(); superTypes.add(classificationTypeName1); classificationDef2.setSuperTypes(superTypes); classificationDef1.setEntityTypes(entityTypeNames); TestUtilsV2.populateSystemAttributes(classificationDef1); TestUtilsV2.populateSystemAttributes(classificationDef2); List<AtlasClassificationDef> classificationDefs = Arrays.asList(classificationDef1,classificationDef2); AtlasTypesDef toCreate = new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), classificationDefs, Collections.<AtlasEntityDef>emptyList()); try { AtlasTypesDef created = typeDefStore.createTypesDef(toCreate); fail("Classification creation with invalid entitytype should've failed"); } catch (AtlasBaseException e) { } }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test public void testArrayTypeGetNormalizedValue() { assertNull(intArrayType.getNormalizedValue(null), "value=" + null); for (Object value : validValues) { if (value == null) { continue; } Collection normalizedValue = intArrayType.getNormalizedValue(value); assertNotNull(normalizedValue, "value=" + value); } for (Object value : invalidValues) { assertNull(intArrayType.getNormalizedValue(value), "value=" + value); } }
@Override public Collection<?> getNormalizedValue(Object obj) { Collection<Object> ret = null; if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), List.class); } if (obj instanceof List || obj instanceof Set) { Collection collObj = (Collection) obj; if (isValidElementCount(collObj.size())) { ret = new ArrayList<>(collObj.size()); for (Object element : collObj) { if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } else if (obj != null && obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (isValidElementCount(arrayLen)) { ret = new ArrayList<>(arrayLen); for (int i = 0; i < arrayLen; i++) { Object element = Array.get(obj, i); if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } return ret; }
AtlasArrayType extends AtlasType { @Override public Collection<?> getNormalizedValue(Object obj) { Collection<Object> ret = null; if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), List.class); } if (obj instanceof List || obj instanceof Set) { Collection collObj = (Collection) obj; if (isValidElementCount(collObj.size())) { ret = new ArrayList<>(collObj.size()); for (Object element : collObj) { if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } else if (obj != null && obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (isValidElementCount(arrayLen)) { ret = new ArrayList<>(arrayLen); for (int i = 0; i < arrayLen; i++) { Object element = Array.get(obj, i); if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } return ret; } }
AtlasArrayType extends AtlasType { @Override public Collection<?> getNormalizedValue(Object obj) { Collection<Object> ret = null; if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), List.class); } if (obj instanceof List || obj instanceof Set) { Collection collObj = (Collection) obj; if (isValidElementCount(collObj.size())) { ret = new ArrayList<>(collObj.size()); for (Object element : collObj) { if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } else if (obj != null && obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (isValidElementCount(arrayLen)) { ret = new ArrayList<>(arrayLen); for (int i = 0; i < arrayLen; i++) { Object element = Array.get(obj, i); if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); }
AtlasArrayType extends AtlasType { @Override public Collection<?> getNormalizedValue(Object obj) { Collection<Object> ret = null; if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), List.class); } if (obj instanceof List || obj instanceof Set) { Collection collObj = (Collection) obj; if (isValidElementCount(collObj.size())) { ret = new ArrayList<>(collObj.size()); for (Object element : collObj) { if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } else if (obj != null && obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (isValidElementCount(arrayLen)) { ret = new ArrayList<>(arrayLen); for (int i = 0; i < arrayLen; i++) { Object element = Array.get(obj, i); if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
AtlasArrayType extends AtlasType { @Override public Collection<?> getNormalizedValue(Object obj) { Collection<Object> ret = null; if (obj instanceof String) { obj = AtlasType.fromJson(obj.toString(), List.class); } if (obj instanceof List || obj instanceof Set) { Collection collObj = (Collection) obj; if (isValidElementCount(collObj.size())) { ret = new ArrayList<>(collObj.size()); for (Object element : collObj) { if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } else if (obj != null && obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (isValidElementCount(arrayLen)) { ret = new ArrayList<>(arrayLen); for (int i = 0; i < arrayLen; i++) { Object element = Array.get(obj, i); if (element != null) { Object normalizedValue = elementType.getNormalizedValue(element); if (normalizedValue != null) { ret.add(normalizedValue); } else { ret = null; break; } } else { ret.add(element); } } } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
@Test(dependsOnMethods = "testGet") public void testCreateWithInvalidEntityType3(){ final String classificationTypeName1 ="testCreateClassificationDefWithInvalidEntityType3Classification1"; final String classificationTypeName2 ="testCreateClassificationDefWithInvalidEntityType3Classification2"; final String entityTypeName1 ="testCreateClassificationDefWithInvalidEntityType3Entity1"; final String entityTypeName2 ="testCreateClassificationDefWithInvalidEntityType3Entity2"; AtlasClassificationDef classificationDef1 = TestUtilsV2.getSingleClassificationWithName(classificationTypeName1); AtlasClassificationDef classificationDef2 = TestUtilsV2.getSingleClassificationWithName(classificationTypeName2); AtlasEntityDef entityDef1 = TestUtilsV2.getSingleEntityWithName(entityTypeName1); AtlasEntityDef entityDef2 = TestUtilsV2.getSingleEntityWithName(entityTypeName2); Set<String> entityTypeNames1 = new HashSet<String>(); entityTypeNames1.add(entityTypeName1); Set<String> entityTypeNames2 = new HashSet<String>(); entityTypeNames2.add(entityTypeName2); Set<String> superTypes = new HashSet<String>(); superTypes.add(classificationTypeName1); classificationDef1.setEntityTypes(entityTypeNames1); classificationDef2.setSuperTypes(superTypes); classificationDef2.setEntityTypes(entityTypeNames2); TestUtilsV2.populateSystemAttributes(classificationDef1); TestUtilsV2.populateSystemAttributes(classificationDef2); TestUtilsV2.populateSystemAttributes(entityDef1); TestUtilsV2.populateSystemAttributes(entityDef2); List<AtlasClassificationDef> classificationDefs = Arrays.asList(classificationDef1,classificationDef2); List<AtlasEntityDef> entityDefs = Arrays.asList(entityDef1,entityDef2); AtlasTypesDef toCreate = new AtlasTypesDef(Collections.<AtlasEnumDef>emptyList(), Collections.<AtlasStructDef>emptyList(), classificationDefs, entityDefs); try { AtlasTypesDef created = typeDefStore.createTypesDef(toCreate); fail("Classification creation with invalid entitytype should've failed"); } catch (AtlasBaseException e) { } }
@Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override @GraphTransaction public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classifications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit(); tryTypeCreation(typesDef, ttr); AtlasTypesDef ret = addToGraphStore(typesDef, ttr); try { ttr.updateTypes(ret); } catch (AtlasBaseException e) { LOG.error("failed to update the registry after updating the store", e); } if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasTypeDefGraphStore.createTypesDef(enums={}, structs={}, classfications={}, entities={}, relationships={}, businessMetadataDefs={})", CollectionUtils.size(typesDef.getEnumDefs()), CollectionUtils.size(typesDef.getStructDefs()), CollectionUtils.size(typesDef.getClassificationDefs()), CollectionUtils.size(typesDef.getEntityDefs()), CollectionUtils.size(typesDef.getRelationshipDefs()), CollectionUtils.size(typesDef.getBusinessMetadataDefs())); } return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "testGet") public void testSearchFunctionality() { SearchFilter searchFilter = new SearchFilter(); searchFilter.setParam(SearchFilter.PARAM_SUPERTYPE, "Person"); try { AtlasTypesDef typesDef = typeDefStore.searchTypesDef(searchFilter); assertNotNull(typesDef); assertNotNull(typesDef.getEntityDefs()); assertEquals(typesDef.getEntityDefs().size(), 3); } catch (AtlasBaseException e) { fail("Search should've succeeded", e); } }
@Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasTypesDef searchTypesDef(SearchFilter searchFilter) throws AtlasBaseException { final AtlasTypesDef typesDef = new AtlasTypesDef(); Predicate searchPredicates = FilterUtil.getPredicateFromSearchFilter(searchFilter); for(AtlasEnumType enumType : typeRegistry.getAllEnumTypes()) { if (searchPredicates.evaluate(enumType)) { typesDef.getEnumDefs().add(enumType.getEnumDef()); } } for(AtlasStructType structType : typeRegistry.getAllStructTypes()) { if (searchPredicates.evaluate(structType)) { typesDef.getStructDefs().add(structType.getStructDef()); } } for(AtlasClassificationType classificationType : typeRegistry.getAllClassificationTypes()) { if (searchPredicates.evaluate(classificationType)) { typesDef.getClassificationDefs().add(classificationType.getClassificationDef()); } } for(AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) { if (searchPredicates.evaluate(entityType)) { typesDef.getEntityDefs().add(entityType.getEntityDef()); } } for(AtlasRelationshipType relationshipType : typeRegistry.getAllRelationshipTypes()) { if (searchPredicates.evaluate(relationshipType)) { typesDef.getRelationshipDefs().add(relationshipType.getRelationshipDef()); } } for(AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) { if (searchPredicates.evaluate(businessMetadataType)) { typesDef.getBusinessMetadataDefs().add(businessMetadataType.getBusinessMetadataDef()); } } AtlasAuthorizationUtils.filterTypesDef(new AtlasTypesDefFilterRequest(typesDef)); return typesDef; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test public void testGetOnAllEntityTypes() throws AtlasBaseException { AtlasEntityDef entityDefByName = typeDefStore.getEntityDefByName("_ALL_ENTITY_TYPES"); assertNotNull(entityDefByName); assertEquals(entityDefByName, AtlasEntityType.getEntityRoot().getEntityDef()); }
@Override public AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByName(name); if (ret == null) { ret = StringUtils.equals(name, ALL_ENTITY_TYPES) ? AtlasEntityType.getEntityRoot().getEntityDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByName(name); if (ret == null) { ret = StringUtils.equals(name, ALL_ENTITY_TYPES) ? AtlasEntityType.getEntityRoot().getEntityDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByName(name); if (ret == null) { ret = StringUtils.equals(name, ALL_ENTITY_TYPES) ? AtlasEntityType.getEntityRoot().getEntityDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByName(name); if (ret == null) { ret = StringUtils.equals(name, ALL_ENTITY_TYPES) ? AtlasEntityType.getEntityRoot().getEntityDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasEntityDef getEntityDefByName(String name) throws AtlasBaseException { AtlasEntityDef ret = typeRegistry.getEntityDefByName(name); if (ret == null) { ret = StringUtils.equals(name, ALL_ENTITY_TYPES) ? AtlasEntityType.getEntityRoot().getEntityDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test public void testGetOnAllClassificationTypes() throws AtlasBaseException { AtlasClassificationDef classificationTypeDef = typeDefStore.getClassificationDefByName("_ALL_CLASSIFICATION_TYPES"); assertNotNull(classificationTypeDef); assertEquals(classificationTypeDef, AtlasClassificationType.getClassificationRoot().getClassificationDef()); }
@Override public AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByName(name); if (ret == null) { ret = StringUtils.equalsIgnoreCase(name, ALL_CLASSIFICATION_TYPES) ? AtlasClassificationType.getClassificationRoot().getClassificationDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByName(name); if (ret == null) { ret = StringUtils.equalsIgnoreCase(name, ALL_CLASSIFICATION_TYPES) ? AtlasClassificationType.getClassificationRoot().getClassificationDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByName(name); if (ret == null) { ret = StringUtils.equalsIgnoreCase(name, ALL_CLASSIFICATION_TYPES) ? AtlasClassificationType.getClassificationRoot().getClassificationDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByName(name); if (ret == null) { ret = StringUtils.equalsIgnoreCase(name, ALL_CLASSIFICATION_TYPES) ? AtlasClassificationType.getClassificationRoot().getClassificationDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
AtlasTypeDefGraphStore implements AtlasTypeDefStore { @Override public AtlasClassificationDef getClassificationDefByName(String name) throws AtlasBaseException { AtlasClassificationDef ret = typeRegistry.getClassificationDefByName(name); if (ret == null) { ret = StringUtils.equalsIgnoreCase(name, ALL_CLASSIFICATION_TYPES) ? AtlasClassificationType.getClassificationRoot().getClassificationDef() : null; if (ret == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name); } return ret; } AtlasAuthorizationUtils.verifyAccess(new AtlasTypeAccessRequest(AtlasPrivilege.TYPE_READ, ret), "read type ", name); return ret; } protected AtlasTypeDefGraphStore(AtlasTypeRegistry typeRegistry, Set<TypeDefChangeListener> typeDefChangeListeners); AtlasTypeRegistry getTypeRegistry(); @Override void init(); @Override AtlasEnumDef getEnumDefByName(String name); @Override AtlasEnumDef getEnumDefByGuid(String guid); @Override @GraphTransaction AtlasEnumDef updateEnumDefByName(String name, AtlasEnumDef enumDef); @Override @GraphTransaction AtlasEnumDef updateEnumDefByGuid(String guid, AtlasEnumDef enumDef); @Override AtlasStructDef getStructDefByName(String name); @Override AtlasStructDef getStructDefByGuid(String guid); @Override AtlasRelationshipDef getRelationshipDefByName(String name); @Override AtlasRelationshipDef getRelationshipDefByGuid(String guid); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByName(String name); @Override AtlasBusinessMetadataDef getBusinessMetadataDefByGuid(String guid); @Override @GraphTransaction AtlasStructDef updateStructDefByName(String name, AtlasStructDef structDef); @Override @GraphTransaction AtlasStructDef updateStructDefByGuid(String guid, AtlasStructDef structDef); @Override AtlasClassificationDef getClassificationDefByName(String name); @Override AtlasClassificationDef getClassificationDefByGuid(String guid); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByName(String name, AtlasClassificationDef classificationDef); @Override @GraphTransaction AtlasClassificationDef updateClassificationDefByGuid(String guid, AtlasClassificationDef classificationDef); @Override AtlasEntityDef getEntityDefByName(String name); @Override AtlasEntityDef getEntityDefByGuid(String guid); @Override @GraphTransaction AtlasEntityDef updateEntityDefByName(String name, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasEntityDef updateEntityDefByGuid(String guid, AtlasEntityDef entityDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByName(String name, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasRelationshipDef updateRelationshipDefByGuid(String guid, AtlasRelationshipDef relationshipDef); @Override @GraphTransaction AtlasTypesDef createTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesToCreate, AtlasTypesDef typesToUpdate); @Override @GraphTransaction AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypesDef(AtlasTypesDef typesDef); @Override @GraphTransaction void deleteTypeByName(String typeName); @Override AtlasTypesDef searchTypesDef(SearchFilter searchFilter); @Override AtlasBaseTypeDef getByName(String name); @Override AtlasBaseTypeDef getByGuid(String guid); @Override void notifyLoadCompletion(); }
@Test(dependsOnMethods = "verifyCreate") public void verifyGet() throws AtlasBaseException { AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = hdfsPathEntityCreator.getCreateEntity(expectedPath, expectedClusterName); assertNotNull(entityWithExtInfo); }
public AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(AtlasObjectId item) throws AtlasBaseException { if(item.getUniqueAttributes() == null || !item.getUniqueAttributes().containsKey(HDFS_PATH_ATTRIBUTE_NAME_PATH)) { return null; } return getCreateEntity((String) item.getUniqueAttributes().get(HDFS_PATH_ATTRIBUTE_NAME_PATH)); }
HdfsPathEntityCreator { public AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(AtlasObjectId item) throws AtlasBaseException { if(item.getUniqueAttributes() == null || !item.getUniqueAttributes().containsKey(HDFS_PATH_ATTRIBUTE_NAME_PATH)) { return null; } return getCreateEntity((String) item.getUniqueAttributes().get(HDFS_PATH_ATTRIBUTE_NAME_PATH)); } }
HdfsPathEntityCreator { public AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(AtlasObjectId item) throws AtlasBaseException { if(item.getUniqueAttributes() == null || !item.getUniqueAttributes().containsKey(HDFS_PATH_ATTRIBUTE_NAME_PATH)) { return null; } return getCreateEntity((String) item.getUniqueAttributes().get(HDFS_PATH_ATTRIBUTE_NAME_PATH)); } @Inject HdfsPathEntityCreator(AtlasTypeRegistry typeRegistry, AtlasEntityStoreV2 entityStore); }
HdfsPathEntityCreator { public AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(AtlasObjectId item) throws AtlasBaseException { if(item.getUniqueAttributes() == null || !item.getUniqueAttributes().containsKey(HDFS_PATH_ATTRIBUTE_NAME_PATH)) { return null; } return getCreateEntity((String) item.getUniqueAttributes().get(HDFS_PATH_ATTRIBUTE_NAME_PATH)); } @Inject HdfsPathEntityCreator(AtlasTypeRegistry typeRegistry, AtlasEntityStoreV2 entityStore); AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(AtlasObjectId item); AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(String path); AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(String path, String clusterName); static String getQualifiedName(String path, String clusterName); }
HdfsPathEntityCreator { public AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(AtlasObjectId item) throws AtlasBaseException { if(item.getUniqueAttributes() == null || !item.getUniqueAttributes().containsKey(HDFS_PATH_ATTRIBUTE_NAME_PATH)) { return null; } return getCreateEntity((String) item.getUniqueAttributes().get(HDFS_PATH_ATTRIBUTE_NAME_PATH)); } @Inject HdfsPathEntityCreator(AtlasTypeRegistry typeRegistry, AtlasEntityStoreV2 entityStore); AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(AtlasObjectId item); AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(String path); AtlasEntity.AtlasEntityWithExtInfo getCreateEntity(String path, String clusterName); static String getQualifiedName(String path, String clusterName); static final String HDFS_PATH_TYPE; static final String HDFS_PATH_ATTRIBUTE_NAME_NAME; static final String HDFS_PATH_ATTRIBUTE_NAME_CLUSTER_NAME; static final String HDFS_PATH_ATTRIBUTE_NAME_PATH; static final String HDFS_PATH_ATTRIBUTE_QUALIFIED_NAME; }
@Test public void exportType() throws AtlasBaseException { String requestingIP = "1.0.0.0"; String hostName = "root"; AtlasExportRequest request = getRequestForFullFetch(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipSink zipSink = new ZipSink(baos); AtlasExportResult result = exportService.run(zipSink, request, "admin", hostName, requestingIP); assertNotNull(exportService); assertEquals(result.getHostName(), hostName); assertEquals(result.getClientIpAddress(), requestingIP); assertEquals(request, result.getRequest()); assertNotNull(result.getSourceClusterName()); }
public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP); void processEntity(AtlasEntityWithExtInfo entityWithExtInfo, ExportContext context); }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP); void processEntity(AtlasEntityWithExtInfo entityWithExtInfo, ExportContext context); }
@Test(expectedExceptions = AtlasBaseException.class) public void requestingEntityNotFound_NoData() throws AtlasBaseException, IOException { String requestingIP = "1.0.0.0"; String hostName = "root"; ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipSink zipSink = new ZipSink(baos); AtlasExportResult result = exportService.run( zipSink, getRequestForFullFetch(), "admin", hostName, requestingIP); Assert.assertNull(result.getData()); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); new ZipSource(bais); }
public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP); void processEntity(AtlasEntityWithExtInfo entityWithExtInfo, ExportContext context); }
ExportService { public AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP) throws AtlasBaseException { long startTime = System.currentTimeMillis(); AtlasExportResult result = new AtlasExportResult(request, userName, requestingIP, hostName, startTime, getCurrentChangeMarker()); ExportContext context = new ExportContext(result, exportSink); exportTypeProcessor = new ExportTypeProcessor(typeRegistry); try { LOG.info("==> export(user={}, from={})", userName, requestingIP); AtlasExportResult.OperationStatus[] statuses = processItems(request, context); processTypesDef(context); long endTime = System.currentTimeMillis(); updateSinkWithOperationMetrics(userName, context, statuses, startTime, endTime); } catch(Exception ex) { LOG.error("Operation failed: ", ex); } finally { entitiesExtractor.close(); LOG.info("<== export(user={}, from={}): status {}: changeMarker: {}", userName, requestingIP, context.result.getOperationStatus(), context.result.getChangeMarker()); context.clear(); result.clear(); } return context.result; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP); void processEntity(AtlasEntityWithExtInfo entityWithExtInfo, ExportContext context); }
@Test public void verifyOverallStatus() { assertEquals(AtlasExportResult.OperationStatus.FAIL, exportService.getOverallOperationStatus()); assertEquals(AtlasExportResult.OperationStatus.SUCCESS, exportService.getOverallOperationStatus(AtlasExportResult.OperationStatus.SUCCESS)); assertEquals(AtlasExportResult.OperationStatus.SUCCESS, exportService.getOverallOperationStatus( AtlasExportResult.OperationStatus.SUCCESS, AtlasExportResult.OperationStatus.SUCCESS, AtlasExportResult.OperationStatus.SUCCESS)); assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, exportService.getOverallOperationStatus( AtlasExportResult.OperationStatus.FAIL, AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, AtlasExportResult.OperationStatus.SUCCESS)); assertEquals(AtlasExportResult.OperationStatus.PARTIAL_SUCCESS, exportService.getOverallOperationStatus( AtlasExportResult.OperationStatus.FAIL, AtlasExportResult.OperationStatus.FAIL, AtlasExportResult.OperationStatus.PARTIAL_SUCCESS)); assertEquals(AtlasExportResult.OperationStatus.FAIL, exportService.getOverallOperationStatus( AtlasExportResult.OperationStatus.FAIL, AtlasExportResult.OperationStatus.FAIL, AtlasExportResult.OperationStatus.FAIL)); }
@VisibleForTesting AtlasExportResult.OperationStatus getOverallOperationStatus(AtlasExportResult.OperationStatus... statuses) { AtlasExportResult.OperationStatus overall = (statuses.length == 0) ? AtlasExportResult.OperationStatus.FAIL : statuses[0]; for (AtlasExportResult.OperationStatus s : statuses) { if (overall != s) { overall = AtlasExportResult.OperationStatus.PARTIAL_SUCCESS; } } return overall; }
ExportService { @VisibleForTesting AtlasExportResult.OperationStatus getOverallOperationStatus(AtlasExportResult.OperationStatus... statuses) { AtlasExportResult.OperationStatus overall = (statuses.length == 0) ? AtlasExportResult.OperationStatus.FAIL : statuses[0]; for (AtlasExportResult.OperationStatus s : statuses) { if (overall != s) { overall = AtlasExportResult.OperationStatus.PARTIAL_SUCCESS; } } return overall; } }
ExportService { @VisibleForTesting AtlasExportResult.OperationStatus getOverallOperationStatus(AtlasExportResult.OperationStatus... statuses) { AtlasExportResult.OperationStatus overall = (statuses.length == 0) ? AtlasExportResult.OperationStatus.FAIL : statuses[0]; for (AtlasExportResult.OperationStatus s : statuses) { if (overall != s) { overall = AtlasExportResult.OperationStatus.PARTIAL_SUCCESS; } } return overall; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); }
ExportService { @VisibleForTesting AtlasExportResult.OperationStatus getOverallOperationStatus(AtlasExportResult.OperationStatus... statuses) { AtlasExportResult.OperationStatus overall = (statuses.length == 0) ? AtlasExportResult.OperationStatus.FAIL : statuses[0]; for (AtlasExportResult.OperationStatus s : statuses) { if (overall != s) { overall = AtlasExportResult.OperationStatus.PARTIAL_SUCCESS; } } return overall; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP); void processEntity(AtlasEntityWithExtInfo entityWithExtInfo, ExportContext context); }
ExportService { @VisibleForTesting AtlasExportResult.OperationStatus getOverallOperationStatus(AtlasExportResult.OperationStatus... statuses) { AtlasExportResult.OperationStatus overall = (statuses.length == 0) ? AtlasExportResult.OperationStatus.FAIL : statuses[0]; for (AtlasExportResult.OperationStatus s : statuses) { if (overall != s) { overall = AtlasExportResult.OperationStatus.PARTIAL_SUCCESS; } } return overall; } @Inject ExportService(final AtlasTypeRegistry typeRegistry, AtlasGraph graph, AuditsWriter auditsWriter, HdfsPathEntityCreator hdfsPathEntityCreator); AtlasExportResult run(ZipSink exportSink, AtlasExportRequest request, String userName, String hostName, String requestingIP); void processEntity(AtlasEntityWithExtInfo entityWithExtInfo, ExportContext context); }
@Test public void numberOfSavedEntries_Retrieved() throws AtlasBaseException, InterruptedException { final String source1 = "server1"; final String target1 = "cly"; int MAX_ENTRIES = 5; for (int i = 0; i < MAX_ENTRIES; i++) { saveAndGet(source1, ExportImportAuditEntry.OPERATION_EXPORT, target1); } pauseForIndexCreation(); List<ExportImportAuditEntry> results = auditService.get("", ExportImportAuditEntry.OPERATION_EXPORT, "", "", "", 10, 0); assertTrue(results.size() > 0); }
public ExportImportAuditEntry get(ExportImportAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); }
ExportImportAuditService { public ExportImportAuditEntry get(ExportImportAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } }
ExportImportAuditService { public ExportImportAuditEntry get(ExportImportAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } @Inject ExportImportAuditService(DataAccess dataAccess, AtlasDiscoveryService discoveryService); }
ExportImportAuditService { public ExportImportAuditEntry get(ExportImportAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } @Inject ExportImportAuditService(DataAccess dataAccess, AtlasDiscoveryService discoveryService); @GraphTransaction void save(ExportImportAuditEntry entry); ExportImportAuditEntry get(ExportImportAuditEntry entry); List<ExportImportAuditEntry> get(String userName, String operation, String cluster, String startTime, String endTime, int limit, int offset); void add(String userName, String sourceCluster, String targetCluster, String operation, String result, long startTime, long endTime, boolean hasData); }
ExportImportAuditService { public ExportImportAuditEntry get(ExportImportAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } @Inject ExportImportAuditService(DataAccess dataAccess, AtlasDiscoveryService discoveryService); @GraphTransaction void save(ExportImportAuditEntry entry); ExportImportAuditEntry get(ExportImportAuditEntry entry); List<ExportImportAuditEntry> get(String userName, String operation, String cluster, String startTime, String endTime, int limit, int offset); void add(String userName, String sourceCluster, String targetCluster, String operation, String result, long startTime, long endTime, boolean hasData); }
@Test public void testArrayTypeValidateValue() { List<String> messages = new ArrayList<>(); for (Object value : validValues) { assertTrue(intArrayType.validateValue(value, "testObj", messages)); assertEquals(messages.size(), 0, "value=" + value); } for (Object value : invalidValues) { assertFalse(intArrayType.validateValue(value, "testObj", messages)); assertTrue(messages.size() > 0, "value=" + value); messages.clear(); } }
@Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { ret = false; messages.add(objName + ": incorrect number of values. found=" + objList.size() + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } int idx = 0; for (Object element : objList) { ret = elementType.validateValue(element, objName + "[" + idx + "]", messages) && ret; idx++; } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { ret = false; messages.add(objName + ": incorrect number of values. found=" + arrayLen + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } for (int i = 0; i < arrayLen; i++) { ret = elementType.validateValue(Array.get(obj, i), objName + "[" + i + "]", messages) && ret; } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; }
AtlasArrayType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { ret = false; messages.add(objName + ": incorrect number of values. found=" + objList.size() + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } int idx = 0; for (Object element : objList) { ret = elementType.validateValue(element, objName + "[" + idx + "]", messages) && ret; idx++; } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { ret = false; messages.add(objName + ": incorrect number of values. found=" + arrayLen + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } for (int i = 0; i < arrayLen; i++) { ret = elementType.validateValue(Array.get(obj, i), objName + "[" + i + "]", messages) && ret; } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } }
AtlasArrayType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { ret = false; messages.add(objName + ": incorrect number of values. found=" + objList.size() + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } int idx = 0; for (Object element : objList) { ret = elementType.validateValue(element, objName + "[" + idx + "]", messages) && ret; idx++; } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { ret = false; messages.add(objName + ": incorrect number of values. found=" + arrayLen + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } for (int i = 0; i < arrayLen; i++) { ret = elementType.validateValue(Array.get(obj, i), objName + "[" + i + "]", messages) && ret; } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); }
AtlasArrayType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { ret = false; messages.add(objName + ": incorrect number of values. found=" + objList.size() + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } int idx = 0; for (Object element : objList) { ret = elementType.validateValue(element, objName + "[" + idx + "]", messages) && ret; idx++; } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { ret = false; messages.add(objName + ": incorrect number of values. found=" + arrayLen + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } for (int i = 0; i < arrayLen; i++) { ret = elementType.validateValue(Array.get(obj, i), objName + "[" + i + "]", messages) && ret; } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
AtlasArrayType extends AtlasType { @Override public boolean validateValue(Object obj, String objName, List<String> messages) { boolean ret = true; if (obj != null) { if (obj instanceof List || obj instanceof Set) { Collection objList = (Collection) obj; if (!isValidElementCount(objList.size())) { ret = false; messages.add(objName + ": incorrect number of values. found=" + objList.size() + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } int idx = 0; for (Object element : objList) { ret = elementType.validateValue(element, objName + "[" + idx + "]", messages) && ret; idx++; } } else if (obj.getClass().isArray()) { int arrayLen = Array.getLength(obj); if (!isValidElementCount(arrayLen)) { ret = false; messages.add(objName + ": incorrect number of values. found=" + arrayLen + "; expected: minCount=" + minCount + ", maxCount=" + maxCount); } for (int i = 0; i < arrayLen; i++) { ret = elementType.validateValue(Array.get(obj, i), objName + "[" + i + "]", messages) && ret; } } else { ret = false; messages.add(objName + "=" + obj + ": invalid value for type " + getTypeName()); } } return ret; } AtlasArrayType(AtlasType elementType); AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality); AtlasArrayType(String elementTypeName, AtlasTypeRegistry typeRegistry); AtlasArrayType(String elementTypeName, int minCount, int maxCount, Cardinality cardinality, AtlasTypeRegistry typeRegistry); String getElementTypeName(); void setMinCount(int minCount); int getMinCount(); void setMaxCount(int maxCount); int getMaxCount(); void setCardinality(Cardinality cardinality); Cardinality getCardinality(); AtlasType getElementType(); @Override Collection<?> createDefaultValue(); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Collection<?> getNormalizedValue(Object obj); @Override Collection<?> getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); @Override AtlasType getTypeForAttribute(); }
@Test(expectedExceptions = AtlasBaseException.class) public void improperInit_ReturnsNullCreationOrder() throws IOException, AtlasBaseException { byte bytes[] = new byte[10]; ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ZipSource zs = new ZipSource(bais); List<String> s = zs.getCreationOrder(); Assert.assertNull(s); }
@Override public List<String> getCreationOrder() { return this.creationOrder; }
ZipSource implements EntityImportStream { @Override public List<String> getCreationOrder() { return this.creationOrder; } }
ZipSource implements EntityImportStream { @Override public List<String> getCreationOrder() { return this.creationOrder; } ZipSource(InputStream inputStream); ZipSource(InputStream inputStream, ImportTransforms importTransform); }
ZipSource implements EntityImportStream { @Override public List<String> getCreationOrder() { return this.creationOrder; } ZipSource(InputStream inputStream); ZipSource(InputStream inputStream, ImportTransforms importTransform); @Override ImportTransforms getImportTransform(); @Override void setImportTransform(ImportTransforms importTransform); @Override List<BaseEntityHandler> getEntityHandlers(); @Override void setEntityHandlers(List<BaseEntityHandler> entityHandlers); @Override AtlasTypesDef getTypesDef(); @Override AtlasExportResult getExportResult(); @Override List<String> getCreationOrder(); AtlasEntityWithExtInfo getEntityWithExtInfo(String guid); @Override void close(); @Override boolean hasNext(); @Override AtlasEntity next(); @Override AtlasEntityWithExtInfo getNextEntityWithExtInfo(); @Override void reset(); @Override AtlasEntity getByGuid(String guid); int size(); @Override void onImportComplete(String guid); @Override void setPosition(int index); @Override void setPositionUsingEntityGuid(String guid); @Override int getPosition(); }
ZipSource implements EntityImportStream { @Override public List<String> getCreationOrder() { return this.creationOrder; } ZipSource(InputStream inputStream); ZipSource(InputStream inputStream, ImportTransforms importTransform); @Override ImportTransforms getImportTransform(); @Override void setImportTransform(ImportTransforms importTransform); @Override List<BaseEntityHandler> getEntityHandlers(); @Override void setEntityHandlers(List<BaseEntityHandler> entityHandlers); @Override AtlasTypesDef getTypesDef(); @Override AtlasExportResult getExportResult(); @Override List<String> getCreationOrder(); AtlasEntityWithExtInfo getEntityWithExtInfo(String guid); @Override void close(); @Override boolean hasNext(); @Override AtlasEntity next(); @Override AtlasEntityWithExtInfo getNextEntityWithExtInfo(); @Override void reset(); @Override AtlasEntity getByGuid(String guid); int size(); @Override void onImportComplete(String guid); @Override void setPosition(int index); @Override void setPositionUsingEntityGuid(String guid); @Override int getPosition(); }
@Test public void transformEntityWith2Transforms() throws AtlasBaseException { AtlasEntity entity = getHiveTableAtlasEntity(); String attrValue = (String) entity.getAttribute(ATTR_NAME_QUALIFIED_NAME); transform.apply(entity); assertEquals(entity.getAttribute(ATTR_NAME_QUALIFIED_NAME), applyDefaultTransform(attrValue)); }
public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); static ImportTransforms fromJson(String jsonString); Map<String, Map<String, List<ImportTransformer>>> getTransforms(); Map<String, List<ImportTransformer>> getTransforms(String typeName); Set<String> getTypes(); void addParentTransformsToSubTypes(String parentType, Set<String> subTypes); AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); AtlasEntity apply(AtlasEntity entity); }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); static ImportTransforms fromJson(String jsonString); Map<String, Map<String, List<ImportTransformer>>> getTransforms(); Map<String, List<ImportTransformer>> getTransforms(String typeName); Set<String> getTypes(); void addParentTransformsToSubTypes(String parentType, Set<String> subTypes); AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); AtlasEntity apply(AtlasEntity entity); }
@Test public void transformEntityWithExtInfo() throws AtlasBaseException { addColumnTransform(transform); AtlasEntityWithExtInfo entityWithExtInfo = getAtlasEntityWithExtInfo(); AtlasEntity entity = entityWithExtInfo.getEntity(); String attrValue = (String) entity.getAttribute(ATTR_NAME_QUALIFIED_NAME); String[] expectedValues = getExtEntityExpectedValues(entityWithExtInfo); transform.apply(entityWithExtInfo); assertEquals(entityWithExtInfo.getEntity().getAttribute(ATTR_NAME_QUALIFIED_NAME), applyDefaultTransform(attrValue)); for (int i = 0; i < expectedValues.length; i++) { assertEquals(entityWithExtInfo.getReferredEntities().get(Integer.toString(i)).getAttribute(ATTR_NAME_QUALIFIED_NAME), expectedValues[i]); } }
public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); static ImportTransforms fromJson(String jsonString); Map<String, Map<String, List<ImportTransformer>>> getTransforms(); Map<String, List<ImportTransformer>> getTransforms(String typeName); Set<String> getTypes(); void addParentTransformsToSubTypes(String parentType, Set<String> subTypes); AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); AtlasEntity apply(AtlasEntity entity); }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); static ImportTransforms fromJson(String jsonString); Map<String, Map<String, List<ImportTransformer>>> getTransforms(); Map<String, List<ImportTransformer>> getTransforms(String typeName); Set<String> getTypes(); void addParentTransformsToSubTypes(String parentType, Set<String> subTypes); AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); AtlasEntity apply(AtlasEntity entity); }
@Test public void transformEntityWithExtInfoNullCheck() throws AtlasBaseException { addColumnTransform(transform); AtlasEntityWithExtInfo entityWithExtInfo = getAtlasEntityWithExtInfo(); entityWithExtInfo.setReferredEntities(null); AtlasEntityWithExtInfo transformedEntityWithExtInfo = transform.apply(entityWithExtInfo); assertNotNull(transformedEntityWithExtInfo); assertEquals(entityWithExtInfo.getEntity().getGuid(), transformedEntityWithExtInfo.getEntity().getGuid()); }
public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); static ImportTransforms fromJson(String jsonString); Map<String, Map<String, List<ImportTransformer>>> getTransforms(); Map<String, List<ImportTransformer>> getTransforms(String typeName); Set<String> getTypes(); void addParentTransformsToSubTypes(String parentType, Set<String> subTypes); AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); AtlasEntity apply(AtlasEntity entity); }
ImportTransforms { public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo == null) { return entityWithExtInfo; } apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } return entityWithExtInfo; } private ImportTransforms(); private ImportTransforms(String jsonString); static ImportTransforms fromJson(String jsonString); Map<String, Map<String, List<ImportTransformer>>> getTransforms(); Map<String, List<ImportTransformer>> getTransforms(String typeName); Set<String> getTypes(); void addParentTransformsToSubTypes(String parentType, Set<String> subTypes); AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); AtlasEntity apply(AtlasEntity entity); }
@Test public void importServiceProcessesIOException() { ImportService importService = new ImportService(typeDefStore, typeRegistry, null,null, null,null); AtlasImportRequest req = mock(AtlasImportRequest.class); Answer<Map> answer = invocationOnMock -> { throw new IOException("file is read only"); }; when(req.getFileName()).thenReturn("some-file.zip"); when(req.getOptions()).thenAnswer(answer); try { importService.run(req, "a", "b", "c"); } catch (AtlasBaseException ex) { assertEquals(ex.getAtlasErrorCode().getErrorCode(), AtlasErrorCode.INVALID_PARAMETERS.getErrorCode()); } }
public AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP) throws AtlasBaseException { return run(inputStream, null, userName, hostName, requestingIP); }
ImportService { public AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP) throws AtlasBaseException { return run(inputStream, null, userName, hostName, requestingIP); } }
ImportService { public AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP) throws AtlasBaseException { return run(inputStream, null, userName, hostName, requestingIP); } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); }
ImportService { public AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP) throws AtlasBaseException { return run(inputStream, null, userName, hostName, requestingIP); } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
ImportService { public AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP) throws AtlasBaseException { return run(inputStream, null, userName, hostName, requestingIP); } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
@Test(dataProvider = "salesNewTypeAttrs-next") public void transformUpdatesForSubTypes(InputStream inputStream) throws IOException, AtlasBaseException { loadBaseModel(); loadHiveModel(); String transformJSON = "{ \"Asset\": { \"qualifiedName\":[ \"lowercase\", \"replace:@cl1:@cl2\" ] } }"; ZipSource zipSource = new ZipSource(inputStream); importService.setImportTransform(zipSource, transformJSON); ImportTransforms importTransforms = zipSource.getImportTransform(); assertTrue(importTransforms.getTransforms().containsKey("Asset")); assertTrue(importTransforms.getTransforms().containsKey("hive_table")); assertTrue(importTransforms.getTransforms().containsKey("hive_column")); }
@VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
@Test(dataProvider = "salesNewTypeAttrs-next") public void transformUpdatesForSubTypesAddsToExistingTransforms(InputStream inputStream) throws IOException, AtlasBaseException { loadBaseModel(); loadHiveModel(); String transformJSON = "{ \"Asset\": { \"qualifiedName\":[ \"replace:@cl1:@cl2\" ] }, \"hive_table\": { \"qualifiedName\":[ \"lowercase\" ] } }"; ZipSource zipSource = new ZipSource(inputStream); importService.setImportTransform(zipSource, transformJSON); ImportTransforms importTransforms = zipSource.getImportTransform(); assertTrue(importTransforms.getTransforms().containsKey("Asset")); assertTrue(importTransforms.getTransforms().containsKey("hive_table")); assertTrue(importTransforms.getTransforms().containsKey("hive_column")); assertEquals(importTransforms.getTransforms().get("hive_table").get("qualifiedName").size(), 2); }
@VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
ImportService { @VisibleForTesting void setImportTransform(EntityImportStream source, String transforms) throws AtlasBaseException { ImportTransforms importTransform = ImportTransforms.fromJson(transforms); if (importTransform == null) { return; } importTransformsShaper.shape(importTransform, source.getExportResult().getRequest()); source.setImportTransform(importTransform); if(LOG.isDebugEnabled()) { debugLog(" => transforms: {}", AtlasType.toJson(importTransform)); } } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
@Test public void testCheckHiveTableIncrementalSkipLineage() { AtlasImportRequest importRequest; AtlasExportRequest exportRequest; importRequest = getImportRequest("cl1"); exportRequest = getExportRequest(FETCH_TYPE_INCREMENTAL, "cl2", true, getItemsToExport("hive_table", "hive_table")); assertTrue(importService.checkHiveTableIncrementalSkipLineage(importRequest, exportRequest)); exportRequest = getExportRequest(FETCH_TYPE_INCREMENTAL, "cl2", true, getItemsToExport("hive_table", "hive_db", "hive_table")); assertFalse(importService.checkHiveTableIncrementalSkipLineage(importRequest, exportRequest)); exportRequest = getExportRequest(FETCH_TYPE_FULL, "cl2", true, getItemsToExport("hive_table", "hive_table")); assertFalse(importService.checkHiveTableIncrementalSkipLineage(importRequest, exportRequest)); exportRequest = getExportRequest(FETCH_TYPE_FULL, "", true, getItemsToExport("hive_table", "hive_table")); assertFalse(importService.checkHiveTableIncrementalSkipLineage(importRequest, exportRequest)); importRequest = getImportRequest(""); exportRequest = getExportRequest(FETCH_TYPE_INCREMENTAL, "cl2", true, getItemsToExport("hive_table", "hive_table")); assertFalse(importService.checkHiveTableIncrementalSkipLineage(importRequest, exportRequest)); }
@VisibleForTesting boolean checkHiveTableIncrementalSkipLineage(AtlasImportRequest importRequest, AtlasExportRequest exportRequest) { if (exportRequest == null || CollectionUtils.isEmpty(exportRequest.getItemsToExport())) { return false; } for (AtlasObjectId itemToExport : exportRequest.getItemsToExport()) { if (!itemToExport.getTypeName().equalsIgnoreCase(ATLAS_TYPE_HIVE_TABLE)){ return false; } } return importRequest.isReplicationOptionSet() && exportRequest.isReplicationOptionSet() && exportRequest.getFetchTypeOptionValue().equalsIgnoreCase(AtlasExportRequest.FETCH_TYPE_INCREMENTAL) && exportRequest.getSkipLineageOptionValue(); }
ImportService { @VisibleForTesting boolean checkHiveTableIncrementalSkipLineage(AtlasImportRequest importRequest, AtlasExportRequest exportRequest) { if (exportRequest == null || CollectionUtils.isEmpty(exportRequest.getItemsToExport())) { return false; } for (AtlasObjectId itemToExport : exportRequest.getItemsToExport()) { if (!itemToExport.getTypeName().equalsIgnoreCase(ATLAS_TYPE_HIVE_TABLE)){ return false; } } return importRequest.isReplicationOptionSet() && exportRequest.isReplicationOptionSet() && exportRequest.getFetchTypeOptionValue().equalsIgnoreCase(AtlasExportRequest.FETCH_TYPE_INCREMENTAL) && exportRequest.getSkipLineageOptionValue(); } }
ImportService { @VisibleForTesting boolean checkHiveTableIncrementalSkipLineage(AtlasImportRequest importRequest, AtlasExportRequest exportRequest) { if (exportRequest == null || CollectionUtils.isEmpty(exportRequest.getItemsToExport())) { return false; } for (AtlasObjectId itemToExport : exportRequest.getItemsToExport()) { if (!itemToExport.getTypeName().equalsIgnoreCase(ATLAS_TYPE_HIVE_TABLE)){ return false; } } return importRequest.isReplicationOptionSet() && exportRequest.isReplicationOptionSet() && exportRequest.getFetchTypeOptionValue().equalsIgnoreCase(AtlasExportRequest.FETCH_TYPE_INCREMENTAL) && exportRequest.getSkipLineageOptionValue(); } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); }
ImportService { @VisibleForTesting boolean checkHiveTableIncrementalSkipLineage(AtlasImportRequest importRequest, AtlasExportRequest exportRequest) { if (exportRequest == null || CollectionUtils.isEmpty(exportRequest.getItemsToExport())) { return false; } for (AtlasObjectId itemToExport : exportRequest.getItemsToExport()) { if (!itemToExport.getTypeName().equalsIgnoreCase(ATLAS_TYPE_HIVE_TABLE)){ return false; } } return importRequest.isReplicationOptionSet() && exportRequest.isReplicationOptionSet() && exportRequest.getFetchTypeOptionValue().equalsIgnoreCase(AtlasExportRequest.FETCH_TYPE_INCREMENTAL) && exportRequest.getSkipLineageOptionValue(); } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
ImportService { @VisibleForTesting boolean checkHiveTableIncrementalSkipLineage(AtlasImportRequest importRequest, AtlasExportRequest exportRequest) { if (exportRequest == null || CollectionUtils.isEmpty(exportRequest.getItemsToExport())) { return false; } for (AtlasObjectId itemToExport : exportRequest.getItemsToExport()) { if (!itemToExport.getTypeName().equalsIgnoreCase(ATLAS_TYPE_HIVE_TABLE)){ return false; } } return importRequest.isReplicationOptionSet() && exportRequest.isReplicationOptionSet() && exportRequest.getFetchTypeOptionValue().equalsIgnoreCase(AtlasExportRequest.FETCH_TYPE_INCREMENTAL) && exportRequest.getSkipLineageOptionValue(); } @Inject ImportService(AtlasTypeDefStore typeDefStore, AtlasTypeRegistry typeRegistry, BulkImporter bulkImporter, AuditsWriter auditsWriter, ImportTransformsShaper importTransformsShaper, TableReplicationRequestProcessor tableReplicationRequestProcessor); AtlasImportResult run(InputStream inputStream, String userName, String hostName, String requestingIP); AtlasImportResult run(InputStream inputStream, AtlasImportRequest request, String userName, String hostName, String requestingIP); AtlasImportResult run(AtlasImportRequest request, String userName, String hostName, String requestingIP); }
@Test public void fetchTypeGuid() { String exportRequestJson = "{ \"itemsToExport\": [ { \"typeName\": \"hive_db\", \"guid\": \"111-222-333\" } ]}"; AtlasExportRequest exportRequest = AtlasType.fromJson(exportRequestJson, AtlasExportRequest.class); List<AtlasObjectId> objectGuidMap = startEntityFetchByExportRequestSpy.get(exportRequest); assertEquals(objectGuidMap.get(0).getGuid(), "111-222-333"); }
public List<AtlasObjectId> get(AtlasExportRequest exportRequest) { List<AtlasObjectId> list = new ArrayList<>(); for(AtlasObjectId objectId : exportRequest.getItemsToExport()) { List<String> guids = get(exportRequest, objectId); if (guids.isEmpty()) { continue; } objectId.setGuid(guids.get(0)); list.add(objectId); } return list; }
StartEntityFetchByExportRequest { public List<AtlasObjectId> get(AtlasExportRequest exportRequest) { List<AtlasObjectId> list = new ArrayList<>(); for(AtlasObjectId objectId : exportRequest.getItemsToExport()) { List<String> guids = get(exportRequest, objectId); if (guids.isEmpty()) { continue; } objectId.setGuid(guids.get(0)); list.add(objectId); } return list; } }
StartEntityFetchByExportRequest { public List<AtlasObjectId> get(AtlasExportRequest exportRequest) { List<AtlasObjectId> list = new ArrayList<>(); for(AtlasObjectId objectId : exportRequest.getItemsToExport()) { List<String> guids = get(exportRequest, objectId); if (guids.isEmpty()) { continue; } objectId.setGuid(guids.get(0)); list.add(objectId); } return list; } StartEntityFetchByExportRequest(AtlasGraph atlasGraph, AtlasTypeRegistry typeRegistry, AtlasGremlinQueryProvider gremlinQueryProvider); }
StartEntityFetchByExportRequest { public List<AtlasObjectId> get(AtlasExportRequest exportRequest) { List<AtlasObjectId> list = new ArrayList<>(); for(AtlasObjectId objectId : exportRequest.getItemsToExport()) { List<String> guids = get(exportRequest, objectId); if (guids.isEmpty()) { continue; } objectId.setGuid(guids.get(0)); list.add(objectId); } return list; } StartEntityFetchByExportRequest(AtlasGraph atlasGraph, AtlasTypeRegistry typeRegistry, AtlasGremlinQueryProvider gremlinQueryProvider); List<AtlasObjectId> get(AtlasExportRequest exportRequest); List<String> get(AtlasExportRequest exportRequest, AtlasObjectId item); ScriptEngine getScriptEngine(); }
StartEntityFetchByExportRequest { public List<AtlasObjectId> get(AtlasExportRequest exportRequest) { List<AtlasObjectId> list = new ArrayList<>(); for(AtlasObjectId objectId : exportRequest.getItemsToExport()) { List<String> guids = get(exportRequest, objectId); if (guids.isEmpty()) { continue; } objectId.setGuid(guids.get(0)); list.add(objectId); } return list; } StartEntityFetchByExportRequest(AtlasGraph atlasGraph, AtlasTypeRegistry typeRegistry, AtlasGremlinQueryProvider gremlinQueryProvider); List<AtlasObjectId> get(AtlasExportRequest exportRequest); List<String> get(AtlasExportRequest exportRequest, AtlasObjectId item); ScriptEngine getScriptEngine(); }
@Test public void createWithCorrectParameters() throws AtlasBaseException, IllegalAccessException { String param1 = "@cl1"; String param2 = "@cl2"; ImportTransformer e = ImportTransformer.getTransformer(String.format("%s:%s:%s", "replace", param1, param2)); assertTrue(e instanceof ImportTransformer.Replace); assertEquals(((ImportTransformer.Replace)e).getToFindStr(), param1); assertEquals(((ImportTransformer.Replace)e).getReplaceStr(), param2); }
public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); static ImportTransformer getTransformer(String transformerSpec); String getTransformType(); abstract Object apply(Object o); }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); static ImportTransformer getTransformer(String transformerSpec); String getTransformType(); abstract Object apply(Object o); }
@Test public void testStructTypeDefaultValue() { AtlasStruct defValue = structType.createDefaultValue(); assertNotNull(defValue); assertEquals(defValue.getTypeName(), structType.getTypeName()); }
@Override public AtlasStruct createDefaultValue() { AtlasStruct ret = new AtlasStruct(structDef.getName()); populateDefaultValues(ret); return ret; }
AtlasStructType extends AtlasType { @Override public AtlasStruct createDefaultValue() { AtlasStruct ret = new AtlasStruct(structDef.getName()); populateDefaultValues(ret); return ret; } }
AtlasStructType extends AtlasType { @Override public AtlasStruct createDefaultValue() { AtlasStruct ret = new AtlasStruct(structDef.getName()); populateDefaultValues(ret); return ret; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); }
AtlasStructType extends AtlasType { @Override public AtlasStruct createDefaultValue() { AtlasStruct ret = new AtlasStruct(structDef.getName()); populateDefaultValues(ret); return ret; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); AtlasStructDef getStructDef(); AtlasType getAttributeType(String attributeName); AtlasAttributeDef getAttributeDef(String attributeName); @Override AtlasStruct createDefaultValue(); @Override Object createDefaultValue(Object defaultValue); Map<String, AtlasAttribute> getAllAttributes(); Map<String, AtlasAttribute> getUniqAttributes(); AtlasAttribute getAttribute(String attributeName); AtlasAttribute getSystemAttribute(String attributeName); AtlasAttribute getBusinesAAttribute(String attributeName); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Object getNormalizedValue(Object obj); @Override Object getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); void normalizeAttributeValues(AtlasStruct obj); void normalizeAttributeValuesForUpdate(AtlasStruct obj); void normalizeAttributeValues(Map<String, Object> obj); void normalizeAttributeValuesForUpdate(Map<String, Object> obj); void populateDefaultValues(AtlasStruct obj); String getVertexPropertyName(String attrName); String getQualifiedAttributePropertyKey(String attrName); }
AtlasStructType extends AtlasType { @Override public AtlasStruct createDefaultValue() { AtlasStruct ret = new AtlasStruct(structDef.getName()); populateDefaultValues(ret); return ret; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); AtlasStructDef getStructDef(); AtlasType getAttributeType(String attributeName); AtlasAttributeDef getAttributeDef(String attributeName); @Override AtlasStruct createDefaultValue(); @Override Object createDefaultValue(Object defaultValue); Map<String, AtlasAttribute> getAllAttributes(); Map<String, AtlasAttribute> getUniqAttributes(); AtlasAttribute getAttribute(String attributeName); AtlasAttribute getSystemAttribute(String attributeName); AtlasAttribute getBusinesAAttribute(String attributeName); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Object getNormalizedValue(Object obj); @Override Object getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); void normalizeAttributeValues(AtlasStruct obj); void normalizeAttributeValuesForUpdate(AtlasStruct obj); void normalizeAttributeValues(Map<String, Object> obj); void normalizeAttributeValuesForUpdate(Map<String, Object> obj); void populateDefaultValues(AtlasStruct obj); String getVertexPropertyName(String attrName); String getQualifiedAttributePropertyKey(String attrName); static final String UNIQUE_ATTRIBUTE_SHADE_PROPERTY_PREFIX; }
@Test public void createSeveralWithCorrectParameters() throws AtlasBaseException, IllegalAccessException { String param1 = "@cl1"; String param2 = "@cl2"; ImportTransformer e1 = ImportTransformer.getTransformer(String.format("%s:%s:%s", "replace", param1, param2)); ImportTransformer e2 = ImportTransformer.getTransformer(String.format("replace:tt1:tt2")); assertTrue(e1 instanceof ImportTransformer.Replace); assertEquals(((ImportTransformer.Replace)e1).getToFindStr(), param1); assertEquals(((ImportTransformer.Replace)e1).getReplaceStr(), param2); assertTrue(e2 instanceof ImportTransformer.Replace); assertEquals(((ImportTransformer.Replace)e2).getToFindStr(), "tt1"); assertEquals(((ImportTransformer.Replace)e2).getReplaceStr(), "tt2"); }
public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); static ImportTransformer getTransformer(String transformerSpec); String getTransformType(); abstract Object apply(Object o); }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); static ImportTransformer getTransformer(String transformerSpec); String getTransformType(); abstract Object apply(Object o); }
@Test public void createWithDefaultParameters() throws AtlasBaseException { ImportTransformer e1 = ImportTransformer.getTransformer("replace:@cl1"); ImportTransformer e2 = ImportTransformer.getTransformer("replace"); assertTrue(e1 instanceof ImportTransformer.Replace); assertEquals(((ImportTransformer.Replace)e1).getToFindStr(), "@cl1"); assertEquals(((ImportTransformer.Replace)e1).getReplaceStr(), ""); assertTrue(e2 instanceof ImportTransformer.Replace); assertEquals(((ImportTransformer.Replace)e2).getToFindStr(), ""); assertEquals(((ImportTransformer.Replace)e2).getReplaceStr(), ""); }
public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); static ImportTransformer getTransformer(String transformerSpec); String getTransformType(); abstract Object apply(Object o); }
ImportTransformer { public static ImportTransformer getTransformer(String transformerSpec) throws AtlasBaseException { String[] params = StringUtils.split(transformerSpec, TRANSFORMER_PARAMETER_SEPARATOR); String key = (params == null || params.length < 1) ? transformerSpec : params[0]; final ImportTransformer ret; if (StringUtils.isEmpty(key)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Invalid transformer-specification: {}.", transformerSpec); } else if (key.equals(TRANSFORMER_NAME_REPLACE)) { String toFindStr = (params == null || params.length < 2) ? "" : params[1]; String replaceStr = (params == null || params.length < 3) ? "" : params[2]; ret = new Replace(toFindStr, replaceStr); } else if (key.equals(TRANSFORMER_NAME_LOWERCASE)) { ret = new Lowercase(); } else if (key.equals(TRANSFORMER_NAME_UPPERCASE)) { ret = new Uppercase(); } else if (key.equals(TRANSFORMER_NAME_REMOVE_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new RemoveClassification(name); } else if (key.equals(TRANSFORMER_NAME_ADD)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new AddValueToAttribute(name); } else if (key.equals(TRANSFORMER_NAME_CLEAR_ATTR)) { String name = (params == null || params.length < 1) ? "" : StringUtils.join(params, ":", 1, params.length); ret = new ClearAttributes(name); } else if (key.equals(TRANSFORMER_SET_DELETED)) { ret = new SetDeleted(); } else if (key.equals(TRANSFORMER_NAME_ADD_CLASSIFICATION)) { String name = (params == null || params.length < 1) ? "" : params[1]; ret = new AddClassification(name, (params != null && params.length == 3) ? params[2] : ""); } else { throw new AtlasBaseException(AtlasErrorCode.INVALID_VALUE, "Error creating ImportTransformer. Unknown transformer: {}.", transformerSpec); } return ret; } protected ImportTransformer(String transformType); static ImportTransformer getTransformer(String transformerSpec); String getTransformType(); abstract Object apply(Object o); }
@Test public void checkStoringMultipleAuditEntries() throws AtlasBaseException, InterruptedException { final String clientId = "client1"; final int MAX_ENTRIES = 5; final int LIMIT_PARAM = 3; for (int i = 0; i < MAX_ENTRIES; i++) { saveEntry(AuditOperation.PURGE, clientId); } waitForIndexCreation(); AuditSearchParameters auditSearchParameters = createAuditParameter("audit-search-parameter-purge"); auditSearchParameters.setLimit(LIMIT_PARAM); auditSearchParameters.setOffset(0); List<AtlasAuditEntry> resultLimitedByParam = auditService.get(auditSearchParameters); assertTrue(resultLimitedByParam.size() == LIMIT_PARAM); auditSearchParameters.setLimit(MAX_ENTRIES); auditSearchParameters.setOffset(LIMIT_PARAM); List<AtlasAuditEntry> results = auditService.get(auditSearchParameters); assertTrue(results.size() == (MAX_ENTRIES - LIMIT_PARAM)); }
public AtlasAuditEntry get(AtlasAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("Entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); }
AtlasAuditService { public AtlasAuditEntry get(AtlasAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("Entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } }
AtlasAuditService { public AtlasAuditEntry get(AtlasAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("Entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } @Inject AtlasAuditService(DataAccess dataAccess, AtlasDiscoveryService discoveryService); }
AtlasAuditService { public AtlasAuditEntry get(AtlasAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("Entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } @Inject AtlasAuditService(DataAccess dataAccess, AtlasDiscoveryService discoveryService); @GraphTransaction void save(AtlasAuditEntry entry); void add(String userName, AuditOperation operation, String clientId, Date startTime, Date endTime, String params, String result, long resultCount); AtlasAuditEntry get(AtlasAuditEntry entry); List<AtlasAuditEntry> get(AuditSearchParameters auditSearchParameters); AtlasAuditEntry toAtlasAuditEntry(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); }
AtlasAuditService { public AtlasAuditEntry get(AtlasAuditEntry entry) throws AtlasBaseException { if(entry.getGuid() == null) { throw new AtlasBaseException("Entity does not have GUID set. load cannot proceed."); } return dataAccess.load(entry); } @Inject AtlasAuditService(DataAccess dataAccess, AtlasDiscoveryService discoveryService); @GraphTransaction void save(AtlasAuditEntry entry); void add(String userName, AuditOperation operation, String clientId, Date startTime, Date endTime, String params, String result, long resultCount); AtlasAuditEntry get(AtlasAuditEntry entry); List<AtlasAuditEntry> get(AuditSearchParameters auditSearchParameters); AtlasAuditEntry toAtlasAuditEntry(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo); static final String ENTITY_TYPE_AUDIT_ENTRY; }
@Test(groups = "Glossary.CREATE") public void testCreateGlossary() { try { AtlasGlossary created = glossaryService.createGlossary(bankGlossary); bankGlossary.setGuid(created.getGuid()); created = glossaryService.createGlossary(creditUnionGlossary); creditUnionGlossary.setGuid(created.getGuid()); } catch (AtlasBaseException e) { fail("Glossary creation should've succeeded", e); } try { glossaryService.createGlossary(bankGlossary); fail("Glossary duplicate creation should've failed"); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.GLOSSARY_ALREADY_EXISTS); } try { glossaryService.createGlossary(creditUnionGlossary); fail("Glossary duplicate creation should've failed"); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.GLOSSARY_ALREADY_EXISTS); } try { List<AtlasRelatedCategoryHeader> glossaryCategories = glossaryService.getGlossaryCategoriesHeaders(bankGlossary.getGuid(), 0, 10, SortOrder.ASCENDING); assertNotNull(glossaryCategories); assertEquals(glossaryCategories.size(), 0); glossaryCategories = glossaryService.getGlossaryCategoriesHeaders(creditUnionGlossary.getGuid(), 0, 10, SortOrder.ASCENDING); assertNotNull(glossaryCategories); assertEquals(glossaryCategories.size(), 0); } catch (AtlasBaseException e) { fail("Get glossary categories calls should've succeeded", e); } try { List<AtlasRelatedTermHeader> glossaryCategories = glossaryService.getGlossaryTermsHeaders(bankGlossary.getGuid(), 0, 10, SortOrder.ASCENDING); assertNotNull(glossaryCategories); assertEquals(glossaryCategories.size(), 0); glossaryCategories = glossaryService.getGlossaryTermsHeaders(creditUnionGlossary.getGuid(), 0, 10, SortOrder.ASCENDING); assertNotNull(glossaryCategories); assertEquals(glossaryCategories.size(), 0); } catch (AtlasBaseException e) { fail("Get glossary categories calls should've succeeded", e); } AtlasGlossaryHeader glossaryId = new AtlasGlossaryHeader(); glossaryId.setGlossaryGuid(bankGlossary.getGuid()); checkingAccount.setAnchor(glossaryId); savingsAccount.setAnchor(glossaryId); fixedRateMortgage.setAnchor(glossaryId); adjustableRateMortgage.setAnchor(glossaryId); accountCategory.setAnchor(glossaryId); customerCategory.setAnchor(glossaryId); mortgageCategory.setAnchor(glossaryId); }
@GraphTransaction public AtlasGlossary createGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.createGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary definition missing"); } if (StringUtils.isEmpty(atlasGlossary.getQualifiedName())) { if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(atlasGlossary.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { atlasGlossary.setQualifiedName(atlasGlossary.getName()); } } if (glossaryExists(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_ALREADY_EXISTS, atlasGlossary.getQualifiedName()); } AtlasGlossary storeObject = dataAccess.save(atlasGlossary); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.createGlossary() : {}", storeObject); } return storeObject; }
GlossaryService { @GraphTransaction public AtlasGlossary createGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.createGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary definition missing"); } if (StringUtils.isEmpty(atlasGlossary.getQualifiedName())) { if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(atlasGlossary.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { atlasGlossary.setQualifiedName(atlasGlossary.getName()); } } if (glossaryExists(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_ALREADY_EXISTS, atlasGlossary.getQualifiedName()); } AtlasGlossary storeObject = dataAccess.save(atlasGlossary); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.createGlossary() : {}", storeObject); } return storeObject; } }
GlossaryService { @GraphTransaction public AtlasGlossary createGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.createGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary definition missing"); } if (StringUtils.isEmpty(atlasGlossary.getQualifiedName())) { if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(atlasGlossary.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { atlasGlossary.setQualifiedName(atlasGlossary.getName()); } } if (glossaryExists(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_ALREADY_EXISTS, atlasGlossary.getQualifiedName()); } AtlasGlossary storeObject = dataAccess.save(atlasGlossary); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.createGlossary() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public AtlasGlossary createGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.createGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary definition missing"); } if (StringUtils.isEmpty(atlasGlossary.getQualifiedName())) { if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(atlasGlossary.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { atlasGlossary.setQualifiedName(atlasGlossary.getName()); } } if (glossaryExists(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_ALREADY_EXISTS, atlasGlossary.getQualifiedName()); } AtlasGlossary storeObject = dataAccess.save(atlasGlossary); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.createGlossary() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public AtlasGlossary createGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.createGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary definition missing"); } if (StringUtils.isEmpty(atlasGlossary.getQualifiedName())) { if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(atlasGlossary.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { atlasGlossary.setQualifiedName(atlasGlossary.getName()); } } if (glossaryExists(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_ALREADY_EXISTS, atlasGlossary.getQualifiedName()); } AtlasGlossary storeObject = dataAccess.save(atlasGlossary); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.createGlossary() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(groups = "Glossary.CREATE" , dependsOnMethods = "testCategoryCreation") public void testTermCreationWithoutAnyRelations() { try { checkingAccount = glossaryService.createTerm(checkingAccount); assertNotNull(checkingAccount); assertNotNull(checkingAccount.getGuid()); } catch (AtlasBaseException e) { fail("Term creation should've succeeded", e); } }
@GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(groups = "Glossary.CREATE" , dependsOnMethods = "testTermCreationWithoutAnyRelations") public void testTermCreateWithRelation() { try { AtlasRelatedTermHeader relatedTermHeader = new AtlasRelatedTermHeader(); relatedTermHeader.setTermGuid(checkingAccount.getGuid()); relatedTermHeader.setDescription("test description"); relatedTermHeader.setExpression("test expression"); relatedTermHeader.setSource("UT"); relatedTermHeader.setSteward("UT"); relatedTermHeader.setStatus(AtlasTermRelationshipStatus.ACTIVE); savingsAccount.setSeeAlso(Collections.singleton(relatedTermHeader)); savingsAccount = glossaryService.createTerm(savingsAccount); assertNotNull(savingsAccount); assertNotNull(savingsAccount.getGuid()); } catch (AtlasBaseException e) { fail("Term creation with relation should've succeeded", e); } }
@GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "GlossaryTerm definition missing"); } if (Objects.isNull(glossaryTerm.getAnchor())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ANCHOR); } if (StringUtils.isEmpty(glossaryTerm.getName())) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_QUALIFIED_NAME_CANT_BE_DERIVED); } if (isNameInvalid(glossaryTerm.getName())){ throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } else { String anchorGlossaryGuid = glossaryTerm.getAnchor().getGlossaryGuid(); AtlasGlossary glossary = dataAccess.load(getGlossarySkeleton(anchorGlossaryGuid)); glossaryTerm.setQualifiedName(glossaryTerm.getName() + "@" + glossary.getQualifiedName()); if (LOG.isDebugEnabled()) { LOG.debug("Derived qualifiedName = {}", glossaryTerm.getQualifiedName()); } } if (termExists(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.GLOSSARY_TERM_ALREADY_EXISTS, glossaryTerm.getQualifiedName()); } AtlasGlossaryTerm storeObject = dataAccess.save(glossaryTerm); glossaryTermUtils.processTermRelations(storeObject, glossaryTerm, GlossaryUtils.RelationshipOperation.CREATE); storeObject = dataAccess.load(glossaryTerm); setInfoForRelations(storeObject); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.create() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(groups = "Glossary.CREATE" , dependsOnMethods = "testCategoryCreation") public void testTermCreationWithCategory() { try { AtlasTermCategorizationHeader termCategorizationHeader = new AtlasTermCategorizationHeader(); termCategorizationHeader.setCategoryGuid(mortgageCategory.getGuid()); termCategorizationHeader.setDescription("Test description"); termCategorizationHeader.setStatus(AtlasTermRelationshipStatus.DRAFT); fixedRateMortgage.setCategories(Collections.singleton(termCategorizationHeader)); adjustableRateMortgage.setCategories(Collections.singleton(termCategorizationHeader)); List<AtlasGlossaryTerm> terms = glossaryService.createTerms(Arrays.asList(fixedRateMortgage, adjustableRateMortgage)); fixedRateMortgage.setGuid(terms.get(0).getGuid()); adjustableRateMortgage.setGuid(terms.get(1).getGuid()); } catch (AtlasBaseException e) { fail("Term creation should've succeeded", e); } }
@GraphTransaction public List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryTerm(s) is null/empty"); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); for (AtlasGlossaryTerm atlasGlossaryTerm : glossaryTerm) { ret.add(createTerm(atlasGlossaryTerm)); } if (LOG.isDebugEnabled()) { LOG.debug("<== GlossaryService.createTerms() : {}", ret); } return ret; }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryTerm(s) is null/empty"); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); for (AtlasGlossaryTerm atlasGlossaryTerm : glossaryTerm) { ret.add(createTerm(atlasGlossaryTerm)); } if (LOG.isDebugEnabled()) { LOG.debug("<== GlossaryService.createTerms() : {}", ret); } return ret; } }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryTerm(s) is null/empty"); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); for (AtlasGlossaryTerm atlasGlossaryTerm : glossaryTerm) { ret.add(createTerm(atlasGlossaryTerm)); } if (LOG.isDebugEnabled()) { LOG.debug("<== GlossaryService.createTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryTerm(s) is null/empty"); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); for (AtlasGlossaryTerm atlasGlossaryTerm : glossaryTerm) { ret.add(createTerm(atlasGlossaryTerm)); } if (LOG.isDebugEnabled()) { LOG.debug("<== GlossaryService.createTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.create({})", glossaryTerm); } if (Objects.isNull(glossaryTerm)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryTerm(s) is null/empty"); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); for (AtlasGlossaryTerm atlasGlossaryTerm : glossaryTerm) { ret.add(createTerm(atlasGlossaryTerm)); } if (LOG.isDebugEnabled()) { LOG.debug("<== GlossaryService.createTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(dataProvider = "getAllGlossaryDataProvider", groups = "Glossary.GET", dependsOnGroups = "Glossary.CREATE") public void testGetAllGlossaries(int limit, int offset, SortOrder sortOrder, int expected) { try { List<AtlasGlossary> glossaries = glossaryService.getGlossaries(limit, offset, sortOrder); assertEquals(glossaries.size(), expected); } catch (AtlasBaseException e) { fail("Get glossaries should've succeeded", e); } }
@GraphTransaction public List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaries({}, {}, {})", limit, offset, sortOrder); } List<String> glossaryGuids = AtlasGraphUtilsV2.findEntityGUIDsByType(GlossaryUtils.ATLAS_GLOSSARY_TYPENAME, sortOrder); PaginationHelper paginationHelper = new PaginationHelper<>(glossaryGuids, offset, limit); List<AtlasGlossary> ret; List<String> guidsToLoad = paginationHelper.getPaginatedList(); if (CollectionUtils.isNotEmpty(guidsToLoad)) { ret = guidsToLoad.stream().map(GlossaryUtils::getGlossarySkeleton).collect(Collectors.toList()); Iterable<AtlasGlossary> glossaries = dataAccess.load(ret); ret.clear(); for (AtlasGlossary glossary : glossaries) { setInfoForRelations(glossary); ret.add(glossary); } } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaries() : {}", ret); } return ret; }
GlossaryService { @GraphTransaction public List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaries({}, {}, {})", limit, offset, sortOrder); } List<String> glossaryGuids = AtlasGraphUtilsV2.findEntityGUIDsByType(GlossaryUtils.ATLAS_GLOSSARY_TYPENAME, sortOrder); PaginationHelper paginationHelper = new PaginationHelper<>(glossaryGuids, offset, limit); List<AtlasGlossary> ret; List<String> guidsToLoad = paginationHelper.getPaginatedList(); if (CollectionUtils.isNotEmpty(guidsToLoad)) { ret = guidsToLoad.stream().map(GlossaryUtils::getGlossarySkeleton).collect(Collectors.toList()); Iterable<AtlasGlossary> glossaries = dataAccess.load(ret); ret.clear(); for (AtlasGlossary glossary : glossaries) { setInfoForRelations(glossary); ret.add(glossary); } } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaries() : {}", ret); } return ret; } }
GlossaryService { @GraphTransaction public List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaries({}, {}, {})", limit, offset, sortOrder); } List<String> glossaryGuids = AtlasGraphUtilsV2.findEntityGUIDsByType(GlossaryUtils.ATLAS_GLOSSARY_TYPENAME, sortOrder); PaginationHelper paginationHelper = new PaginationHelper<>(glossaryGuids, offset, limit); List<AtlasGlossary> ret; List<String> guidsToLoad = paginationHelper.getPaginatedList(); if (CollectionUtils.isNotEmpty(guidsToLoad)) { ret = guidsToLoad.stream().map(GlossaryUtils::getGlossarySkeleton).collect(Collectors.toList()); Iterable<AtlasGlossary> glossaries = dataAccess.load(ret); ret.clear(); for (AtlasGlossary glossary : glossaries) { setInfoForRelations(glossary); ret.add(glossary); } } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaries() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaries({}, {}, {})", limit, offset, sortOrder); } List<String> glossaryGuids = AtlasGraphUtilsV2.findEntityGUIDsByType(GlossaryUtils.ATLAS_GLOSSARY_TYPENAME, sortOrder); PaginationHelper paginationHelper = new PaginationHelper<>(glossaryGuids, offset, limit); List<AtlasGlossary> ret; List<String> guidsToLoad = paginationHelper.getPaginatedList(); if (CollectionUtils.isNotEmpty(guidsToLoad)) { ret = guidsToLoad.stream().map(GlossaryUtils::getGlossarySkeleton).collect(Collectors.toList()); Iterable<AtlasGlossary> glossaries = dataAccess.load(ret); ret.clear(); for (AtlasGlossary glossary : glossaries) { setInfoForRelations(glossary); ret.add(glossary); } } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaries() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaries({}, {}, {})", limit, offset, sortOrder); } List<String> glossaryGuids = AtlasGraphUtilsV2.findEntityGUIDsByType(GlossaryUtils.ATLAS_GLOSSARY_TYPENAME, sortOrder); PaginationHelper paginationHelper = new PaginationHelper<>(glossaryGuids, offset, limit); List<AtlasGlossary> ret; List<String> guidsToLoad = paginationHelper.getPaginatedList(); if (CollectionUtils.isNotEmpty(guidsToLoad)) { ret = guidsToLoad.stream().map(GlossaryUtils::getGlossarySkeleton).collect(Collectors.toList()); Iterable<AtlasGlossary> glossaries = dataAccess.load(ret); ret.clear(); for (AtlasGlossary glossary : glossaries) { setInfoForRelations(glossary); ret.add(glossary); } } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaries() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(groups = "Glossary.UPDATE", dependsOnGroups = "Glossary.CREATE") public void testUpdateGlossary() { try { bankGlossary = glossaryService.getGlossary(bankGlossary.getGuid()); bankGlossary.setShortDescription("Updated short description"); bankGlossary.setLongDescription("Updated long description"); AtlasGlossary updatedGlossary = glossaryService.updateGlossary(bankGlossary); assertNotNull(updatedGlossary); assertEquals(updatedGlossary.getGuid(), bankGlossary.getGuid()); ArrayList<AtlasRelatedCategoryHeader> a = new ArrayList<>(updatedGlossary.getCategories()); ArrayList<AtlasRelatedCategoryHeader> b = new ArrayList<>(bankGlossary.getCategories()); assertEquals(a, b); } catch (AtlasBaseException e) { fail("Glossary fetch/update should've succeeded", e); } }
@GraphTransaction public AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.updateGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary is null/empty"); } if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "DisplayName can't be null/empty"); } if (isNameInvalid(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } AtlasGlossary storeObject = dataAccess.load(atlasGlossary); if (!storeObject.equals(atlasGlossary)) { atlasGlossary.setGuid(storeObject.getGuid()); atlasGlossary.setQualifiedName(storeObject.getQualifiedName()); storeObject = dataAccess.save(atlasGlossary); setInfoForRelations(storeObject); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.updateGlossary() : {}", storeObject); } return storeObject; }
GlossaryService { @GraphTransaction public AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.updateGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary is null/empty"); } if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "DisplayName can't be null/empty"); } if (isNameInvalid(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } AtlasGlossary storeObject = dataAccess.load(atlasGlossary); if (!storeObject.equals(atlasGlossary)) { atlasGlossary.setGuid(storeObject.getGuid()); atlasGlossary.setQualifiedName(storeObject.getQualifiedName()); storeObject = dataAccess.save(atlasGlossary); setInfoForRelations(storeObject); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.updateGlossary() : {}", storeObject); } return storeObject; } }
GlossaryService { @GraphTransaction public AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.updateGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary is null/empty"); } if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "DisplayName can't be null/empty"); } if (isNameInvalid(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } AtlasGlossary storeObject = dataAccess.load(atlasGlossary); if (!storeObject.equals(atlasGlossary)) { atlasGlossary.setGuid(storeObject.getGuid()); atlasGlossary.setQualifiedName(storeObject.getQualifiedName()); storeObject = dataAccess.save(atlasGlossary); setInfoForRelations(storeObject); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.updateGlossary() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.updateGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary is null/empty"); } if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "DisplayName can't be null/empty"); } if (isNameInvalid(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } AtlasGlossary storeObject = dataAccess.load(atlasGlossary); if (!storeObject.equals(atlasGlossary)) { atlasGlossary.setGuid(storeObject.getGuid()); atlasGlossary.setQualifiedName(storeObject.getQualifiedName()); storeObject = dataAccess.save(atlasGlossary); setInfoForRelations(storeObject); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.updateGlossary() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.updateGlossary({})", atlasGlossary); } if (Objects.isNull(atlasGlossary)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Glossary is null/empty"); } if (StringUtils.isEmpty(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "DisplayName can't be null/empty"); } if (isNameInvalid(atlasGlossary.getName())) { throw new AtlasBaseException(AtlasErrorCode.INVALID_DISPLAY_NAME); } AtlasGlossary storeObject = dataAccess.load(atlasGlossary); if (!storeObject.equals(atlasGlossary)) { atlasGlossary.setGuid(storeObject.getGuid()); atlasGlossary.setQualifiedName(storeObject.getQualifiedName()); storeObject = dataAccess.save(atlasGlossary); setInfoForRelations(storeObject); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.updateGlossary() : {}", storeObject); } return storeObject; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(dependsOnMethods = "testInvalidFetches") public void testDeleteGlossary() { try { glossaryService.deleteGlossary(bankGlossary.getGuid()); try { glossaryService.getGlossary(bankGlossary.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } try { glossaryService.getTerm(fixedRateMortgage.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } try { glossaryService.getTerm(adjustableRateMortgage.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } try { glossaryService.getTerm(savingsAccount.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } try { glossaryService.getTerm(checkingAccount.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } try { glossaryService.getCategory(customerCategory.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } try { glossaryService.getCategory(accountCategory.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } try { glossaryService.getCategory(mortgageCategory.getGuid()); } catch (AtlasBaseException e) { assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.INSTANCE_GUID_NOT_FOUND); } } catch (AtlasBaseException e) { fail("Glossary delete should've succeeded", e); } }
@GraphTransaction public void deleteGlossary(String glossaryGuid) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.deleteGlossary({})", glossaryGuid); } if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } AtlasGlossary storeObject = dataAccess.load(getGlossarySkeleton(glossaryGuid)); Set<AtlasRelatedTermHeader> terms = storeObject.getTerms(); deleteTerms(storeObject, terms); Set<AtlasRelatedCategoryHeader> categories = storeObject.getCategories(); deleteCategories(storeObject, categories); dataAccess.delete(glossaryGuid); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.deleteGlossary()"); } }
GlossaryService { @GraphTransaction public void deleteGlossary(String glossaryGuid) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.deleteGlossary({})", glossaryGuid); } if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } AtlasGlossary storeObject = dataAccess.load(getGlossarySkeleton(glossaryGuid)); Set<AtlasRelatedTermHeader> terms = storeObject.getTerms(); deleteTerms(storeObject, terms); Set<AtlasRelatedCategoryHeader> categories = storeObject.getCategories(); deleteCategories(storeObject, categories); dataAccess.delete(glossaryGuid); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.deleteGlossary()"); } } }
GlossaryService { @GraphTransaction public void deleteGlossary(String glossaryGuid) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.deleteGlossary({})", glossaryGuid); } if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } AtlasGlossary storeObject = dataAccess.load(getGlossarySkeleton(glossaryGuid)); Set<AtlasRelatedTermHeader> terms = storeObject.getTerms(); deleteTerms(storeObject, terms); Set<AtlasRelatedCategoryHeader> categories = storeObject.getCategories(); deleteCategories(storeObject, categories); dataAccess.delete(glossaryGuid); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.deleteGlossary()"); } } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public void deleteGlossary(String glossaryGuid) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.deleteGlossary({})", glossaryGuid); } if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } AtlasGlossary storeObject = dataAccess.load(getGlossarySkeleton(glossaryGuid)); Set<AtlasRelatedTermHeader> terms = storeObject.getTerms(); deleteTerms(storeObject, terms); Set<AtlasRelatedCategoryHeader> categories = storeObject.getCategories(); deleteCategories(storeObject, categories); dataAccess.delete(glossaryGuid); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.deleteGlossary()"); } } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public void deleteGlossary(String glossaryGuid) throws AtlasBaseException { if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.deleteGlossary({})", glossaryGuid); } if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } AtlasGlossary storeObject = dataAccess.load(getGlossarySkeleton(glossaryGuid)); Set<AtlasRelatedTermHeader> terms = storeObject.getTerms(); deleteTerms(storeObject, terms); Set<AtlasRelatedCategoryHeader> categories = storeObject.getCategories(); deleteCategories(storeObject, categories); dataAccess.delete(glossaryGuid); if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.deleteGlossary()"); } } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test public void testStructTypeIsValidValue() { for (Object value : validValues) { assertTrue(structType.isValidValue(value), "value=" + value); } for (Object value : invalidValues) { assertFalse(structType.isValidValue(value), "value=" + value); } }
@Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof AtlasStruct) { AtlasStruct structObj = (AtlasStruct) obj; for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(structObj.getAttribute(attributeDef.getName()), attributeDef)) { return false; } } } else if (obj instanceof Map) { Map map = AtlasTypeUtil.toStructAttributes((Map) obj); for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(map.get(attributeDef.getName()), attributeDef)) { return false; } } } else { return false; } } return true; }
AtlasStructType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof AtlasStruct) { AtlasStruct structObj = (AtlasStruct) obj; for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(structObj.getAttribute(attributeDef.getName()), attributeDef)) { return false; } } } else if (obj instanceof Map) { Map map = AtlasTypeUtil.toStructAttributes((Map) obj); for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(map.get(attributeDef.getName()), attributeDef)) { return false; } } } else { return false; } } return true; } }
AtlasStructType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof AtlasStruct) { AtlasStruct structObj = (AtlasStruct) obj; for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(structObj.getAttribute(attributeDef.getName()), attributeDef)) { return false; } } } else if (obj instanceof Map) { Map map = AtlasTypeUtil.toStructAttributes((Map) obj); for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(map.get(attributeDef.getName()), attributeDef)) { return false; } } } else { return false; } } return true; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); }
AtlasStructType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof AtlasStruct) { AtlasStruct structObj = (AtlasStruct) obj; for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(structObj.getAttribute(attributeDef.getName()), attributeDef)) { return false; } } } else if (obj instanceof Map) { Map map = AtlasTypeUtil.toStructAttributes((Map) obj); for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(map.get(attributeDef.getName()), attributeDef)) { return false; } } } else { return false; } } return true; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); AtlasStructDef getStructDef(); AtlasType getAttributeType(String attributeName); AtlasAttributeDef getAttributeDef(String attributeName); @Override AtlasStruct createDefaultValue(); @Override Object createDefaultValue(Object defaultValue); Map<String, AtlasAttribute> getAllAttributes(); Map<String, AtlasAttribute> getUniqAttributes(); AtlasAttribute getAttribute(String attributeName); AtlasAttribute getSystemAttribute(String attributeName); AtlasAttribute getBusinesAAttribute(String attributeName); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Object getNormalizedValue(Object obj); @Override Object getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); void normalizeAttributeValues(AtlasStruct obj); void normalizeAttributeValuesForUpdate(AtlasStruct obj); void normalizeAttributeValues(Map<String, Object> obj); void normalizeAttributeValuesForUpdate(Map<String, Object> obj); void populateDefaultValues(AtlasStruct obj); String getVertexPropertyName(String attrName); String getQualifiedAttributePropertyKey(String attrName); }
AtlasStructType extends AtlasType { @Override public boolean isValidValue(Object obj) { if (obj != null) { if (obj instanceof AtlasStruct) { AtlasStruct structObj = (AtlasStruct) obj; for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(structObj.getAttribute(attributeDef.getName()), attributeDef)) { return false; } } } else if (obj instanceof Map) { Map map = AtlasTypeUtil.toStructAttributes((Map) obj); for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { if (!isAssignableValue(map.get(attributeDef.getName()), attributeDef)) { return false; } } } else { return false; } } return true; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); AtlasStructDef getStructDef(); AtlasType getAttributeType(String attributeName); AtlasAttributeDef getAttributeDef(String attributeName); @Override AtlasStruct createDefaultValue(); @Override Object createDefaultValue(Object defaultValue); Map<String, AtlasAttribute> getAllAttributes(); Map<String, AtlasAttribute> getUniqAttributes(); AtlasAttribute getAttribute(String attributeName); AtlasAttribute getSystemAttribute(String attributeName); AtlasAttribute getBusinesAAttribute(String attributeName); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Object getNormalizedValue(Object obj); @Override Object getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); void normalizeAttributeValues(AtlasStruct obj); void normalizeAttributeValuesForUpdate(AtlasStruct obj); void normalizeAttributeValues(Map<String, Object> obj); void normalizeAttributeValuesForUpdate(Map<String, Object> obj); void populateDefaultValues(AtlasStruct obj); String getVertexPropertyName(String attrName); String getQualifiedAttributePropertyKey(String attrName); static final String UNIQUE_ATTRIBUTE_SHADE_PROPERTY_PREFIX; }
@Test(dataProvider = "getGlossaryTermsProvider" , groups = "Glossary.GET.postUpdate", dependsOnGroups = "Glossary.UPDATE") public void testGetGlossaryTerms(int offset, int limit, int expected) { String guid = bankGlossary.getGuid(); SortOrder sortOrder = SortOrder.ASCENDING; try { List<AtlasRelatedTermHeader> glossaryTerms = glossaryService.getGlossaryTermsHeaders(guid, offset, limit, sortOrder); assertNotNull(glossaryTerms); assertEquals(glossaryTerms.size(), expected); } catch (AtlasBaseException e) { fail("Glossary term fetching should've succeeded", e); } }
@GraphTransaction public List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryTerms({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); List<AtlasRelatedTermHeader> termHeaders = getGlossaryTermsHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedTermHeader header : termHeaders) { ret.add(dataAccess.load(getAtlasGlossaryTermSkeleton(header.getTermGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryTerms() : {}", ret); } return ret; }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryTerms({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); List<AtlasRelatedTermHeader> termHeaders = getGlossaryTermsHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedTermHeader header : termHeaders) { ret.add(dataAccess.load(getAtlasGlossaryTermSkeleton(header.getTermGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryTerms() : {}", ret); } return ret; } }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryTerms({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); List<AtlasRelatedTermHeader> termHeaders = getGlossaryTermsHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedTermHeader header : termHeaders) { ret.add(dataAccess.load(getAtlasGlossaryTermSkeleton(header.getTermGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryTerms({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); List<AtlasRelatedTermHeader> termHeaders = getGlossaryTermsHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedTermHeader header : termHeaders) { ret.add(dataAccess.load(getAtlasGlossaryTermSkeleton(header.getTermGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryTerms({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryTerm> ret = new ArrayList<>(); List<AtlasRelatedTermHeader> termHeaders = getGlossaryTermsHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedTermHeader header : termHeaders) { ret.add(dataAccess.load(getAtlasGlossaryTermSkeleton(header.getTermGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(dataProvider = "getGlossaryCategoriesProvider" , groups = "Glossary.GET.postUpdate", dependsOnGroups = "Glossary.UPDATE") public void testGetGlossaryCategories(int offset, int limit, int expected) { String guid = bankGlossary.getGuid(); SortOrder sortOrder = SortOrder.ASCENDING; try { List<AtlasRelatedCategoryHeader> glossaryCategories = glossaryService.getGlossaryCategoriesHeaders(guid, offset, limit, sortOrder); assertNotNull(glossaryCategories); assertEquals(glossaryCategories.size(), expected); } catch (AtlasBaseException e) { fail("Glossary term fetching should've succeeded"); } }
@GraphTransaction public List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryCategories({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryCategory> ret = new ArrayList<>(); List<AtlasRelatedCategoryHeader> categoryHeaders = getGlossaryCategoriesHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedCategoryHeader header : categoryHeaders) { ret.add(dataAccess.load(getAtlasGlossaryCategorySkeleton(header.getCategoryGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryCategories() : {}", ret); } return ret; }
GlossaryService { @GraphTransaction public List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryCategories({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryCategory> ret = new ArrayList<>(); List<AtlasRelatedCategoryHeader> categoryHeaders = getGlossaryCategoriesHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedCategoryHeader header : categoryHeaders) { ret.add(dataAccess.load(getAtlasGlossaryCategorySkeleton(header.getCategoryGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryCategories() : {}", ret); } return ret; } }
GlossaryService { @GraphTransaction public List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryCategories({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryCategory> ret = new ArrayList<>(); List<AtlasRelatedCategoryHeader> categoryHeaders = getGlossaryCategoriesHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedCategoryHeader header : categoryHeaders) { ret.add(dataAccess.load(getAtlasGlossaryCategorySkeleton(header.getCategoryGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryCategories() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryCategories({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryCategory> ret = new ArrayList<>(); List<AtlasRelatedCategoryHeader> categoryHeaders = getGlossaryCategoriesHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedCategoryHeader header : categoryHeaders) { ret.add(dataAccess.load(getAtlasGlossaryCategorySkeleton(header.getCategoryGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryCategories() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(glossaryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "glossaryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getGlossaryCategories({}, {}, {}, {})", glossaryGuid, offset, limit, sortOrder); } List<AtlasGlossaryCategory> ret = new ArrayList<>(); List<AtlasRelatedCategoryHeader> categoryHeaders = getGlossaryCategoriesHeaders(glossaryGuid, offset, limit, sortOrder); for (AtlasRelatedCategoryHeader header : categoryHeaders) { ret.add(dataAccess.load(getAtlasGlossaryCategorySkeleton(header.getCategoryGuid()))); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getGlossaryCategories() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test(dataProvider = "getCategoryTermsProvider", dependsOnGroups = "Glossary.CREATE") public void testGetCategoryTerms(int offset, int limit, int expected) { for (AtlasGlossaryCategory c : Arrays.asList(accountCategory, mortgageCategory)) { try { List<AtlasRelatedTermHeader> categoryTerms = glossaryService.getCategoryTerms(c.getGuid(), offset, limit, SortOrder.ASCENDING); assertNotNull(categoryTerms); assertEquals(categoryTerms.size(), expected); } catch (AtlasBaseException e) { fail("Category term retrieval should've been a success", e); } } }
@GraphTransaction public List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(categoryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "categoryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getCategoryTerms({}, {}, {}, {})", categoryGuid, offset, limit, sortOrder); } List<AtlasRelatedTermHeader> ret; AtlasGlossaryCategory glossaryCategory = getCategory(categoryGuid); if (CollectionUtils.isNotEmpty(glossaryCategory.getTerms())) { List<AtlasRelatedTermHeader> terms = new ArrayList<>(glossaryCategory.getTerms()); if (sortOrder != null) { terms.sort((o1, o2) -> sortOrder == SortOrder.ASCENDING ? o1.getDisplayText().compareTo(o2.getDisplayText()) : o2.getDisplayText().compareTo(o1.getDisplayText())); } ret = new PaginationHelper<>(terms, offset, limit).getPaginatedList(); } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getCategoryTerms() : {}", ret); } return ret; }
GlossaryService { @GraphTransaction public List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(categoryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "categoryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getCategoryTerms({}, {}, {}, {})", categoryGuid, offset, limit, sortOrder); } List<AtlasRelatedTermHeader> ret; AtlasGlossaryCategory glossaryCategory = getCategory(categoryGuid); if (CollectionUtils.isNotEmpty(glossaryCategory.getTerms())) { List<AtlasRelatedTermHeader> terms = new ArrayList<>(glossaryCategory.getTerms()); if (sortOrder != null) { terms.sort((o1, o2) -> sortOrder == SortOrder.ASCENDING ? o1.getDisplayText().compareTo(o2.getDisplayText()) : o2.getDisplayText().compareTo(o1.getDisplayText())); } ret = new PaginationHelper<>(terms, offset, limit).getPaginatedList(); } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getCategoryTerms() : {}", ret); } return ret; } }
GlossaryService { @GraphTransaction public List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(categoryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "categoryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getCategoryTerms({}, {}, {}, {})", categoryGuid, offset, limit, sortOrder); } List<AtlasRelatedTermHeader> ret; AtlasGlossaryCategory glossaryCategory = getCategory(categoryGuid); if (CollectionUtils.isNotEmpty(glossaryCategory.getTerms())) { List<AtlasRelatedTermHeader> terms = new ArrayList<>(glossaryCategory.getTerms()); if (sortOrder != null) { terms.sort((o1, o2) -> sortOrder == SortOrder.ASCENDING ? o1.getDisplayText().compareTo(o2.getDisplayText()) : o2.getDisplayText().compareTo(o1.getDisplayText())); } ret = new PaginationHelper<>(terms, offset, limit).getPaginatedList(); } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getCategoryTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { @GraphTransaction public List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(categoryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "categoryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getCategoryTerms({}, {}, {}, {})", categoryGuid, offset, limit, sortOrder); } List<AtlasRelatedTermHeader> ret; AtlasGlossaryCategory glossaryCategory = getCategory(categoryGuid); if (CollectionUtils.isNotEmpty(glossaryCategory.getTerms())) { List<AtlasRelatedTermHeader> terms = new ArrayList<>(glossaryCategory.getTerms()); if (sortOrder != null) { terms.sort((o1, o2) -> sortOrder == SortOrder.ASCENDING ? o1.getDisplayText().compareTo(o2.getDisplayText()) : o2.getDisplayText().compareTo(o1.getDisplayText())); } ret = new PaginationHelper<>(terms, offset, limit).getPaginatedList(); } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getCategoryTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { @GraphTransaction public List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder) throws AtlasBaseException { if (Objects.isNull(categoryGuid)) { throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "categoryGuid is null/empty"); } if (DEBUG_ENABLED) { LOG.debug("==> GlossaryService.getCategoryTerms({}, {}, {}, {})", categoryGuid, offset, limit, sortOrder); } List<AtlasRelatedTermHeader> ret; AtlasGlossaryCategory glossaryCategory = getCategory(categoryGuid); if (CollectionUtils.isNotEmpty(glossaryCategory.getTerms())) { List<AtlasRelatedTermHeader> terms = new ArrayList<>(glossaryCategory.getTerms()); if (sortOrder != null) { terms.sort((o1, o2) -> sortOrder == SortOrder.ASCENDING ? o1.getDisplayText().compareTo(o2.getDisplayText()) : o2.getDisplayText().compareTo(o1.getDisplayText())); } ret = new PaginationHelper<>(terms, offset, limit).getPaginatedList(); } else { ret = Collections.emptyList(); } if (DEBUG_ENABLED) { LOG.debug("<== GlossaryService.getCategoryTerms() : {}", ret); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test( dependsOnGroups = "Glossary.CREATE" ) public void testImportGlossaryData(){ try { InputStream inputStream = getFile(CSV_FILES,"template_1.csv"); List<AtlasGlossaryTerm> atlasGlossaryTermList = glossaryService.importGlossaryData(inputStream,"template_1.csv"); assertNotNull(atlasGlossaryTermList); assertEquals(atlasGlossaryTermList.size(), 1); InputStream inputStream1 = getFile(EXCEL_FILES,"template_1.xlsx"); List<AtlasGlossaryTerm> atlasGlossaryTermList1 = glossaryService.importGlossaryData(inputStream1,"template_1.xlsx"); assertNotNull(atlasGlossaryTermList1); assertEquals(atlasGlossaryTermList1.size(), 1); } catch (AtlasBaseException e){ fail("The GlossaryTerm should have been created "+e); } }
public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test public void testEmptyFileException() { InputStream inputStream = getFile(CSV_FILES, "empty.csv"); try { glossaryService.importGlossaryData(inputStream, "empty.csv"); fail("Error occurred : Failed to recognize the empty file."); } catch (AtlasBaseException e) { assertEquals(e.getMessage(),"No data found in the uploaded file"); } }
public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test public void testIncorrectFileException() { InputStream inputStream = getFile(CSV_FILES, "incorrectFile.csv"); try { glossaryService.importGlossaryData(inputStream, "incorrectFile.csv"); fail("Error occurred : Failed to recognize the incorrect file."); } catch (AtlasBaseException e) { assertEquals(e.getMessage(),"The uploaded file has not been processed due to the following errors : \n" + "[\n" + "The provided Reference Glossary and TermName does not exist in the system GentsFootwear: for record with TermName : BankBranch1 and GlossaryName : testBankingGlossary]"); } }
public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
GlossaryService { public List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName) throws AtlasBaseException { List<AtlasGlossaryTerm> ret; try { if (StringUtils.isBlank(fileName)) { throw new AtlasBaseException(AtlasErrorCode.INVALID_FILE_TYPE, fileName); } List<String[]> fileData = FileUtils.readFileData(fileName, inputStream); List<String> failedTermMsgs = new ArrayList<>(); ret = glossaryTermUtils.getGlossaryTermDataList(fileData, failedTermMsgs); ret = createGlossaryTerms(ret); } catch (IOException e) { throw new AtlasBaseException(AtlasErrorCode.FAILED_TO_UPLOAD, e); } return ret; } @Inject GlossaryService(DataAccess dataAccess, final AtlasRelationshipStore relationshipStore, final AtlasTypeRegistry typeRegistry, AtlasEntityChangeNotifier entityChangeNotifier); @GraphTransaction List<AtlasGlossary> getGlossaries(int limit, int offset, SortOrder sortOrder); @GraphTransaction AtlasGlossary createGlossary(AtlasGlossary atlasGlossary); @GraphTransaction AtlasGlossary getGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary.AtlasGlossaryExtInfo getDetailedGlossary(String glossaryGuid); @GraphTransaction AtlasGlossary updateGlossary(AtlasGlossary atlasGlossary); @GraphTransaction void deleteGlossary(String glossaryGuid); @GraphTransaction AtlasGlossaryTerm getTerm(String termGuid); @GraphTransaction AtlasGlossaryTerm createTerm(AtlasGlossaryTerm glossaryTerm); @GraphTransaction List<AtlasGlossaryTerm> createTerms(List<AtlasGlossaryTerm> glossaryTerm); @GraphTransaction AtlasGlossaryTerm updateTerm(AtlasGlossaryTerm atlasGlossaryTerm); @GraphTransaction void deleteTerm(String termGuid); @GraphTransaction void assignTermToEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction void removeTermFromEntities(String termGuid, List<AtlasRelatedObjectId> relatedObjectIds); @GraphTransaction AtlasGlossaryCategory getCategory(String categoryGuid); @GraphTransaction AtlasGlossaryCategory createCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction List<AtlasGlossaryCategory> createCategories(List<AtlasGlossaryCategory> glossaryCategory); @GraphTransaction AtlasGlossaryCategory updateCategory(AtlasGlossaryCategory glossaryCategory); @GraphTransaction void deleteCategory(String categoryGuid); @GraphTransaction List<AtlasRelatedTermHeader> getGlossaryTermsHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryTerm> getGlossaryTerms(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedCategoryHeader> getGlossaryCategoriesHeaders(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasGlossaryCategory> getGlossaryCategories(String glossaryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedTermHeader> getCategoryTerms(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<AtlasGlossaryTerm.Relation, Set<AtlasRelatedTermHeader>> getRelatedTerms(String termGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction Map<String, List<AtlasRelatedCategoryHeader>> getRelatedCategories(String categoryGuid, int offset, int limit, SortOrder sortOrder); @GraphTransaction List<AtlasRelatedObjectId> getAssignedEntities(final String termGuid, int offset, int limit, SortOrder sortOrder); static boolean isNameInvalid(String name); List<AtlasGlossaryTerm> importGlossaryData(InputStream inputStream, String fileName); }
@Test public void testStructTypeGetNormalizedValue() { assertNull(structType.getNormalizedValue(null), "value=" + null); for (Object value : validValues) { if (value == null) { continue; } Object normalizedValue = structType.getNormalizedValue(value); assertNotNull(normalizedValue, "value=" + value); } for (Object value : invalidValues) { assertNull(structType.getNormalizedValue(value), "value=" + value); } }
@Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasStruct) { normalizeAttributeValues((AtlasStruct) obj); ret = obj; } else if (obj instanceof Map) { normalizeAttributeValues((Map) obj); ret = obj; } } } return ret; }
AtlasStructType extends AtlasType { @Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasStruct) { normalizeAttributeValues((AtlasStruct) obj); ret = obj; } else if (obj instanceof Map) { normalizeAttributeValues((Map) obj); ret = obj; } } } return ret; } }
AtlasStructType extends AtlasType { @Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasStruct) { normalizeAttributeValues((AtlasStruct) obj); ret = obj; } else if (obj instanceof Map) { normalizeAttributeValues((Map) obj); ret = obj; } } } return ret; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); }
AtlasStructType extends AtlasType { @Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasStruct) { normalizeAttributeValues((AtlasStruct) obj); ret = obj; } else if (obj instanceof Map) { normalizeAttributeValues((Map) obj); ret = obj; } } } return ret; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); AtlasStructDef getStructDef(); AtlasType getAttributeType(String attributeName); AtlasAttributeDef getAttributeDef(String attributeName); @Override AtlasStruct createDefaultValue(); @Override Object createDefaultValue(Object defaultValue); Map<String, AtlasAttribute> getAllAttributes(); Map<String, AtlasAttribute> getUniqAttributes(); AtlasAttribute getAttribute(String attributeName); AtlasAttribute getSystemAttribute(String attributeName); AtlasAttribute getBusinesAAttribute(String attributeName); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Object getNormalizedValue(Object obj); @Override Object getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); void normalizeAttributeValues(AtlasStruct obj); void normalizeAttributeValuesForUpdate(AtlasStruct obj); void normalizeAttributeValues(Map<String, Object> obj); void normalizeAttributeValuesForUpdate(Map<String, Object> obj); void populateDefaultValues(AtlasStruct obj); String getVertexPropertyName(String attrName); String getQualifiedAttributePropertyKey(String attrName); }
AtlasStructType extends AtlasType { @Override public Object getNormalizedValue(Object obj) { Object ret = null; if (obj != null) { if (isValidValue(obj)) { if (obj instanceof AtlasStruct) { normalizeAttributeValues((AtlasStruct) obj); ret = obj; } else if (obj instanceof Map) { normalizeAttributeValues((Map) obj); ret = obj; } } } return ret; } AtlasStructType(AtlasStructDef structDef); AtlasStructType(AtlasStructDef structDef, AtlasTypeRegistry typeRegistry); AtlasStructDef getStructDef(); AtlasType getAttributeType(String attributeName); AtlasAttributeDef getAttributeDef(String attributeName); @Override AtlasStruct createDefaultValue(); @Override Object createDefaultValue(Object defaultValue); Map<String, AtlasAttribute> getAllAttributes(); Map<String, AtlasAttribute> getUniqAttributes(); AtlasAttribute getAttribute(String attributeName); AtlasAttribute getSystemAttribute(String attributeName); AtlasAttribute getBusinesAAttribute(String attributeName); @Override boolean isValidValue(Object obj); @Override boolean areEqualValues(Object val1, Object val2, Map<String, String> guidAssignments); @Override boolean isValidValueForUpdate(Object obj); @Override Object getNormalizedValue(Object obj); @Override Object getNormalizedValueForUpdate(Object obj); @Override boolean validateValue(Object obj, String objName, List<String> messages); @Override boolean validateValueForUpdate(Object obj, String objName, List<String> messages); void normalizeAttributeValues(AtlasStruct obj); void normalizeAttributeValuesForUpdate(AtlasStruct obj); void normalizeAttributeValues(Map<String, Object> obj); void normalizeAttributeValuesForUpdate(Map<String, Object> obj); void populateDefaultValues(AtlasStruct obj); String getVertexPropertyName(String attrName); String getQualifiedAttributePropertyKey(String attrName); static final String UNIQUE_ATTRIBUTE_SHADE_PROPERTY_PREFIX; }
@Test public void testImportThatUpdatesRegisteredDatabase() throws Exception { when(hiveClient.getAllDatabases()).thenReturn(Arrays.asList(new String[]{TEST_DB_NAME})); String description = "This is a default database"; Database db = new Database(TEST_DB_NAME, description, "/user/hive/default", null); when(hiveClient.getDatabase(TEST_DB_NAME)).thenReturn(db); when(hiveClient.getAllTables(TEST_DB_NAME)).thenReturn(Arrays.asList(new String[]{})); returnExistingDatabase(TEST_DB_NAME, atlasClientV2, METADATA_NAMESPACE); when(atlasEntityWithExtInfo.getEntity("72e06b34-9151-4023-aa9d-b82103a50e76")) .thenReturn((new AtlasEntity.AtlasEntityWithExtInfo( getEntity(HiveDataTypes.HIVE_DB.getName(), AtlasClient.GUID, "72e06b34-9151-4023-aa9d-b82103a50e76"))).getEntity()); HiveMetaStoreBridge bridge = new HiveMetaStoreBridge(METADATA_NAMESPACE, hiveClient, atlasClientV2); bridge.importHiveMetadata(null, null, true); verify(atlasClientV2).updateEntity(anyObject()); }
@VisibleForTesting public void importHiveMetadata(String databaseToImport, String tableToImport, boolean failOnError) throws Exception { LOG.info("Importing Hive metadata"); importDatabases(failOnError, databaseToImport, tableToImport); }
HiveMetaStoreBridge { @VisibleForTesting public void importHiveMetadata(String databaseToImport, String tableToImport, boolean failOnError) throws Exception { LOG.info("Importing Hive metadata"); importDatabases(failOnError, databaseToImport, tableToImport); } }
HiveMetaStoreBridge { @VisibleForTesting public void importHiveMetadata(String databaseToImport, String tableToImport, boolean failOnError) throws Exception { LOG.info("Importing Hive metadata"); importDatabases(failOnError, databaseToImport, tableToImport); } HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf, AtlasClientV2 atlasClientV2); HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf); HiveMetaStoreBridge(String metadataNamespace, Hive hiveClient, AtlasClientV2 atlasClientV2); HiveMetaStoreBridge(String metadataNamespace, Hive hiveClient, AtlasClientV2 atlasClientV2, boolean convertHdfsPathToLowerCase); }
HiveMetaStoreBridge { @VisibleForTesting public void importHiveMetadata(String databaseToImport, String tableToImport, boolean failOnError) throws Exception { LOG.info("Importing Hive metadata"); importDatabases(failOnError, databaseToImport, tableToImport); } HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf, AtlasClientV2 atlasClientV2); HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf); HiveMetaStoreBridge(String metadataNamespace, Hive hiveClient, AtlasClientV2 atlasClientV2); HiveMetaStoreBridge(String metadataNamespace, Hive hiveClient, AtlasClientV2 atlasClientV2, boolean convertHdfsPathToLowerCase); static void main(String[] args); String getMetadataNamespace(Configuration config); String getMetadataNamespace(); Hive getHiveClient(); boolean isConvertHdfsPathToLowerCase(); @VisibleForTesting void importHiveMetadata(String databaseToImport, String tableToImport, boolean failOnError); @VisibleForTesting int importTable(AtlasEntity dbEntity, String databaseName, String tableName, final boolean failOnError); static String getDatabaseName(Database hiveDB); static String getDBQualifiedName(String metadataNamespace, String dbName); static String getTableQualifiedName(String metadataNamespace, String dbName, String tableName, boolean isTemporaryTable); static String getTableProcessQualifiedName(String metadataNamespace, Table table); static String getTableQualifiedName(String metadataNamespace, String dbName, String tableName); static String getStorageDescQFName(String tableQualifiedName); static String getColumnQualifiedName(final String tableQualifiedName, final String colName); static long getTableCreatedTime(Table table); }
HiveMetaStoreBridge { @VisibleForTesting public void importHiveMetadata(String databaseToImport, String tableToImport, boolean failOnError) throws Exception { LOG.info("Importing Hive metadata"); importDatabases(failOnError, databaseToImport, tableToImport); } HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf, AtlasClientV2 atlasClientV2); HiveMetaStoreBridge(Configuration atlasProperties, HiveConf hiveConf); HiveMetaStoreBridge(String metadataNamespace, Hive hiveClient, AtlasClientV2 atlasClientV2); HiveMetaStoreBridge(String metadataNamespace, Hive hiveClient, AtlasClientV2 atlasClientV2, boolean convertHdfsPathToLowerCase); static void main(String[] args); String getMetadataNamespace(Configuration config); String getMetadataNamespace(); Hive getHiveClient(); boolean isConvertHdfsPathToLowerCase(); @VisibleForTesting void importHiveMetadata(String databaseToImport, String tableToImport, boolean failOnError); @VisibleForTesting int importTable(AtlasEntity dbEntity, String databaseName, String tableName, final boolean failOnError); static String getDatabaseName(Database hiveDB); static String getDBQualifiedName(String metadataNamespace, String dbName); static String getTableQualifiedName(String metadataNamespace, String dbName, String tableName, boolean isTemporaryTable); static String getTableProcessQualifiedName(String metadataNamespace, Table table); static String getTableQualifiedName(String metadataNamespace, String dbName, String tableName); static String getStorageDescQFName(String tableQualifiedName); static String getColumnQualifiedName(final String tableQualifiedName, final String colName); static long getTableCreatedTime(Table table); static final String CONF_PREFIX; static final String CLUSTER_NAME_KEY; static final String HIVE_METADATA_NAMESPACE; static final String HDFS_PATH_CONVERT_TO_LOWER_CASE; static final String HOOK_AWS_S3_ATLAS_MODEL_VERSION; static final String DEFAULT_CLUSTER_NAME; static final String TEMP_TABLE_PREFIX; static final String ATLAS_ENDPOINT; static final String SEP; static final String HDFS_PATH; static final String DEFAULT_METASTORE_CATALOG; static final String HOOK_AWS_S3_ATLAS_MODEL_VERSION_V2; }
@Test public void testShouldGetZookeeperAcl() { when(configuration.getString(HAConfiguration.HA_ZOOKEEPER_ACL)).thenReturn("sasl:[email protected]"); HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); assertTrue(zookeeperProperties.hasAcl()); }
public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } private HAConfiguration(); }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } private HAConfiguration(); static boolean isHAEnabled(Configuration configuration); static String getBoundAddressForId(Configuration configuration, String serverId); static List<String> getServerInstances(Configuration configuration); static ZookeeperProperties getZookeeperProperties(Configuration configuration); }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } private HAConfiguration(); static boolean isHAEnabled(Configuration configuration); static String getBoundAddressForId(Configuration configuration, String serverId); static List<String> getServerInstances(Configuration configuration); static ZookeeperProperties getZookeeperProperties(Configuration configuration); static final String ATLAS_SERVER_ZK_ROOT_DEFAULT; static final String ATLAS_SERVER_HA_PREFIX; static final String ZOOKEEPER_PREFIX; static final String ATLAS_SERVER_HA_ZK_ROOT_KEY; static final String ATLAS_SERVER_HA_ENABLED_KEY; static final String ATLAS_SERVER_ADDRESS_PREFIX; static final String ATLAS_SERVER_IDS; static final String HA_ZOOKEEPER_CONNECT; static final int DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS; static final String HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS; static final String HA_ZOOKEEPER_NUM_RETRIES; static final int DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES; static final String HA_ZOOKEEPER_SESSION_TIMEOUT_MS; static final int DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS; static final String HA_ZOOKEEPER_ACL; static final String HA_ZOOKEEPER_AUTH; }
@Test public void testShouldGetZookeeperAuth() { when(configuration.getString(HAConfiguration.HA_ZOOKEEPER_AUTH)).thenReturn("sasl:[email protected]"); HAConfiguration.ZookeeperProperties zookeeperProperties = HAConfiguration.getZookeeperProperties(configuration); assertTrue(zookeeperProperties.hasAuth()); }
public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } private HAConfiguration(); }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } private HAConfiguration(); static boolean isHAEnabled(Configuration configuration); static String getBoundAddressForId(Configuration configuration, String serverId); static List<String> getServerInstances(Configuration configuration); static ZookeeperProperties getZookeeperProperties(Configuration configuration); }
HAConfiguration { public static ZookeeperProperties getZookeeperProperties(Configuration configuration) { String[] zkServers; if (configuration.containsKey(HA_ZOOKEEPER_CONNECT)) { zkServers = configuration.getStringArray(HA_ZOOKEEPER_CONNECT); } else { zkServers = configuration.getStringArray("atlas.kafka." + ZOOKEEPER_PREFIX + "connect"); } String zkRoot = configuration.getString(ATLAS_SERVER_HA_ZK_ROOT_KEY, ATLAS_SERVER_ZK_ROOT_DEFAULT); int retriesSleepTimeMillis = configuration.getInt(HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS, DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS); int numRetries = configuration.getInt(HA_ZOOKEEPER_NUM_RETRIES, DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES); int sessionTimeout = configuration.getInt(HA_ZOOKEEPER_SESSION_TIMEOUT_MS, DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS); String acl = configuration.getString(HA_ZOOKEEPER_ACL); String auth = configuration.getString(HA_ZOOKEEPER_AUTH); return new ZookeeperProperties(StringUtils.join(zkServers, ','), zkRoot, retriesSleepTimeMillis, numRetries, sessionTimeout, acl, auth); } private HAConfiguration(); static boolean isHAEnabled(Configuration configuration); static String getBoundAddressForId(Configuration configuration, String serverId); static List<String> getServerInstances(Configuration configuration); static ZookeeperProperties getZookeeperProperties(Configuration configuration); static final String ATLAS_SERVER_ZK_ROOT_DEFAULT; static final String ATLAS_SERVER_HA_PREFIX; static final String ZOOKEEPER_PREFIX; static final String ATLAS_SERVER_HA_ZK_ROOT_KEY; static final String ATLAS_SERVER_HA_ENABLED_KEY; static final String ATLAS_SERVER_ADDRESS_PREFIX; static final String ATLAS_SERVER_IDS; static final String HA_ZOOKEEPER_CONNECT; static final int DEFAULT_ZOOKEEPER_CONNECT_SLEEPTIME_MILLIS; static final String HA_ZOOKEEPER_RETRY_SLEEPTIME_MILLIS; static final String HA_ZOOKEEPER_NUM_RETRIES; static final int DEFAULT_ZOOKEEPER_CONNECT_NUM_RETRIES; static final String HA_ZOOKEEPER_SESSION_TIMEOUT_MS; static final int DEFAULT_ZOOKEEPER_SESSION_TIMEOUT_MILLIS; static final String HA_ZOOKEEPER_ACL; static final String HA_ZOOKEEPER_AUTH; }
@Test(dataProvider = "ozonePathProvider") public void testGetPathEntityOzone3Path(OzoneKeyValidator validator) { String scheme = validator.scheme; String ozonePath = scheme + validator.location; PathExtractorContext extractorContext = new PathExtractorContext(METADATA_NAMESPACE); Path path = new Path(ozonePath); AtlasEntityWithExtInfo entityWithExtInfo = AtlasPathExtractorUtil.getPathEntity(path, extractorContext); AtlasEntity entity = entityWithExtInfo.getEntity(); assertNotNull(entity); verifyOzoneKeyEntity(entity, validator); assertEquals(entityWithExtInfo.getReferredEntities().size(), 2); verifyOzoneEntities(entityWithExtInfo.getReferredEntities(), validator); assertEquals(extractorContext.getKnownEntities().size(), validator.knownEntitiesCount); verifyOzoneEntities(extractorContext.getKnownEntities(), validator); }
public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); static final char QNAME_SEP_METADATA_NAMESPACE; static final char QNAME_SEP_ENTITY_NAME; static final String SCHEME_SEPARATOR; static final String ATTRIBUTE_QUALIFIED_NAME; static final String ATTRIBUTE_NAME; static final String ATTRIBUTE_BUCKET; static final String HDFS_TYPE_PATH; static final String ATTRIBUTE_PATH; static final String ATTRIBUTE_CLUSTER_NAME; static final String ATTRIBUTE_NAMESERVICE_ID; static final String AWS_S3_ATLAS_MODEL_VERSION_V2; static final String AWS_S3_BUCKET; static final String AWS_S3_PSEUDO_DIR; static final String AWS_S3_V2_BUCKET; static final String AWS_S3_V2_PSEUDO_DIR; static final String S3_SCHEME; static final String S3A_SCHEME; static final String ATTRIBUTE_CONTAINER; static final String ATTRIBUTE_OBJECT_PREFIX; static final String RELATIONSHIP_AWS_S3_BUCKET_S3_PSEUDO_DIRS; static final String RELATIONSHIP_AWS_S3_V2_CONTAINER_CONTAINED; static final String ADLS_GEN2_ACCOUNT; static final String ADLS_GEN2_CONTAINER; static final String ADLS_GEN2_DIRECTORY; static final String ADLS_GEN2_ACCOUNT_HOST_SUFFIX; static final String ABFS_SCHEME; static final String ABFSS_SCHEME; static final String ATTRIBUTE_ACCOUNT; static final String ATTRIBUTE_PARENT; static final String RELATIONSHIP_ADLS_GEN2_ACCOUNT_CONTAINERS; static final String RELATIONSHIP_ADLS_GEN2_PARENT_CHILDREN; static final String OZONE_VOLUME; static final String OZONE_BUCKET; static final String OZONE_KEY; static final String OZONE_SCHEME; static final String OZONE_3_SCHEME; static final String ATTRIBUTE_VOLUME; static final String RELATIONSHIP_OZONE_VOLUME_BUCKET; static final String RELATIONSHIP_OZONE_PARENT_CHILDREN; }
@Test public void testGetPathEntityHdfsPath() { PathExtractorContext extractorContext = new PathExtractorContext(METADATA_NAMESPACE); Path path = new Path(HDFS_PATH); AtlasEntityWithExtInfo entityWithExtInfo = AtlasPathExtractorUtil.getPathEntity(path, extractorContext); AtlasEntity entity = entityWithExtInfo.getEntity(); assertNotNull(entity); assertEquals(entity.getTypeName(), HDFS_PATH_TYPE); verifyHDFSEntity(entity, false); assertNull(entityWithExtInfo.getReferredEntities()); assertEquals(extractorContext.getKnownEntities().size(), 1); extractorContext.getKnownEntities().values().forEach(x -> verifyHDFSEntity(x, false)); }
public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); static final char QNAME_SEP_METADATA_NAMESPACE; static final char QNAME_SEP_ENTITY_NAME; static final String SCHEME_SEPARATOR; static final String ATTRIBUTE_QUALIFIED_NAME; static final String ATTRIBUTE_NAME; static final String ATTRIBUTE_BUCKET; static final String HDFS_TYPE_PATH; static final String ATTRIBUTE_PATH; static final String ATTRIBUTE_CLUSTER_NAME; static final String ATTRIBUTE_NAMESERVICE_ID; static final String AWS_S3_ATLAS_MODEL_VERSION_V2; static final String AWS_S3_BUCKET; static final String AWS_S3_PSEUDO_DIR; static final String AWS_S3_V2_BUCKET; static final String AWS_S3_V2_PSEUDO_DIR; static final String S3_SCHEME; static final String S3A_SCHEME; static final String ATTRIBUTE_CONTAINER; static final String ATTRIBUTE_OBJECT_PREFIX; static final String RELATIONSHIP_AWS_S3_BUCKET_S3_PSEUDO_DIRS; static final String RELATIONSHIP_AWS_S3_V2_CONTAINER_CONTAINED; static final String ADLS_GEN2_ACCOUNT; static final String ADLS_GEN2_CONTAINER; static final String ADLS_GEN2_DIRECTORY; static final String ADLS_GEN2_ACCOUNT_HOST_SUFFIX; static final String ABFS_SCHEME; static final String ABFSS_SCHEME; static final String ATTRIBUTE_ACCOUNT; static final String ATTRIBUTE_PARENT; static final String RELATIONSHIP_ADLS_GEN2_ACCOUNT_CONTAINERS; static final String RELATIONSHIP_ADLS_GEN2_PARENT_CHILDREN; static final String OZONE_VOLUME; static final String OZONE_BUCKET; static final String OZONE_KEY; static final String OZONE_SCHEME; static final String OZONE_3_SCHEME; static final String ATTRIBUTE_VOLUME; static final String RELATIONSHIP_OZONE_VOLUME_BUCKET; static final String RELATIONSHIP_OZONE_PARENT_CHILDREN; }
@Test public void testGetPathEntityHdfsPathLowerCase() { PathExtractorContext extractorContext = new PathExtractorContext(METADATA_NAMESPACE, true, null); Path path = new Path(HDFS_PATH); AtlasEntityWithExtInfo entityWithExtInfo = AtlasPathExtractorUtil.getPathEntity(path, extractorContext); AtlasEntity entity = entityWithExtInfo.getEntity(); assertNotNull(entity); assertEquals(entity.getTypeName(), HDFS_PATH_TYPE); verifyHDFSEntity(entity, true); assertNull(entityWithExtInfo.getReferredEntities()); assertEquals(extractorContext.getKnownEntities().size(), 1); extractorContext.getKnownEntities().values().forEach(x -> verifyHDFSEntity(x, true)); }
public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); static final char QNAME_SEP_METADATA_NAMESPACE; static final char QNAME_SEP_ENTITY_NAME; static final String SCHEME_SEPARATOR; static final String ATTRIBUTE_QUALIFIED_NAME; static final String ATTRIBUTE_NAME; static final String ATTRIBUTE_BUCKET; static final String HDFS_TYPE_PATH; static final String ATTRIBUTE_PATH; static final String ATTRIBUTE_CLUSTER_NAME; static final String ATTRIBUTE_NAMESERVICE_ID; static final String AWS_S3_ATLAS_MODEL_VERSION_V2; static final String AWS_S3_BUCKET; static final String AWS_S3_PSEUDO_DIR; static final String AWS_S3_V2_BUCKET; static final String AWS_S3_V2_PSEUDO_DIR; static final String S3_SCHEME; static final String S3A_SCHEME; static final String ATTRIBUTE_CONTAINER; static final String ATTRIBUTE_OBJECT_PREFIX; static final String RELATIONSHIP_AWS_S3_BUCKET_S3_PSEUDO_DIRS; static final String RELATIONSHIP_AWS_S3_V2_CONTAINER_CONTAINED; static final String ADLS_GEN2_ACCOUNT; static final String ADLS_GEN2_CONTAINER; static final String ADLS_GEN2_DIRECTORY; static final String ADLS_GEN2_ACCOUNT_HOST_SUFFIX; static final String ABFS_SCHEME; static final String ABFSS_SCHEME; static final String ATTRIBUTE_ACCOUNT; static final String ATTRIBUTE_PARENT; static final String RELATIONSHIP_ADLS_GEN2_ACCOUNT_CONTAINERS; static final String RELATIONSHIP_ADLS_GEN2_PARENT_CHILDREN; static final String OZONE_VOLUME; static final String OZONE_BUCKET; static final String OZONE_KEY; static final String OZONE_SCHEME; static final String OZONE_3_SCHEME; static final String ATTRIBUTE_VOLUME; static final String RELATIONSHIP_OZONE_VOLUME_BUCKET; static final String RELATIONSHIP_OZONE_PARENT_CHILDREN; }
@Test public void testGetPathEntityABFSPath() { PathExtractorContext extractorContext = new PathExtractorContext(METADATA_NAMESPACE); Path path = new Path(ABFS_PATH); AtlasEntityWithExtInfo entityWithExtInfo = AtlasPathExtractorUtil.getPathEntity(path, extractorContext); AtlasEntity entity = entityWithExtInfo.getEntity(); assertNotNull(entity); assertEquals(entity.getTypeName(), ADLS_GEN2_DIRECTORY); assertEquals(entityWithExtInfo.getReferredEntities().size(), 2); verifyABFSAdlsGen2Dir(ABFS_SCHEME, ABFS_PATH, entity); verifyABFSKnownEntities(ABFS_SCHEME, ABFS_PATH, extractorContext.getKnownEntities()); }
public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); static final char QNAME_SEP_METADATA_NAMESPACE; static final char QNAME_SEP_ENTITY_NAME; static final String SCHEME_SEPARATOR; static final String ATTRIBUTE_QUALIFIED_NAME; static final String ATTRIBUTE_NAME; static final String ATTRIBUTE_BUCKET; static final String HDFS_TYPE_PATH; static final String ATTRIBUTE_PATH; static final String ATTRIBUTE_CLUSTER_NAME; static final String ATTRIBUTE_NAMESERVICE_ID; static final String AWS_S3_ATLAS_MODEL_VERSION_V2; static final String AWS_S3_BUCKET; static final String AWS_S3_PSEUDO_DIR; static final String AWS_S3_V2_BUCKET; static final String AWS_S3_V2_PSEUDO_DIR; static final String S3_SCHEME; static final String S3A_SCHEME; static final String ATTRIBUTE_CONTAINER; static final String ATTRIBUTE_OBJECT_PREFIX; static final String RELATIONSHIP_AWS_S3_BUCKET_S3_PSEUDO_DIRS; static final String RELATIONSHIP_AWS_S3_V2_CONTAINER_CONTAINED; static final String ADLS_GEN2_ACCOUNT; static final String ADLS_GEN2_CONTAINER; static final String ADLS_GEN2_DIRECTORY; static final String ADLS_GEN2_ACCOUNT_HOST_SUFFIX; static final String ABFS_SCHEME; static final String ABFSS_SCHEME; static final String ATTRIBUTE_ACCOUNT; static final String ATTRIBUTE_PARENT; static final String RELATIONSHIP_ADLS_GEN2_ACCOUNT_CONTAINERS; static final String RELATIONSHIP_ADLS_GEN2_PARENT_CHILDREN; static final String OZONE_VOLUME; static final String OZONE_BUCKET; static final String OZONE_KEY; static final String OZONE_SCHEME; static final String OZONE_3_SCHEME; static final String ATTRIBUTE_VOLUME; static final String RELATIONSHIP_OZONE_VOLUME_BUCKET; static final String RELATIONSHIP_OZONE_PARENT_CHILDREN; }
@Test public void testGetPathEntityABFSSPath() { PathExtractorContext extractorContext = new PathExtractorContext(METADATA_NAMESPACE); Path path = new Path(ABFSS_PATH); AtlasEntityWithExtInfo entityWithExtInfo = AtlasPathExtractorUtil.getPathEntity(path, extractorContext); AtlasEntity entity = entityWithExtInfo.getEntity(); assertNotNull(entity); assertEquals(entity.getTypeName(), ADLS_GEN2_DIRECTORY); assertEquals(entityWithExtInfo.getReferredEntities().size(), 2); verifyABFSAdlsGen2Dir(ABFSS_SCHEME, ABFSS_PATH, entity); verifyABFSKnownEntities(ABFSS_SCHEME, ABFSS_PATH, extractorContext.getKnownEntities()); }
public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); static final char QNAME_SEP_METADATA_NAMESPACE; static final char QNAME_SEP_ENTITY_NAME; static final String SCHEME_SEPARATOR; static final String ATTRIBUTE_QUALIFIED_NAME; static final String ATTRIBUTE_NAME; static final String ATTRIBUTE_BUCKET; static final String HDFS_TYPE_PATH; static final String ATTRIBUTE_PATH; static final String ATTRIBUTE_CLUSTER_NAME; static final String ATTRIBUTE_NAMESERVICE_ID; static final String AWS_S3_ATLAS_MODEL_VERSION_V2; static final String AWS_S3_BUCKET; static final String AWS_S3_PSEUDO_DIR; static final String AWS_S3_V2_BUCKET; static final String AWS_S3_V2_PSEUDO_DIR; static final String S3_SCHEME; static final String S3A_SCHEME; static final String ATTRIBUTE_CONTAINER; static final String ATTRIBUTE_OBJECT_PREFIX; static final String RELATIONSHIP_AWS_S3_BUCKET_S3_PSEUDO_DIRS; static final String RELATIONSHIP_AWS_S3_V2_CONTAINER_CONTAINED; static final String ADLS_GEN2_ACCOUNT; static final String ADLS_GEN2_CONTAINER; static final String ADLS_GEN2_DIRECTORY; static final String ADLS_GEN2_ACCOUNT_HOST_SUFFIX; static final String ABFS_SCHEME; static final String ABFSS_SCHEME; static final String ATTRIBUTE_ACCOUNT; static final String ATTRIBUTE_PARENT; static final String RELATIONSHIP_ADLS_GEN2_ACCOUNT_CONTAINERS; static final String RELATIONSHIP_ADLS_GEN2_PARENT_CHILDREN; static final String OZONE_VOLUME; static final String OZONE_BUCKET; static final String OZONE_KEY; static final String OZONE_SCHEME; static final String OZONE_3_SCHEME; static final String ATTRIBUTE_VOLUME; static final String RELATIONSHIP_OZONE_VOLUME_BUCKET; static final String RELATIONSHIP_OZONE_PARENT_CHILDREN; }
@Test public void testGetPathEntityS3V2Path() { PathExtractorContext extractorContext = new PathExtractorContext(METADATA_NAMESPACE, AWS_S3_ATLAS_MODEL_VERSION_V2); Path path = new Path(S3_PATH); AtlasEntityWithExtInfo entityWithExtInfo = AtlasPathExtractorUtil.getPathEntity(path, extractorContext); AtlasEntity entity = entityWithExtInfo.getEntity(); assertNotNull(entity); assertEquals(entity.getTypeName(), AWS_S3_V2_PSEUDO_DIR); assertEquals(entityWithExtInfo.getReferredEntities().size(), 1); verifyS3V2PseudoDir(S3A_SCHEME, S3_PATH, entity); verifyS3V2KnownEntities(S3_SCHEME, S3_PATH, extractorContext.getKnownEntities()); }
public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); }
AtlasPathExtractorUtil { public static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context) { AtlasEntityWithExtInfo entityWithExtInfo = new AtlasEntityWithExtInfo(); AtlasEntity ret; String strPath = path.toString(); if (context.isConvertPathToLowerCase()) { strPath = strPath.toLowerCase(); } if (isS3Path(strPath)) { ret = isAwsS3AtlasModelVersionV2(context) ? addS3PathEntityV2(path, entityWithExtInfo, context) : addS3PathEntityV1(path, entityWithExtInfo, context); } else if (isAbfsPath(strPath)) { ret = addAbfsPathEntity(path, entityWithExtInfo, context); } else if (isOzonePath(strPath)) { ret = addOzonePathEntity(path, entityWithExtInfo, context); } else { ret = addHDFSPathEntity(path, context); } entityWithExtInfo.setEntity(ret); return entityWithExtInfo; } static AtlasEntityWithExtInfo getPathEntity(Path path, PathExtractorContext context); static final char QNAME_SEP_METADATA_NAMESPACE; static final char QNAME_SEP_ENTITY_NAME; static final String SCHEME_SEPARATOR; static final String ATTRIBUTE_QUALIFIED_NAME; static final String ATTRIBUTE_NAME; static final String ATTRIBUTE_BUCKET; static final String HDFS_TYPE_PATH; static final String ATTRIBUTE_PATH; static final String ATTRIBUTE_CLUSTER_NAME; static final String ATTRIBUTE_NAMESERVICE_ID; static final String AWS_S3_ATLAS_MODEL_VERSION_V2; static final String AWS_S3_BUCKET; static final String AWS_S3_PSEUDO_DIR; static final String AWS_S3_V2_BUCKET; static final String AWS_S3_V2_PSEUDO_DIR; static final String S3_SCHEME; static final String S3A_SCHEME; static final String ATTRIBUTE_CONTAINER; static final String ATTRIBUTE_OBJECT_PREFIX; static final String RELATIONSHIP_AWS_S3_BUCKET_S3_PSEUDO_DIRS; static final String RELATIONSHIP_AWS_S3_V2_CONTAINER_CONTAINED; static final String ADLS_GEN2_ACCOUNT; static final String ADLS_GEN2_CONTAINER; static final String ADLS_GEN2_DIRECTORY; static final String ADLS_GEN2_ACCOUNT_HOST_SUFFIX; static final String ABFS_SCHEME; static final String ABFSS_SCHEME; static final String ATTRIBUTE_ACCOUNT; static final String ATTRIBUTE_PARENT; static final String RELATIONSHIP_ADLS_GEN2_ACCOUNT_CONTAINERS; static final String RELATIONSHIP_ADLS_GEN2_PARENT_CHILDREN; static final String OZONE_VOLUME; static final String OZONE_BUCKET; static final String OZONE_KEY; static final String OZONE_SCHEME; static final String OZONE_3_SCHEME; static final String ATTRIBUTE_VOLUME; static final String RELATIONSHIP_OZONE_VOLUME_BUCKET; static final String RELATIONSHIP_OZONE_PARENT_CHILDREN; }