public AtlasEntityStream(AtlasEntitiesWithExtInfo entitiesWithExtInfo) { this.entitiesWithExtInfo = entitiesWithExtInfo; this.iterator = this.entitiesWithExtInfo.getEntities().iterator(); this.entityStream = null; }
public AtlasEntityStream(AtlasEntitiesWithExtInfo entitiesWithExtInfo) { this.entitiesWithExtInfo = entitiesWithExtInfo; this.iterator = this.entitiesWithExtInfo.getEntities().iterator(); this.entityStream = null; }
@Override public void reset() { this.iterator = entitiesWithExtInfo.getEntities().iterator(); }
public EntityAuditEventV2 toV2AuditEvent(EntityAuditEvent v1Event) throws AtlasBaseException { EntityAuditEventV2 ret = new EntityAuditEventV2(); ret.setEntityId(v1Event.getEntityId()); ret.setTimestamp(v1Event.getTimestamp()); ret.setUser(v1Event.getUser()); ret.setDetails(v1Event.getDetails()); ret.setEventKey(v1Event.getEventKey()); ret.setAction(getV2AuditAction(v1Event.getAction())); AtlasEntitiesWithExtInfo entitiesWithExtInfo = toAtlasEntity(v1Event.getEntityDefinition()); if (entitiesWithExtInfo != null && CollectionUtils.isNotEmpty(entitiesWithExtInfo.getEntities())) { // there will only one source entity AtlasEntity entity = entitiesWithExtInfo.getEntities().get(0); ret.setEntity(entity); } return ret; }
@BeforeClass public void setupSampleData() throws AtlasBaseException { entityStore = new AtlasEntityStoreV2(deleteHandler, typeRegistry, mockChangeNotifier, graphMapper);; AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes(); AtlasTypesDef typesToCreate = AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry); if (!typesToCreate.isEmpty()) { typeDefStore.createTypesDef(typesToCreate); } AtlasEntity.AtlasEntitiesWithExtInfo hrDept = TestUtilsV2.createDeptEg2(); AtlasEntityStream entityStream = new AtlasEntityStream(hrDept); entityStore.createOrUpdate(entityStream, false); LOG.debug("==> setupSampleData: ", AtlasEntity.dumpObjects(hrDept.getEntities(), null).toString()); }
public List<AtlasEntity> getEntities() { return entitiesWithExtInfo != null ? entitiesWithExtInfo.getEntities() : null; }
@Override public void reset() { this.iterator = entitiesWithExtInfo.getEntities().iterator(); }
public AtlasEntityStream(AtlasEntityWithExtInfo entityWithExtInfo, EntityStream entityStream) { this.entitiesWithExtInfo = new AtlasEntitiesWithExtInfo(entityWithExtInfo); this.iterator = this.entitiesWithExtInfo.getEntities().iterator(); this.entityStream = entityStream; }
public AtlasEntityStream(AtlasEntity entity, EntityStream entityStream) { this.entitiesWithExtInfo = new AtlasEntitiesWithExtInfo(entity); this.iterator = this.entitiesWithExtInfo.getEntities().iterator(); this.entityStream = entityStream; }
@Override public List<HookNotification> getNotificationMessages() throws Exception { List<HookNotification> ret = null; AtlasEntitiesWithExtInfo entities = getEntities(); if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) { ret = Collections.singletonList(new EntityCreateRequestV2(getUserName(), entities)); } return ret; }
public AtlasEntityStream(AtlasEntityWithExtInfo entityWithExtInfo, EntityStream entityStream) { this.entitiesWithExtInfo = new AtlasEntitiesWithExtInfo(entityWithExtInfo); this.iterator = this.entitiesWithExtInfo.getEntities().iterator(); this.entityStream = entityStream; }
public AtlasEntityStream(AtlasEntity entity, EntityStream entityStream) { this.entitiesWithExtInfo = new AtlasEntitiesWithExtInfo(entity); this.iterator = this.entitiesWithExtInfo.getEntities().iterator(); this.entityStream = entityStream; }
@Override public List<HookNotification> getNotificationMessages() throws Exception { List<HookNotification> ret = null; AtlasEntitiesWithExtInfo entities = getEntities(); if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) { ret = Collections.singletonList(new EntityCreateRequestV2(getUserName(), entities)); } return ret; }
@Override public List<HookNotification> getNotificationMessages() throws Exception { List<HookNotification> ret = null; AtlasEntitiesWithExtInfo entities = getEntities(); if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) { ret = Collections.singletonList(new EntityCreateRequestV2(getUserName(), entities)); } return ret; }
private void assertReplicationAttribute(String attrNameReplication) throws AtlasBaseException { pauseForIndexCreation(); AtlasEntity.AtlasEntitiesWithExtInfo entities = entityStore.getByIds(ImmutableList.of(DB_GUID, TABLE_GUID)); for (AtlasEntity e : entities.getEntities()) { Object ex = e.getAttribute(attrNameReplication); assertNotNull(ex); List<String> attrValue = (List) ex; assertEquals(attrValue.size(), 1); } }
@Override public List<HookNotification> getNotificationMessages() throws Exception { List<HookNotification> ret = null; AtlasEntitiesWithExtInfo entities = getEntities(); if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) { ret = Collections.singletonList(new EntityUpdateRequestV2(getUserName(), entities)); } return ret; } }
protected void verifyCreatedEntities(AtlasEntityStoreV2 entityStore, String[] entityGuids, int expectedNumberOfEntitiesCreated) { try { AtlasEntity.AtlasEntitiesWithExtInfo entities = entityStore.getByIds(Arrays.asList((String[]) entityGuids)); assertEquals(entities.getEntities().size(), expectedNumberOfEntitiesCreated); } catch (AtlasBaseException e) { throw new SkipException(String.format("getByIds: could not load '%s'", entityGuids.toString())); } }
private AtlasEntity toAtlasEntity(Referenceable referenceable) throws AtlasBaseException { AtlasEntity ret = null; AtlasEntitiesWithExtInfo entitiesWithExtInfo = instanceConverter.toAtlasEntity(referenceable); if (entitiesWithExtInfo != null && CollectionUtils.isNotEmpty(entitiesWithExtInfo.getEntities())) { ret = entitiesWithExtInfo.getEntities().get(0); } return ret; }
protected void addProcessedEntities(AtlasEntitiesWithExtInfo entitiesWithExtInfo) { for (AtlasEntity entity : context.getEntities()) { entitiesWithExtInfo.addReferredEntity(entity); } entitiesWithExtInfo.compact(); context.addToKnownEntities(entitiesWithExtInfo.getEntities()); if (entitiesWithExtInfo.getReferredEntities() != null) { context.addToKnownEntities(entitiesWithExtInfo.getReferredEntities().values()); } }
@Override public List<HookNotification> getNotificationMessages() throws Exception { List<HookNotification> ret = null; AtlasEntitiesWithExtInfo entities = getEntities(); if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) { ret = Collections.singletonList(new EntityUpdateRequestV2(getUserName(), entities)); } return ret; } }