@Override protected GraphNode generateData( final EntityIdScope entityIdScope ) { return new GraphNode(entityIdScope.getApplicationScope(), entityIdScope.getId()); } }
private IndexOperationMessage handleEntityDelete(final LegacyQueueMessage message) { Preconditions.checkNotNull(message, "Queue Message cannot be null for handleEntityDelete"); final AsyncEvent event = (AsyncEvent) message.getBody(); Preconditions.checkNotNull( message, "QueueMessage Body cannot be null for handleEntityDelete" ); Preconditions.checkArgument( event instanceof EntityDeleteEvent, String.format( "Event Type for handleEntityDelete must be ENTITY_DELETE, got %s", event.getClass() ) ); final EntityDeleteEvent entityDeleteEvent = ( EntityDeleteEvent ) event; final ApplicationScope applicationScope = entityDeleteEvent.getEntityIdScope().getApplicationScope(); final Id entityId = entityDeleteEvent.getEntityIdScope().getId(); final boolean isCollectionDelete = entityDeleteEvent.isCollectionDelete(); final long updatedBefore = entityDeleteEvent.getUpdatedBefore(); if (logger.isDebugEnabled()) { logger.debug("Deleting entity id from index in app scope {} with entityId {}, isCollectionDelete {}, updatedBefore {}", applicationScope, entityId, isCollectionDelete, updatedBefore); } return eventBuilder.buildEntityDelete( applicationScope, entityId, isCollectionDelete, updatedBefore ); }
private IndexOperationMessage handleEntityIndexUpdate(final LegacyQueueMessage message) { Preconditions.checkNotNull( message, "Queue Message cannot be null for handleEntityIndexUpdate" ); final AsyncEvent event = ( AsyncEvent ) message.getBody(); Preconditions.checkNotNull(message, "QueueMessage Body cannot be null for handleEntityIndexUpdate"); Preconditions.checkArgument(event instanceof EntityIndexEvent, String.format("Event Type for handleEntityIndexUpdate must be ENTITY_INDEX, got %s", event.getClass())); final EntityIndexEvent entityIndexEvent = (EntityIndexEvent) event; //process the entity immediately //only process the same version, otherwise ignore final EntityIdScope entityIdScope = entityIndexEvent.getEntityIdScope(); final ApplicationScope applicationScope = entityIdScope.getApplicationScope(); final Id entityId = entityIdScope.getId(); final long updatedAfter = entityIndexEvent.getUpdatedAfter(); final EntityIndexOperation entityIndexOperation = new EntityIndexOperation( applicationScope, entityId, updatedAfter); // default this observable's return to empty index operation message if nothing is emitted return eventBuilder.buildEntityIndex( entityIndexOperation ) .toBlocking().lastOrDefault(new IndexOperationMessage()); }
public IndexOperationMessage handleDeIndexOldVersionEvent ( final DeIndexOldVersionsEvent deIndexOldVersionsEvent){ final ApplicationScope applicationScope = deIndexOldVersionsEvent.getEntityIdScope().getApplicationScope(); final Id entityId = deIndexOldVersionsEvent.getEntityIdScope().getId(); final UUID markedVersion = deIndexOldVersionsEvent.getMarkedVersion(); // default this observable's return to empty index operation message if nothing is emitted return eventBuilder.deIndexOldVersions( applicationScope, entityId, markedVersion ) .toBlocking().lastOrDefault(new IndexOperationMessage()); }
final Id entityId = entityIdScope.getId();
.map(entityIdScope -> ((EntityIdScope) entityIdScope).getId()) .filter(id -> { final String type = InflectionUtils.pluralize(((Id) id).getType());
@Override public void call( final EntityIdScope entityIdScope ) { assertNotNull(entityIdScope); assertNotNull(entityIdScope.getApplicationScope()); assertNotNull(entityIdScope.getId()); // we should only emit each node once final Id id = entityIdScope.getId(); if ( id.getType().equals( type1 ) ) { boolean removed = type1Identities.remove(id); assertTrue( "Element(a:"+counter.incrementAndGet()+") should be present on removal",type1Identities.size() ==0 || removed); } else if ( id.getType().equals( type2 ) ) { boolean removed = type2Identities.remove(id ); assertTrue( "Element(b:"+counter.incrementAndGet()+") should be present on removal",type2Identities.size() ==0 || removed ); } } } ).toBlocking().lastOrDefault( null );
migration.from.loadAscendingHistory( currentScope, entityIdScope.getId(), startTime, 100 );