@Override public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof SimpleMarkedEdge ) ) { return false; } if ( !super.equals( o ) ) { return false; } final SimpleMarkedEdge that = ( SimpleMarkedEdge ) o; if ( isDeleted != that.isDeleted ) { return false; } return true; }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + ( isDeleted ? 1 : 0 ); result = 31 * result + ( isSourceNodeDeleted ? 1 : 0 ); result = 31 * result + ( isTargetNodeDeleted ? 1 : 0 ); return result; }
@Override public String toString() { return "SimpleMarkedEdge{" + "deleted=" + isDeleted + ", isSourceNodeDeleted=" + isSourceNodeDeleted + ", isTargetNodeDeleted=" + isTargetNodeDeleted + "} " + super.toString(); } }
/** * 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()); }