/** * Create a new connection edge from the source node with the given connection type and target id */ public static Edge createConnectionEdge( final Id sourceEntityId, final String connectionType, final Id targetEntityId ) { final String edgeType = getEdgeTypeFromConnectionType( connectionType ); // create graph edge connection from head entity to member entity return new SimpleEdge( sourceEntityId, edgeType, targetEntityId, createGraphOperationTimestamp() ); }
/** * TODO move sourceId to ApplicationScope */ public static Edge createCollectionEdge( final Id sourceId, final String collectionName, final Id entityId ) { final String edgeType = CpNamingUtils.getEdgeTypeFromCollectionName( collectionName ); // create graph edge connection from head entity to member entity return new SimpleEdge( sourceId, edgeType, entityId, createGraphOperationTimestamp() ); }
@Override public Observable<IndexOperationMessage> deIndexOldVersions(final ApplicationScope applicationScope, final Id entityId, final List<UUID> versions) { final EntityIndex ei = entityIndexFactory. createEntityIndex(indexLocationStrategyFactory.getIndexLocationStrategy(applicationScope) ); // use LONG.MAX_VALUE in search edge because this value is not used elsewhere in lower code for de-indexing // previously .timsetamp() was used on entityId, but some entities do not have type-1 UUIDS ( legacy data) final SearchEdge searchEdgeFromSource = createSearchEdgeFromSource( new SimpleEdge( applicationScope.getApplication(), CpNamingUtils.getEdgeTypeFromCollectionName( InflectionUtils.pluralize( entityId.getType() ) ), entityId, Long.MAX_VALUE ) ); final EntityIndexBatch batch = ei.createBatch(); versions.forEach( version -> { batch.deindex(searchEdgeFromSource, entityId, version); }); return Observable.just(batch.build()); }