idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
147,600
public static boolean propertyExists ( Class < ? > clazz , String property , ElementType elementType ) { if ( ElementType . FIELD . equals ( elementType ) ) { return getDeclaredField ( clazz , property ) != null ; } else { String capitalizedPropertyName = capitalize ( property ) ; Method method = getMethod ( clazz , PR...
Whether the specified JavaBeans property exists on the given type or not .
147,601
public static void setField ( Object object , String field , Object value ) throws NoSuchMethodException , InvocationTargetException , IllegalAccessException { Class < ? > clazz = object . getClass ( ) ; Method m = clazz . getMethod ( PROPERTY_ACCESSOR_PREFIX_SET + capitalize ( field ) , value . getClass ( ) ) ; m . in...
Set value for given object field .
147,602
public boolean isEmbeddedProperty ( String targetTypeName , List < String > namesWithoutAlias ) { OgmEntityPersister persister = getPersister ( targetTypeName ) ; Type propertyType = persister . getPropertyType ( namesWithoutAlias . get ( 0 ) ) ; if ( propertyType . isComponentType ( ) ) { return true ; } else if ( pro...
Checks if the path leads to an embedded property or association .
147,603
public boolean isAssociation ( String targetTypeName , List < String > pathWithoutAlias ) { OgmEntityPersister persister = getPersister ( targetTypeName ) ; Type propertyType = persister . getPropertyType ( pathWithoutAlias . get ( 0 ) ) ; return propertyType . isAssociationType ( ) ; }
Check if the path to the property correspond to an association .
147,604
public List < String > findAssociationPath ( String targetTypeName , List < String > pathWithoutAlias ) { List < String > subPath = new ArrayList < String > ( pathWithoutAlias . size ( ) ) ; for ( String name : pathWithoutAlias ) { subPath . add ( name ) ; if ( isAssociation ( targetTypeName , subPath ) ) { return subP...
Find the path to the first association in the property path .
147,605
private static < R > RowKey buildRowKey ( AssociationKey associationKey , R row , AssociationRowAccessor < R > accessor ) { String [ ] columnNames = associationKey . getMetadata ( ) . getRowKeyColumnNames ( ) ; Object [ ] columnValues = new Object [ columnNames . length ] ; for ( int i = 0 ; i < columnNames . length ; ...
Creates the row key of the given association row ; columns present in the given association key will be obtained from there all other columns from the given native association row .
147,606
protected EntityKey getEntityKey ( Tuple tuple , AssociatedEntityKeyMetadata associatedEntityKeyMetadata ) { Object [ ] columnValues = new Object [ associatedEntityKeyMetadata . getAssociationKeyColumns ( ) . length ] ; int i = 0 ; for ( String associationKeyColumn : associatedEntityKeyMetadata . getAssociationKeyColum...
Returns the key of the entity targeted by the represented association retrieved from the given tuple .
147,607
public static boolean isPartOfRegularEmbedded ( String [ ] keyColumnNames , String column ) { return isPartOfEmbedded ( column ) && ! ArrayHelper . contains ( keyColumnNames , column ) ; }
A regular embedded is an element that it is embedded but it is not a key or a collection .
147,608
public String getOuterMostNullEmbeddableIfAny ( String column ) { String [ ] path = column . split ( "\\." ) ; if ( ! isEmbeddableColumn ( path ) ) { return null ; } if ( columnToOuterMostNullEmbeddableCache . containsKey ( column ) ) { return columnToOuterMostNullEmbeddableCache . get ( column ) ; } return determineAn...
Should only called on a column that is being set to null .
147,609
private String determineAndCacheOuterMostNullEmbeddable ( String column , String [ ] path ) { String embeddable = path [ 0 ] ; for ( int index = 0 ; index < path . length - 1 ; index ++ ) { Set < String > columnsOfEmbeddable = getColumnsOfEmbeddableAndComputeEmbeddableNullness ( embeddable ) ; if ( nullEmbeddables . co...
Walks from the most outer embeddable to the most inner one look for all columns contained in these embeddables and exclude the embeddables that have a non null column because of caching the algorithm is only run once per column parameter
147,610
public void addNavigationalInformationForInverseSide ( ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Adding inverse navigational information for entity: " + MessageHelper . infoString ( persister , id , persister . getFactory ( ) ) ) ; } for ( int propertyIndex = 0 ; propertyIndex < persister . getEntityMetamode...
Updates all inverse associations managed by a given entity .
147,611
public static String escapeDoubleQuotesForJson ( String text ) { if ( text == null ) { return null ; } StringBuilder builder = new StringBuilder ( text . length ( ) ) ; for ( int i = 0 ; i < text . length ( ) ; i ++ ) { char c = text . charAt ( i ) ; switch ( c ) { case '"' : case '\\' : builder . append ( "\\" ) ; def...
If a text contains double quotes escape them .
147,612
private static Row row ( List < StatementResult > results ) { Row row = results . get ( 0 ) . getData ( ) . get ( 0 ) ; return row ; }
When we execute a single statement we only need the corresponding Row with the result .
147,613
static < T extends GridDialect > T getDialectFacetOrNull ( GridDialect gridDialect , Class < T > facetType ) { if ( hasFacet ( gridDialect , facetType ) ) { @ SuppressWarnings ( "unchecked" ) T asFacet = ( T ) gridDialect ; return asFacet ; } return null ; }
Returns the given dialect narrowed down to the given dialect facet in case it is implemented by the dialect .
147,614
public static boolean hasFacet ( GridDialect gridDialect , Class < ? extends GridDialect > facetType ) { if ( gridDialect instanceof ForwardingGridDialect ) { return hasFacet ( ( ( ForwardingGridDialect < ? > ) gridDialect ) . getGridDialect ( ) , facetType ) ; } else { return facetType . isAssignableFrom ( gridDialect...
Whether the given grid dialect implements the specified facet or not .
147,615
public void initializePersistenceStrategy ( CacheMappingType cacheMappingType , Set < EntityKeyMetadata > entityTypes , Set < AssociationKeyMetadata > associationTypes , Set < IdSourceKeyMetadata > idSourceTypes , Iterable < Namespace > namespaces ) { persistenceStrategy = PersistenceStrategy . getInstance ( cacheMappi...
Initializes the persistence strategy to be used when accessing the datastore . In particular all the required caches will be configured and initialized .
147,616
private static Document getProjection ( List < String > fieldNames ) { Document projection = new Document ( ) ; for ( String column : fieldNames ) { projection . put ( column , 1 ) ; } return projection ; }
Returns a projection object for specifying the fields to retrieve during a specific find operation .
147,617
private static Document objectForInsert ( Tuple tuple , Document dbObject ) { MongoDBTupleSnapshot snapshot = ( MongoDBTupleSnapshot ) tuple . getSnapshot ( ) ; for ( TupleOperation operation : tuple . getOperations ( ) ) { String column = operation . getColumn ( ) ; if ( notInIdField ( snapshot , column ) ) { switch (...
Creates a Document that can be passed to the MongoDB batch insert function
147,618
private static ClosableIterator < Tuple > doDistinct ( final MongoDBQueryDescriptor queryDescriptor , final MongoCollection < Document > collection ) { DistinctIterable < ? > distinctFieldValues = collection . distinct ( queryDescriptor . getDistinctFieldName ( ) , queryDescriptor . getCriteria ( ) , String . class ) ;...
do Distinct operation
147,619
@ SuppressWarnings ( "deprecation" ) private static WriteConcern mergeWriteConcern ( WriteConcern original , WriteConcern writeConcern ) { if ( original == null ) { return writeConcern ; } else if ( writeConcern == null ) { return original ; } else if ( original . equals ( writeConcern ) ) { return original ; } Object ...
As we merge several operations into one operation we need to be sure the write concern applied to the aggregated operation respects all the requirements expressed for each separate operation .
147,620
public ClosableIterator < Tuple > callStoredProcedure ( String storedProcedureName , ProcedureQueryParameters params , TupleContext tupleContext ) { validate ( params ) ; StringBuilder commandLine = createCallStoreProcedureCommand ( storedProcedureName , params ) ; Document result = callStoredProcedure ( commandLine ) ...
In MongoDB the equivalent of a stored procedure is a stored Javascript .
147,621
public UniqueEntityLoader buildLoader ( OuterJoinLoadable persister , int batchSize , LockMode lockMode , SessionFactoryImplementor factory , LoadQueryInfluencers influencers , BatchableEntityLoaderBuilder innerEntityLoaderBuilder ) { if ( batchSize <= 1 ) { return buildNonBatchingLoader ( persister , lockMode , factor...
Builds a batch - fetch capable loader based on the given persister lock - mode etc .
147,622
public UniqueEntityLoader buildLoader ( OuterJoinLoadable persister , int batchSize , LockOptions lockOptions , SessionFactoryImplementor factory , LoadQueryInfluencers influencers , BatchableEntityLoaderBuilder innerEntityLoaderBuilder ) { if ( batchSize <= 1 ) { return buildNonBatchingLoader ( persister , lockOptions...
Builds a batch - fetch capable loader based on the given persister lock - options etc .
147,623
private void applyProperties ( AssociationKey associationKey , Tuple associationRow , Relationship relationship ) { String [ ] indexColumns = associationKey . getMetadata ( ) . getRowKeyIndexColumnNames ( ) ; for ( int i = 0 ; i < indexColumns . length ; i ++ ) { String propertyName = indexColumns [ i ] ; Object proper...
The only properties added to a relationship are the columns representing the index of the association .
147,624
public Association getAssociation ( String collectionRole ) { if ( associations == null ) { return null ; } return associations . get ( collectionRole ) ; }
Return the association as cached in the entry state .
147,625
public void setAssociation ( String collectionRole , Association association ) { if ( associations == null ) { associations = new HashMap < > ( ) ; } associations . put ( collectionRole , association ) ; }
Set the association in the entry state .
147,626
public void addExtraState ( EntityEntryExtraState extraState ) { if ( next == null ) { next = extraState ; } else { next . addExtraState ( extraState ) ; } }
state chain management ops below
147,627
protected StrongCounter getCounterOrCreateIt ( String counterName , int initialValue ) { CounterManager counterManager = EmbeddedCounterManagerFactory . asCounterManager ( cacheManager ) ; if ( ! counterManager . isDefined ( counterName ) ) { LOG . tracef ( "Counter %s is not defined, creating it" , counterName ) ; val...
Create a counter if one is not defined already otherwise return the existing one .
147,628
public Set < TupleOperation > getOperations ( ) { if ( currentState == null ) { return Collections . emptySet ( ) ; } else { return new SetFromCollection < TupleOperation > ( currentState . values ( ) ) ; } }
Return the list of actions on the tuple . Inherently deduplicated operations
147,629
private < A extends Annotation > AnnotationConverter < A > getConverter ( Annotation annotation ) { MappingOption mappingOption = annotation . annotationType ( ) . getAnnotation ( MappingOption . class ) ; if ( mappingOption == null ) { return null ; } @ SuppressWarnings ( "unchecked" ) Class < ? extends AnnotationConv...
Returns a converter instance for the given annotation .
147,630
public static String [ ] slice ( String [ ] strings , int begin , int length ) { String [ ] result = new String [ length ] ; System . arraycopy ( strings , begin , result , 0 , length ) ; return result ; }
Create a smaller array from an existing one .
147,631
public static < T > int indexOf ( T [ ] array , T element ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] . equals ( element ) ) { return i ; } } return - 1 ; }
Return the position of an element inside an array
147,632
public static < T > T [ ] concat ( T [ ] first , T ... second ) { int firstLength = first . length ; int secondLength = second . length ; @ SuppressWarnings ( "unchecked" ) T [ ] result = ( T [ ] ) Array . newInstance ( first . getClass ( ) . getComponentType ( ) , firstLength + secondLength ) ; System . arraycopy ( fi...
Concats two arrays .
147,633
public static < T > T [ ] concat ( T firstElement , T ... array ) { @ SuppressWarnings ( "unchecked" ) T [ ] result = ( T [ ] ) Array . newInstance ( firstElement . getClass ( ) , 1 + array . length ) ; result [ 0 ] = firstElement ; System . arraycopy ( array , 0 , result , 1 , array . length ) ; return result ; }
Concats an element and an array .
147,634
private Serializable doWorkInIsolationTransaction ( final SharedSessionContractImplementor session ) throws HibernateException { class Work extends AbstractReturningWork < IntegralDataTypeHolder > { private final SharedSessionContractImplementor localSession = session ; public IntegralDataTypeHolder execute ( Connectio...
copied and altered from TransactionHelper
147,635
public static void registerOgmExternalizers ( SerializationConfigurationBuilder cfg ) { for ( AdvancedExternalizer < ? > advancedExternalizer : ogmExternalizers . values ( ) ) { cfg . addAdvancedExternalizer ( advancedExternalizer ) ; } }
Registers all custom Externalizer implementations that Hibernate OGM needs into an Infinispan CacheManager configuration .
147,636
public static void registerOgmExternalizers ( GlobalConfiguration globalCfg ) { Map < Integer , AdvancedExternalizer < ? > > externalizerMap = globalCfg . serialization ( ) . advancedExternalizers ( ) ; externalizerMap . putAll ( ogmExternalizers ) ; }
Registers all custom Externalizer implementations that Hibernate OGM needs into a running Infinispan CacheManager configuration . This is only safe to do when Caches from this CacheManager haven t been started yet or the ones already started do not contain any data needing these .
147,637
public static void validateExternalizersPresent ( EmbeddedCacheManager externalCacheManager ) { Map < Integer , AdvancedExternalizer < ? > > externalizerMap = externalCacheManager . getCacheManagerConfiguration ( ) . serialization ( ) . advancedExternalizers ( ) ; for ( AdvancedExternalizer < ? > ogmExternalizer : ogmE...
Verify that all OGM custom externalizers are present . N . B . even if some Externalizer is only needed in specific configuration it is not safe to start a CacheManager without one as the same CacheManager might be used or have been used in the past to store data using a different configuration .
147,638
public void writeLock ( EntityKey key , int timeout ) { ReadWriteLock lock = getLock ( key ) ; Lock writeLock = lock . writeLock ( ) ; acquireLock ( key , timeout , writeLock ) ; }
Acquires a write lock on a specific key .
147,639
public void readLock ( EntityKey key , int timeout ) { ReadWriteLock lock = getLock ( key ) ; Lock readLock = lock . readLock ( ) ; acquireLock ( key , timeout , readLock ) ; }
Acquires a read lock on a specific key .
147,640
public Map < AssociationKey , Map < RowKey , Map < String , Object > > > getAssociationsMap ( ) { return Collections . unmodifiableMap ( associationsKeyValueStorage ) ; }
Meant to execute assertions in tests only
147,641
public static String flatten ( String left , String right ) { return left == null || left . isEmpty ( ) ? right : left + "." + right ; }
Links the two field names into a single left . right field name . If the left field is empty right is returned
147,642
public static boolean organizeAssociationMapByRowKey ( org . hibernate . ogm . model . spi . Association association , AssociationKey key , AssociationContext associationContext ) { if ( association . isEmpty ( ) ) { return false ; } if ( key . getMetadata ( ) . getRowKeyIndexColumnNames ( ) . length != 1 ) { return fa...
Whether the rows of the given association should be stored in a hash using the single row key column as key or not .
147,643
private void scheduleBatchLoadIfNeeded ( Serializable id , SharedSessionContractImplementor session ) throws MappingException { if ( StringHelper . isEmpty ( delegate . getRHSUniqueKeyPropertyName ( ) ) && id != null ) { EntityPersister persister = session . getFactory ( ) . getMetamodel ( ) . entityPersister ( delegat...
Register the entity as batch loadable if enabled
147,644
public GeoMultiPoint addPoint ( GeoPoint point ) { Contracts . assertNotNull ( point , "point" ) ; this . points . add ( point ) ; return this ; }
Adds a new point .
147,645
public String findAlias ( String entityAlias , List < String > propertyPathWithoutAlias ) { RelationshipAliasTree aliasTree = relationshipAliases . get ( entityAlias ) ; if ( aliasTree == null ) { return null ; } RelationshipAliasTree associationAlias = aliasTree ; for ( int i = 0 ; i < propertyPathWithoutAlias . size ...
Given the alias of the entity and the path to the relationship it will return the alias of the component .
147,646
public Node createEmbedded ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; Result result = executionEngine . execute ( getCreateEmbeddedNodeQuery ( ) , params ) ; return singleResult ( result ) ; }
Create a single node representing an embedded element .
147,647
public Node findEntity ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; Result result = executionEngine . execute ( getFindEntityQuery ( ) , params ) ; return singleResult ( result ) ; }
Find the node corresponding to an entity .
147,648
public Node insertEntity ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; Result result = executionEngine . execute ( getCreateEntityQuery ( ) , params ) ; return singleResult ( result ) ; }
Creates the node corresponding to an entity .
147,649
public ResourceIterator < Node > findEntities ( GraphDatabaseService executionEngine ) { Result result = executionEngine . execute ( getFindEntitiesQuery ( ) ) ; return result . columnAs ( BaseNeo4jEntityQueries . ENTITY_ALIAS ) ; }
Find all the node representing the entity .
147,650
public void removeEntity ( GraphDatabaseService executionEngine , Object [ ] columnValues ) { Map < String , Object > params = params ( columnValues ) ; executionEngine . execute ( getRemoveEntityQuery ( ) , params ) ; }
Remove the nodes representing the entity and the embedded elements attached to it .
147,651
public void updateEmbeddedColumn ( GraphDatabaseService executionEngine , Object [ ] keyValues , String embeddedColumn , Object value ) { String query = getUpdateEmbeddedColumnQuery ( keyValues , embeddedColumn ) ; Map < String , Object > params = params ( ArrayHelper . concat ( keyValues , value , value ) ) ; executio...
Update the value of an embedded node property .
147,652
private static IndexOptions prepareOptions ( MongoDBIndexType indexType , Document options , String indexName , boolean unique ) { IndexOptions indexOptions = new IndexOptions ( ) ; indexOptions . name ( indexName ) . unique ( unique ) . background ( options . getBoolean ( "background" , false ) ) ; if ( unique ) { ind...
Prepare the options by adding additional information to them .
147,653
public static AssociationKeyMetadata getInverseAssociationKeyMetadata ( OgmEntityPersister mainSidePersister , int propertyIndex ) { Type propertyType = mainSidePersister . getPropertyTypes ( ) [ propertyIndex ] ; SessionFactoryImplementor factory = mainSidePersister . getFactory ( ) ; if ( ! propertyType . isAssociati...
Returns the meta - data for the inverse side of the association represented by the given property on the given persister in case it represents the main side of a bi - directional one - to - many or many - to - many association .
147,654
public static OgmCollectionPersister getInverseCollectionPersister ( OgmCollectionPersister mainSidePersister ) { if ( mainSidePersister . isInverse ( ) || ! mainSidePersister . isManyToMany ( ) || ! mainSidePersister . getElementType ( ) . isEntityType ( ) ) { return null ; } EntityPersister inverseSidePersister = mai...
Returns the given collection persister for the inverse side in case the given persister represents the main side of a bi - directional many - to - many association .
147,655
private static boolean isCollectionMatching ( Joinable mainSideJoinable , OgmCollectionPersister inverseSidePersister ) { boolean isSameTable = mainSideJoinable . getTableName ( ) . equals ( inverseSidePersister . getTableName ( ) ) ; if ( ! isSameTable ) { return false ; } return Arrays . equals ( mainSideJoinable . g...
Checks whether table name and key column names of the given joinable and inverse collection persister match .
147,656
public static void resetValue ( Document entity , String column ) { if ( ! column . contains ( "." ) ) { entity . remove ( column ) ; } else { String [ ] path = DOT_SEPARATOR_PATTERN . split ( column ) ; Object field = entity ; int size = path . length ; for ( int index = 0 ; index < size ; index ++ ) { String node = p...
Remove a column from the Document
147,657
private static void validateAsMongoDBCollectionName ( String collectionName ) { Contracts . assertStringParameterNotEmpty ( collectionName , "requestedName" ) ; if ( collectionName . startsWith ( "system." ) ) { throw log . collectionNameHasInvalidSystemPrefix ( collectionName ) ; } else if ( collectionName . contains ...
Validates a String to be a valid name to be used in MongoDB for a collection name .
147,658
private void validateAsMongoDBFieldName ( String fieldName ) { if ( fieldName . startsWith ( "$" ) ) { throw log . fieldNameHasInvalidDollarPrefix ( fieldName ) ; } else if ( fieldName . contains ( "\u0000" ) ) { throw log . fieldNameContainsNULCharacter ( fieldName ) ; } }
Validates a String to be a valid name to be used in MongoDB for a field name .
147,659
private static int determineBatchSize ( boolean canGridDialectDoMultiget , int classBatchSize , int configuredDefaultBatchSize ) { if ( ! canGridDialectDoMultiget ) { return - 1 ; } else if ( classBatchSize != - 1 ) { return classBatchSize ; } else if ( configuredDefaultBatchSize != - 1 ) { return configuredDefaultBatc...
Returns the effective batch size . If the dialect is multiget capable and a batch size has been configured use that one otherwise the default .
147,660
private String getInverseOneToOneProperty ( String property , OgmEntityPersister otherSidePersister ) { for ( String candidate : otherSidePersister . getPropertyNames ( ) ) { Type candidateType = otherSidePersister . getPropertyType ( candidate ) ; if ( candidateType . isEntityType ( ) && ( ( ( EntityType ) candidateTy...
Returns the name from the inverse side if the given property de - notes a one - to - one association .
147,661
public Object [ ] getDatabaseSnapshot ( Serializable id , SharedSessionContractImplementor session ) throws HibernateException { if ( log . isTraceEnabled ( ) ) { log . trace ( "Getting current persistent state for: " + MessageHelper . infoString ( this , id , getFactory ( ) ) ) ; } final Tuple resultset = getFreshTupl...
This snapshot is meant to be used when updating data .
147,662
private Object initializeLazyPropertiesFromCache ( final String fieldName , final Object entity , final SharedSessionContractImplementor session , final EntityEntry entry , final CacheEntry cacheEntry ) { throw new NotSupportedException ( "OGM-9" , "Lazy properties not supported in OGM" ) ; }
Make superclasses method protected??
147,663
public Object getCurrentVersion ( Serializable id , SharedSessionContractImplementor session ) throws HibernateException { if ( log . isTraceEnabled ( ) ) { log . trace ( "Getting version: " + MessageHelper . infoString ( this , id , getFactory ( ) ) ) ; } final Tuple resultset = getFreshTuple ( EntityKeyBuilder . from...
Retrieve the version number
147,664
private boolean isAllOrDirtyOptLocking ( ) { EntityMetamodel entityMetamodel = getEntityMetamodel ( ) ; return entityMetamodel . getOptimisticLockStyle ( ) == OptimisticLockStyle . DIRTY || entityMetamodel . getOptimisticLockStyle ( ) == OptimisticLockStyle . ALL ; }
Copied from AbstractEntityPersister
147,665
private void removeFromInverseAssociations ( Tuple resultset , int tableIndex , Serializable id , SharedSessionContractImplementor session ) { new EntityAssociationUpdater ( this ) . id ( id ) . resultset ( resultset ) . session ( session ) . tableIndex ( tableIndex ) . propertyMightRequireInverseAssociationManagement ...
Removes the given entity from the inverse associations it manages .
147,666
private void addToInverseAssociations ( Tuple resultset , int tableIndex , Serializable id , SharedSessionContractImplementor session ) { new EntityAssociationUpdater ( this ) . id ( id ) . resultset ( resultset ) . session ( session ) . tableIndex ( tableIndex ) . propertyMightRequireInverseAssociationManagement ( pro...
Adds the given entity to the inverse associations it manages .
147,667
private void processGeneratedProperties ( Serializable id , Object entity , Object [ ] state , SharedSessionContractImplementor session , GenerationTiming matchTiming ) { Tuple tuple = getFreshTuple ( EntityKeyBuilder . fromPersister ( this , id , session ) , session ) ; saveSharedTuple ( entity , tuple , session ) ; i...
Re - reads the given entity refreshing any properties updated on the server - side during insert or update .
147,668
private boolean isReadRequired ( ValueGeneration valueGeneration , GenerationTiming matchTiming ) { return valueGeneration != null && valueGeneration . getValueGenerator ( ) == null && timingsMatch ( valueGeneration . getGenerationTiming ( ) , matchTiming ) ; }
Whether the given value generation strategy requires to read the value from the database or not .
147,669
public static List < Object > listOfEntities ( SharedSessionContractImplementor session , Type [ ] resultTypes , ClosableIterator < Tuple > tuples ) { Class < ? > returnedClass = resultTypes [ 0 ] . getReturnedClass ( ) ; TupleBasedEntityLoader loader = getLoader ( session , returnedClass ) ; OgmLoadingContext ogmLoadi...
At the moment we only support the case where one entity type is returned
147,670
private void doBatchWork ( BatchBackend backend ) throws InterruptedException { ExecutorService executor = Executors . newFixedThreadPool ( typesToIndexInParallel , "BatchIndexingWorkspace" ) ; for ( IndexedTypeIdentifier indexedTypeIdentifier : rootIndexedTypes ) { executor . execute ( new BatchIndexingWorkspace ( gri...
Will spawn a thread for each type in rootEntities they will all re - join on endAllSignal when finished .
147,671
private void afterBatch ( BatchBackend backend ) { IndexedTypeSet targetedTypes = searchFactoryImplementor . getIndexedTypesPolymorphic ( rootIndexedTypes ) ; if ( this . optimizeAtEnd ) { backend . optimize ( targetedTypes ) ; } backend . flush ( targetedTypes ) ; }
Operations to do after all subthreads finished their work on index
147,672
private void beforeBatch ( BatchBackend backend ) { if ( this . purgeAtStart ) { IndexedTypeSet targetedTypes = searchFactoryImplementor . getIndexedTypesPolymorphic ( rootIndexedTypes ) ; for ( IndexedTypeIdentifier type : targetedTypes ) { backend . doWorkInSync ( new PurgeAllLuceneWork ( tenantId , type ) ) ; } if (...
Optional operations to do before the multiple - threads start indexing
147,673
public static < T > Set < T > asSet ( T ... ts ) { if ( ts == null ) { return null ; } else if ( ts . length == 0 ) { return Collections . emptySet ( ) ; } else { Set < T > set = new HashSet < T > ( getInitialCapacityFromExpectedSize ( ts . length ) ) ; Collections . addAll ( set , ts ) ; return Collections . unmodifia...
Returns an unmodifiable set containing the given elements .
147,674
private boolean isOrdinal ( int paramType ) { switch ( paramType ) { case Types . INTEGER : case Types . NUMERIC : case Types . SMALLINT : case Types . TINYINT : case Types . BIGINT : case Types . DECIMAL : case Types . DOUBLE : case Types . FLOAT : return true ; case Types . CHAR : case Types . LONGVARCHAR : case Type...
in truth we probably only need the types as injected by the metadata binder
147,675
public ClosableIterator < Tuple > callStoredProcedure ( EmbeddedCacheManager embeddedCacheManager , String storedProcedureName , ProcedureQueryParameters queryParameters , ClassLoaderService classLoaderService ) { validate ( queryParameters ) ; Cache < String , String > cache = embeddedCacheManager . getCache ( STORED_...
Returns the result of a stored procedure executed on the backend .
147,676
public static String getPrefix ( String column ) { return column . contains ( "." ) ? DOT_SEPARATOR_PATTERN . split ( column ) [ 0 ] : null ; }
If the column name is a dotted column returns the first part . Returns null otherwise .
147,677
public static String getColumnSharedPrefix ( String [ ] associationKeyColumns ) { String prefix = null ; for ( String column : associationKeyColumns ) { String newPrefix = getPrefix ( column ) ; if ( prefix == null ) { prefix = newPrefix ; if ( prefix == null ) { break ; } } else { if ( ! equals ( prefix , newPrefix ) ...
Returns the shared prefix of these columns . Null otherwise .
147,678
public static ThreadPoolExecutor newFixedThreadPool ( int threads , String groupname , int queueSize ) { return new ThreadPoolExecutor ( threads , threads , 0L , TimeUnit . MILLISECONDS , new LinkedBlockingQueue < Runnable > ( queueSize ) , new SearchThreadFactory ( groupname ) , new BlockPolicy ( ) ) ; }
Creates a new fixed size ThreadPoolExecutor
147,679
public static void readAndCheckVersion ( ObjectInput input , int supportedVersion , Class < ? > externalizedType ) throws IOException { int version = input . readInt ( ) ; if ( version != supportedVersion ) { throw LOG . unexpectedKeyVersion ( externalizedType , version , supportedVersion ) ; } }
Consumes the version field from the given input and raises an exception if the record is in a newer version written by a newer version of Hibernate OGM .
147,680
public static boolean matches ( Map < String , Object > nodeProperties , String [ ] keyColumnNames , Object [ ] keyColumnValues ) { for ( int i = 0 ; i < keyColumnNames . length ; i ++ ) { String property = keyColumnNames [ i ] ; Object expectedValue = keyColumnValues [ i ] ; boolean containsProperty = nodeProperties ....
Check if the node matches the column values
147,681
public GeoPolygon addHoles ( List < List < GeoPoint > > holes ) { Contracts . assertNotNull ( holes , "holes" ) ; this . rings . addAll ( holes ) ; return this ; }
Adds new holes to the polygon .
147,682
public void addAll ( OptionsContainerBuilder container ) { for ( Entry < Class < ? extends Option < ? , ? > > , ValueContainerBuilder < ? , ? > > entry : container . optionValues . entrySet ( ) ) { addAll ( entry . getKey ( ) , entry . getValue ( ) . build ( ) ) ; } }
Adds all options from the passed container to this container .
147,683
private static IndexedTypeSet toRootEntities ( ExtendedSearchIntegrator extendedIntegrator , Class < ? > ... selection ) { Set < Class < ? > > entities = new HashSet < Class < ? > > ( ) ; for ( Class < ? > entityType : selection ) { IndexedTypeSet targetedClasses = extendedIntegrator . getIndexedTypesPolymorphic ( Inde...
From the set of classes a new set is built containing all indexed subclasses but removing then all subtypes of indexed entities .
147,684
private void updateHostingEntityIfRequired ( ) { if ( hostingEntity != null && hostingEntityRequiresReadAfterUpdate ( ) ) { OgmEntityPersister entityPersister = getHostingEntityPersister ( ) ; if ( GridDialects . hasFacet ( gridDialect , GroupingByEntityDialect . class ) ) { ( ( GroupingByEntityDialect ) gridDialect ) ...
Reads the entity hosting the association from the datastore and applies any property changes from the server side .
147,685
private static List < Class < ? > > getClassHierarchy ( Class < ? > clazz ) { List < Class < ? > > hierarchy = new ArrayList < Class < ? > > ( 4 ) ; for ( Class < ? > current = clazz ; current != null ; current = current . getSuperclass ( ) ) { hierarchy . add ( current ) ; } return hierarchy ; }
Returns the class hierarchy of the given type from bottom to top starting with the given class itself . Interfaces are not included .
147,686
public static PersistenceStrategy < ? , ? , ? > getInstance ( CacheMappingType cacheMapping , EmbeddedCacheManager externalCacheManager , URL configurationUrl , JtaPlatform jtaPlatform , Set < EntityKeyMetadata > entityTypes , Set < AssociationKeyMetadata > associationTypes , Set < IdSourceKeyMetadata > idSourceTypes )...
Returns a persistence strategy based on the passed configuration .
147,687
private Iterable < PersistentNoSqlIdentifierGenerator > getPersistentGenerators ( ) { Map < String , EntityPersister > entityPersisters = factory . getMetamodel ( ) . entityPersisters ( ) ; Set < PersistentNoSqlIdentifierGenerator > persistentGenerators = new HashSet < PersistentNoSqlIdentifierGenerator > ( entityPersi...
Returns all the persistent id generators which potentially require the creation of an object in the schema .
147,688
public Relationship createRelationshipForEmbeddedAssociation ( GraphDatabaseService executionEngine , AssociationKey associationKey , EntityKey embeddedKey ) { String query = initCreateEmbeddedAssociationQuery ( associationKey , embeddedKey ) ; Object [ ] queryValues = createRelationshipForEmbeddedQueryValues ( associa...
Give an embedded association creates all the nodes and relationships required to represent it . It assumes that the entity node containing the association already exists in the db .
147,689
private RowKeyAndTuple createAndPutAssociationRowForInsert ( Serializable key , PersistentCollection collection , AssociationPersister associationPersister , SharedSessionContractImplementor session , int i , Object entry ) { RowKeyBuilder rowKeyBuilder = initializeRowKeyBuilder ( ) ; Tuple associationRow = new Tuple (...
Creates an association row representing the given entry and adds it to the association managed by the given persister .
147,690
protected void doProcessQueuedOps ( PersistentCollection collection , Serializable key , int nextIndex , SharedSessionContractImplementor session ) throws HibernateException { }
once we re on ORM 5
147,691
public boolean isIdProperty ( OgmEntityPersister persister , List < String > namesWithoutAlias ) { String join = StringHelper . join ( namesWithoutAlias , "." ) ; Type propertyType = persister . getPropertyType ( namesWithoutAlias . get ( 0 ) ) ; String [ ] identifierColumnNames = persister . getIdentifierColumnNames (...
Check if the property is part of the identifier of the entity .
147,692
public void deploySchema ( String generatedProtobufName , RemoteCache < String , String > protobufCache , SchemaCapture schemaCapture , SchemaOverride schemaOverrideService , URL schemaOverrideResource ) { if ( schemaOverrideService != null || schemaOverrideResource != null ) { cachedSchema = new SchemaValidator ( this...
Typically this is transparently handled by using the Protostream codecs but be aware of it when bypassing Protostream .
147,693
public static void archiveFile ( final ArchiveOutputStream out , final VirtualFileDescriptor source , final long fileSize ) throws IOException { if ( ! source . hasContent ( ) ) { throw new IllegalArgumentException ( "Provided source is not a file: " + source . getPath ( ) ) ; } if ( out instanceof TarArchiveOutputStre...
Adds the file to the tar archive represented by output stream . It s caller s responsibility to close output stream properly .
147,694
void setRightChild ( final byte b , final MutableNode child ) { final ChildReference right = children . getRight ( ) ; if ( right == null || ( right . firstByte & 0xff ) != ( b & 0xff ) ) { throw new IllegalArgumentException ( ) ; } children . setAt ( children . size ( ) - 1 , new ChildReferenceMutable ( b , child ) ) ...
Sets in - place the right child with the same first byte .
147,695
public boolean needMerge ( final BasePage left , final BasePage right ) { final int leftSize = left . getSize ( ) ; final int rightSize = right . getSize ( ) ; return leftSize == 0 || rightSize == 0 || leftSize + rightSize <= ( ( ( isDupTree ( left ) ? getDupPageMaxSize ( ) : getPageMaxSize ( ) ) * 7 ) >> 3 ) ; }
Is invoked on the leaf deletion only .
147,696
static MetaTreeImpl . Proto saveMetaTree ( final ITreeMutable metaTree , final EnvironmentImpl env , final ExpiredLoggableCollection expired ) { final long newMetaTreeAddress = metaTree . save ( ) ; final Log log = env . getLog ( ) ; final int lastStructureId = env . getLastStructureId ( ) ; final long dbRootAddress = ...
Saves meta tree writes database root and flushes the log .
147,697
@ SuppressWarnings ( { "OverlyLongMethod" } ) public void clearProperties ( final PersistentStoreTransaction txn , final Entity entity ) { final Transaction envTxn = txn . getEnvironmentTransaction ( ) ; final PersistentEntityId id = ( PersistentEntityId ) entity . getId ( ) ; final int entityTypeId = id . getTypeId ( ...
Clears all properties of specified entity .
147,698
boolean deleteEntity ( final PersistentStoreTransaction txn , final PersistentEntity entity ) { clearProperties ( txn , entity ) ; clearBlobs ( txn , entity ) ; deleteLinks ( txn , entity ) ; final PersistentEntityId id = entity . getId ( ) ; final int entityTypeId = id . getTypeId ( ) ; final long entityLocalId = id ....
Deletes specified entity clearing all its properties and deleting all its outgoing links .
147,699
private void deleteLinks ( final PersistentStoreTransaction txn , final PersistentEntity entity ) { final PersistentEntityId id = entity . getId ( ) ; final int entityTypeId = id . getTypeId ( ) ; final long entityLocalId = id . getLocalId ( ) ; final Transaction envTxn = txn . getEnvironmentTransaction ( ) ; final Lin...
Deletes all outgoing links of specified entity .