/** * Used for recursive processing of containedIn * * @param <T> the type of the entity * @param value the entity to be processed * @param context the validator for the depth constraints * @param tenantId the tenant identifier. It can be null. */ public <T> void recurseContainedIn(T value, ContainedInRecursionContext context, String tenantId) { Class<T> entityClass = instanceInitializer.getClass( value ); //TODO separate the ContainedIn processing in its own registry of types PerClassWork classWork = getClassWork( tenantId, new PojoIndexedTypeIdentifier( entityClass ) ); classWork.recurseContainedIn( value, context ); }
private Object unproxy(Object instance, InstanceInitializer objectInitializer) { if ( instance == null ) { return null; } return objectInitializer.unproxy( instance ); }
/** * Adds a work to be performed as part of the final plan. * * @param work The work instance to add to the work plan */ public void addWork(Work work) { approximateWorkQueueSize++; IndexedTypeIdentifier typeIdentifier = instanceInitializer.getIndexedTypeIdFromWork( work ); PerClassWork classWork = getClassWork( work.getTenantIdentifier(), typeIdentifier ); classWork.addWork( work ); }
case ARRAY: if ( value instanceof Object[] ) { objectInitializer.initializeArray( (Object[]) value ); Collection<?> collection = objectInitializer.initializeCollection( (Collection<?>) value ); for ( Object collectionValue : collection ) { nestingContext.mark( doc ); Map<?, ?> map = objectInitializer.initializeMap( (Map<?, ?>) value ); for ( Object collectionValue : map.values() ) { nestingContext.mark( doc );
final InstanceInitializer instanceInitializer = integrator.getInstanceInitializer(); for ( Object o : queryResultList ) { Class<?> loadedType = instanceInitializer.getClass( o ); Object unproxiedObject = instanceInitializer.unproxy( o ); IndexedTypeIdentifier type = integrator.getIndexBindings().keyFromPojoType( loadedType ); DocumentBuilderIndexedEntity documentBuilder = getDocumentBuilder( type, integrator );
if ( member.isCollection() ) { if ( currentFieldValue instanceof Collection ) { objectInitializer.initializeCollection( (Collection) currentFieldValue ); objectInitializer.initializeMap( (Map) currentFieldValue ); objectInitializer.initializeArray( (Object[]) currentFieldValue );
case ARRAY: if ( value instanceof Object[] ) { objectInitializer.initializeArray( (Object[]) value ); Collection<?> collection = objectInitializer.initializeCollection( (Collection<?>) value ); for ( Object collectionValue : collection ) { nestingContext.mark( doc ); Map<?, ?> map = objectInitializer.initializeMap( (Map<?, ?>) value ); for ( Object collectionValue : map.values() ) { nestingContext.mark( doc );
private Object unproxy(Object instance, InstanceInitializer objectInitializer) { if ( instance == null ) { return null; } return objectInitializer.unproxy( instance ); }
/** * Used for recursive processing of containedIn * * @param <T> the type of the entity * @param value the entity to be processed * @param context the validator for the depth constraints * @param tenantId the tenant identifier. It can be null. */ public <T> void recurseContainedIn(T value, ContainedInRecursionContext context, String tenantId) { Class<T> entityClass = instanceInitializer.getClass( value ); //TODO separate the ContainedIn processing in its own registry of types PerClassWork classWork = getClassWorkIfConfigured( tenantId, new PojoIndexedTypeIdentifier( entityClass ) ); if ( classWork != null ) { classWork.recurseContainedIn( value, context ); } }
/** * Adds a work to be performed as part of the final plan. * * @param work The work instance to add to the work plan */ public void addWork(Work work) { approximateWorkQueueSize++; IndexedTypeIdentifier typeIdentifier = instanceInitializer.getIndexedTypeIdFromWork( work ); PerClassWork classWork = getClassWork( work.getTenantIdentifier(), typeIdentifier ); classWork.addWork( work ); }
if ( member.isCollection() ) { if ( currentFieldValue instanceof Collection ) { objectInitializer.initializeCollection( (Collection) currentFieldValue ); objectInitializer.initializeMap( (Map) currentFieldValue ); objectInitializer.initializeArray( (Object[]) currentFieldValue );
/** * Return the id used for indexing if possible * An IllegalStateException otherwise * <p> * If the id is provided, we can't extract it from the entity */ @Override public Serializable getId(Object entity) { if ( entity == null || idPropertyMetadata.getPropertyAccessorName() == null || idProvided ) { throw new IllegalStateException( "Cannot guess id from entity" ); } Object unproxiedEntity = getInstanceInitializer().unproxy( entity ); return (Serializable) ReflectionHelper.getMemberValue( unproxiedEntity, idPropertyMetadata.getPropertyAccessor() ); }
log.containedInPointsToProvidedId( instanceInitializer.getClass( value ) );
@Override public void performWork(Work work, TransactionContext transactionContext) { final IndexedTypeIdentifier entityType = instanceInitializer.getIndexedTypeIdFromWork( work ); EntityIndexBinding indexBindingForEntity = factory.getIndexBinding( entityType ); if ( indexBindingForEntity == null
/** * Return the id used for indexing if possible * An IllegalStateException otherwise * <p> * If the id is provided, we can't extract it from the entity */ @Override public Serializable getId(Object entity) { if ( entity == null || idPropertyMetadata.getPropertyAccessorName() == null || idProvided ) { throw new IllegalStateException( "Cannot guess id from entity" ); } Object unproxiedEntity = getInstanceInitializer().unproxy( entity ); return (Serializable) ReflectionHelper.getMemberValue( unproxiedEntity, idPropertyMetadata.getPropertyAccessor() ); }
log.containedInPointsToProvidedId( instanceInitializer.getClass( value ) );
@Override public void performWork(Work work, TransactionContext transactionContext) { final IndexedTypeIdentifier entityType = instanceInitializer.getIndexedTypeIdFromWork( work ); EntityIndexBinding indexBindingForEntity = factory.getIndexBinding( entityType ); if ( indexBindingForEntity == null
for ( ContainedInMetadata containedInMetadata : typeMetadata.getContainedInMetadata() ) { XMember member = containedInMetadata.getContainedInMember(); Object unproxiedInstance = instanceInitializer.unproxy( instance );
Class<?> entityType = objectInitializer.getClass( instance ); float documentLevelBoost = getTypeMetadata().getClassBoost( instance );
for ( ContainedInMetadata containedInMetadata : typeMetadata.getContainedInMetadata() ) { XMember member = containedInMetadata.getContainedInMember(); Object unproxiedInstance = instanceInitializer.unproxy( instance );