case PURGE_ALL:
case INDEX:
operation = IndexingOverride.APPLY_DEFAULT;
break;
default:
throw new AssertionFailure( "Unknown work type: " + work.getType() );
}
Work<T> result = work;
Class<T> entityClass = work.getEntityClass();
switch ( operation ) {
case APPLY_DEFAULT:
break;
case SKIP:
result = null;
log.forceSkipIndexOperationViaInterception( entityClass, work.getType() );
break;
case UPDATE:
result = new Work<T>( work.getEntity(), work.getId(), WorkType.UPDATE );
log.forceUpdateOnIndexOperationViaInterception( entityClass, work.getType() );
break;
case REMOVE:
//This works because other Work constructors are never used from WorkType ADD, UPDATE, REMOVE, COLLECTION
//TODO should we force isIdentifierRollback to false if the operation is not a delete?
result = new Work<T>( work.getEntity(), work.getId(), WorkType.DELETE, work.isIdentifierWasRolledBack() );
log.forceRemoveOnIndexOperationViaInterception( entityClass, work.getType() );
break;
default:
throw new AssertionFailure( "Unknown action type: " + operation );
}
return result;
}