idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
35,500
private Object onTableGenerator ( EntityMetadata m , Client < ? > client , IdDiscriptor keyValue , Object e ) { Object tablegenerator = getAutoGenClazz ( client ) ; if ( tablegenerator instanceof TableGenerator ) { Object generatedId = ( ( TableGenerator ) tablegenerator ) . generate ( keyValue . getTableDiscriptor ( )...
Generate Id when given table generation strategy .
35,501
protected List populateEntities ( EntityMetadata m , Client client ) { ClientMetadata clientMetadata = ( ( ClientBase ) client ) . getClientMetadata ( ) ; this . useLuceneOrES = ! MetadataUtils . useSecondryIndex ( clientMetadata ) ; if ( useLuceneOrES ) { return populateUsingLucene ( m , client , null , kunderaQuery ....
Populate results .
35,502
protected List recursivelyPopulateEntities ( EntityMetadata m , Client client ) { List < EnhanceEntity > ls = populateEntities ( m , client ) ; return setRelationEntities ( ls , client , m ) ; }
Recursively populate entity .
35,503
private CouchDBQueryInterpreter onAggregatedQuery ( EntityMetadata m , CouchDBQueryInterpreter interpreter , KunderaQuery kunderaQuery ) { interpreter . setAggregation ( true ) ; SelectStatement selectStatement = kunderaQuery . getSelectStatement ( ) ; Expression whereClause = selectStatement . getWhereClause ( ) ; if ...
On aggregated query .
35,504
private void setAggregationColInInterpreter ( EntityMetadata m , CouchDBQueryInterpreter interpreter , Expression exp ) { if ( StateFieldPathExpression . class . isAssignableFrom ( exp . getClass ( ) ) ) { Map < String , Object > map = KunderaQueryUtils . setFieldClazzAndColumnFamily ( exp , m , kunderaMetadata ) ; int...
Sets the aggregation col in interpreter .
35,505
private List < Map < String , Object > > getColumnsToOutput ( EntityMetadata m , KunderaQuery kunderaQuery ) { if ( kunderaQuery . isSelectStatement ( ) ) { SelectStatement selectStatement = kunderaQuery . getSelectStatement ( ) ; SelectClause selectClause = ( SelectClause ) selectStatement . getSelectClause ( ) ; retu...
Gets the columns to output .
35,506
public boolean isUseSecondryIndex ( ) { return StringUtils . isEmpty ( LuceneIndexDir ) && StringUtils . isBlank ( LuceneIndexDir ) && StringUtils . isEmpty ( indexImplementor ) && StringUtils . isBlank ( indexImplementor ) ; }
Checks if is use secondry index .
35,507
public Object getObjectInstance ( Object obj , Name name , Context nameCtx , Hashtable environment ) throws Exception { Reference ref = ( Reference ) obj ; Object ret = null ; if ( ref . getClassName ( ) . equals ( "javax.transaction.UserTransaction" ) || ref . getClassName ( ) . equals ( "com.impetus.kundera.persisten...
Returns reference to userTransaction object .
35,508
private Map < String , Object > populateRelations ( List < String > relations , Object [ ] o ) { Map < String , Object > relationVal = new HashMap < String , Object > ( relations . size ( ) ) ; int counter = 1 ; for ( String r : relations ) { relationVal . put ( r , o [ counter ++ ] ) ; } return relationVal ; }
Populate relations .
35,509
private boolean isStringProperty ( EntityType entityType , Attribute attribute ) { String discriminatorColumn = ( ( AbstractManagedType ) entityType ) . getDiscriminatorColumn ( ) ; if ( attribute . getName ( ) . equals ( discriminatorColumn ) ) { return true ; } return attribute != null ? ( ( AbstractAttribute ) attri...
Checks if is string property .
35,510
public static void main ( String [ ] args ) { EntityManagerFactory emf = Persistence . createEntityManagerFactory ( "twissandra,twingo,twirdbms" ) ; EntityManager em = emf . createEntityManager ( ) ; try { Set < User > users = UserBroker . brokeUserList ( args [ 0 ] ) ; for ( Iterator < User > iterator = users . iterat...
main runner method
35,511
private static void onDestroyDBResources ( EntityManagerFactory emf , EntityManager em ) { if ( emf != null ) { emf . close ( ) ; } if ( em != null ) { em . close ( ) ; } }
After successful processing close entity manager and it s factory instance .
35,512
public void scanClass ( InputStream bits ) throws IOException { DataInputStream dstream = new DataInputStream ( new BufferedInputStream ( bits ) ) ; ClassFile cf = null ; try { cf = new ClassFile ( dstream ) ; String className = cf . getName ( ) ; List < String > annotations = new ArrayList < String > ( ) ; accumulateA...
Scan class .
35,513
public void accumulateAnnotations ( List < String > annotations , AnnotationsAttribute annatt ) { if ( null == annatt ) { return ; } for ( Annotation ann : annatt . getAnnotations ( ) ) { annotations . add ( ann . getTypeName ( ) ) ; } }
Accumulate annotations .
35,514
public ResourceIterator getResourceIterator ( URL url , Filter filter ) { String urlString = url . toString ( ) ; try { if ( urlString . endsWith ( "!/" ) ) { urlString = urlString . substring ( 4 ) ; urlString = urlString . substring ( 0 , urlString . length ( ) - 2 ) ; url = new URL ( urlString ) ; } if ( urlString ....
Gets the resource iterator .
35,515
Jedis getConnection ( ) { if ( logger . isDebugEnabled ( ) ) logger . info ( "borrowing connection from pool" ) ; Object poolOrConnection = getConnectionPoolOrConnection ( ) ; if ( poolOrConnection != null && poolOrConnection instanceof JedisPool ) { Jedis connection = ( ( JedisPool ) getConnectionPoolOrConnection ( ) ...
Retrieving connection from connection pool .
35,516
private long toLong ( byte [ ] data ) { if ( data == null || data . length != 8 ) return 0x0 ; return ( long ) ( ( long ) ( 0xff & data [ 0 ] ) << 56 | ( long ) ( 0xff & data [ 1 ] ) << 48 | ( long ) ( 0xff & data [ 2 ] ) << 40 | ( long ) ( 0xff & data [ 3 ] ) << 32 | ( long ) ( 0xff & data [ 4 ] ) << 24 | ( long ) ( 0...
To long .
35,517
private byte [ ] fromLong ( long data ) { return new byte [ ] { ( byte ) ( ( data >> 56 ) & 0xff ) , ( byte ) ( ( data >> 48 ) & 0xff ) , ( byte ) ( ( data >> 40 ) & 0xff ) , ( byte ) ( ( data >> 32 ) & 0xff ) , ( byte ) ( ( data >> 24 ) & 0xff ) , ( byte ) ( ( data >> 16 ) & 0xff ) , ( byte ) ( ( data >> 8 ) & 0xff ) ...
From long .
35,518
public void addJarFile ( String jarFile ) { if ( jarFiles == null ) { jarFiles = new HashSet < String > ( ) ; } this . jarFiles . add ( jarFile ) ; addJarFileUrl ( jarFile ) ; }
Sets the jar files .
35,519
public List < URL > getManagedURLs ( ) { List < URL > managedURL = getJarFileUrls ( ) ; if ( managedURL == null ) { managedURL = new ArrayList < URL > ( 1 ) ; } if ( ! getExcludeUnlistedClasses ( ) ) { managedURL . add ( getPersistenceUnitRootUrl ( ) ) ; } return managedURL ; }
Returns list of managed urls .
35,520
private void addJarFileUrl ( String jarFile ) { if ( jarUrls == null ) { jarUrls = new HashSet < URL > ( ) ; } try { jarUrls . add ( new File ( jarFile ) . toURI ( ) . toURL ( ) ) ; } catch ( MalformedURLException e ) { log . error ( "Error while mapping jar-file url" + jarFile + "caused by:" + e . getMessage ( ) ) ; t...
Adds jar file URL .
35,521
public String getClient ( ) { String client = null ; if ( this . properties != null ) { client = ( String ) this . properties . get ( PersistenceProperties . KUNDERA_CLIENT_FACTORY ) ; } if ( client == null ) { log . error ( "kundera.client property is missing for persistence unit:" + persistenceUnitName ) ; throw new ...
Gets the client . In case client is not configure it throws IllegalArgumentException .
35,522
public int getBatchSize ( ) { if ( isBatch ( ) ) { String batchSize = getProperty ( PersistenceProperties . KUNDERA_BATCH_SIZE ) ; int batch_Size = Integer . valueOf ( batchSize ) ; if ( batch_Size == 0 ) { throw new IllegalArgumentException ( "kundera.batch.size property must be numeric and > 0" ) ; } return batch_Siz...
Return batch . size value .
35,523
protected Document prepareDocumentForSuperColumn ( EntityMetadata metadata , Object object , String embeddedColumnName , String parentId , Class < ? > clazz ) { Document currentDoc ; currentDoc = new Document ( ) ; addEntityClassToDocument ( metadata , object , currentDoc , null ) ; addSuperColumnNameToDocument ( embed...
Prepare document .
35,524
protected void addParentKeyToDocument ( String parentId , Document currentDoc , Class < ? > clazz ) { if ( clazz != null && parentId != null ) { Field luceneField = new Field ( IndexingConstants . PARENT_ID_FIELD , parentId , Field . Store . YES , Field . Index . ANALYZED_NO_NORMS ) ; currentDoc . add ( luceneField ) ;...
Index parent key .
35,525
protected void createSuperColumnDocument ( EntityMetadata metadata , Object object , Document currentDoc , Object embeddedObject , EmbeddableType superColumn , MetamodelImpl metamodel ) { Set < Attribute > attributes = superColumn . getAttributes ( ) ; Iterator < Attribute > iter = attributes . iterator ( ) ; while ( i...
Index super column .
35,526
private void addSuperColumnNameToDocument ( String superColumnName , Document currentDoc ) { Field luceneField = new Field ( SUPERCOLUMN_INDEX , superColumnName , Store . YES , Field . Index . NO ) ; currentDoc . add ( luceneField ) ; }
Index super column name .
35,527
protected void addEntityFieldsToDocument ( EntityMetadata metadata , Object entity , Document document , MetamodelImpl metaModel ) { String indexName = metadata . getIndexName ( ) ; Map < String , PropertyIndex > indexProperties = metadata . getIndexProperties ( ) ; for ( String columnName : indexProperties . keySet ( ...
Adds the index properties .
35,528
protected void addEntityClassToDocument ( EntityMetadata metadata , Object entity , Document document , final MetamodelImpl metaModel ) { try { Field luceneField ; Object id ; id = PropertyAccessorHelper . getId ( entity , metadata ) ; if ( metaModel != null && metaModel . isEmbeddable ( metadata . getIdAttribute ( ) ....
Prepare index document .
35,529
private void addFieldToDocument ( Object object , Document document , java . lang . reflect . Field field , String colName , String indexName ) { try { Object obj = PropertyAccessorHelper . getObject ( object , field ) ; if ( obj != null ) { Field luceneField = new Field ( getCannonicalPropertyName ( indexName , colNam...
Index field .
35,530
protected String getKunderaId ( EntityMetadata metadata , Object id ) { return metadata . getEntityClazz ( ) . getCanonicalName ( ) + IndexingConstants . DELIMETER + id ; }
Gets the kundera id .
35,531
private void setTimeOut ( Object value ) { if ( value instanceof Integer ) { this . oracleNoSQLClient . setTimeout ( ( Integer ) value ) ; } else if ( value instanceof String ) { this . oracleNoSQLClient . setTimeout ( Integer . valueOf ( ( String ) value ) ) ; } }
set time out
35,532
private void setTimeUnit ( Object value ) { if ( value instanceof TimeUnit ) { this . oracleNoSQLClient . setTimeUnit ( ( TimeUnit ) value ) ; } else if ( value instanceof String ) { this . oracleNoSQLClient . setTimeUnit ( TimeUnit . valueOf ( ( String ) value ) ) ; } }
set time unit
35,533
private void setBatchSize ( Object value ) { if ( value instanceof Integer ) { this . oracleNoSQLClient . setBatchSize ( ( Integer ) value ) ; } else if ( value instanceof String ) { this . oracleNoSQLClient . setBatchSize ( Integer . valueOf ( ( String ) value ) ) ; } }
set batch size
35,534
protected Column populateFkey ( String rlName , Object rlValue , long timestamp ) throws PropertyAccessException { Column col = new Column ( ) ; col . setName ( PropertyAccessorFactory . STRING . toBytes ( rlName ) ) ; col . setValue ( PropertyAccessorHelper . getBytes ( rlValue ) ) ; col . setTimestamp ( timestamp ) ;...
Populates foreign key as column .
35,535
protected void computeEntityViaColumns ( EntityMetadata m , boolean isRelation , List < String > relations , List < Object > entities , Map < ByteBuffer , List < Column > > qResults ) { MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) )...
Compute entity via columns .
35,536
protected void computeEntityViaSuperColumns ( EntityMetadata m , boolean isRelation , List < String > relations , List < Object > entities , Map < ByteBuffer , List < SuperColumn > > qResults ) { for ( ByteBuffer key : qResults . keySet ( ) ) { onSuperColumn ( m , isRelation , relations , entities , qResults . get ( ke...
Compute entity via super columns .
35,537
protected void onSuperColumn ( EntityMetadata m , boolean isRelation , List < String > relations , List < Object > entities , List < SuperColumn > superColumns , ByteBuffer key ) { Object e = null ; Object id = PropertyAccessorHelper . getObject ( m . getIdAttribute ( ) . getJavaType ( ) , key . array ( ) ) ; ThriftRow...
On super column .
35,538
private CounterColumn populateCounterFkey ( String rlName , Object rlValue ) { CounterColumn counterCol = new CounterColumn ( ) ; counterCol . setName ( PropertyAccessorFactory . STRING . toBytes ( rlName ) ) ; counterCol . setValue ( ( Long ) rlValue ) ; return counterCol ; }
Populate counter fkey .
35,539
protected void deleteRecordFromCounterColumnFamily ( Object pKey , String tableName , EntityMetadata metadata , ConsistencyLevel consistencyLevel ) { ColumnPath path = new ColumnPath ( tableName ) ; Cassandra . Client conn = null ; Object pooledConnection = null ; try { pooledConnection = getConnection ( ) ; conn = ( o...
Deletes record for given primary key from counter column family .
35,540
protected void createIndexesOnColumns ( EntityMetadata m , String tableName , List < Column > columns , Class columnType ) { Object pooledConnection = null ; try { Cassandra . Client api = null ; pooledConnection = getConnection ( ) ; api = ( org . apache . cassandra . thrift . Cassandra . Client ) getConnection ( pool...
Creates secondary indexes on columns if not already created .
35,541
public Object find ( Class entityClass , Object rowId ) { EntityMetadata entityMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClass ) ; List < String > relationNames = entityMetadata . getRelationNames ( ) ; return find ( entityClass , entityMetadata , rowId , relationNames ) ; }
Finds an entiry from database .
35,542
public boolean isCql3Enabled ( EntityMetadata metadata ) { if ( metadata != null ) { MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( metadata . getPersistenceUnit ( ) ) ; if ( metaModel . isEmbeddable ( metadata . getIdAttribute ( ) . getBindableJavaType ( ) ) )...
Returns true in case of composite Id and if cql3 opted and not a embedded entity .
35,543
public List executeSelectQuery ( Class clazz , List < String > relationalField , CassandraDataHandler dataHandler , boolean isNative , String cqlQuery ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Executing cql query {}." , cqlQuery ) ; } List entities = new ArrayList < Object > ( ) ; EntityMetadata entityMetada...
Executes Select CQL Query .
35,544
public List executeScalarQuery ( String cqlQuery ) { CqlResult cqlResult = null ; List results = new ArrayList ( ) ; try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Executing query {}." , cqlQuery ) ; } cqlResult = ( CqlResult ) executeCQLQuery ( cqlQuery , true ) ; if ( cqlResult != null && ( cqlResult . getRow...
Execute scalar query .
35,545
private Object composeColumnValue ( CqlMetadata cqlMetadata , byte [ ] thriftColumnValue , byte [ ] thriftColumnName ) { Map < ByteBuffer , String > schemaTypes = cqlMetadata . getValue_types ( ) ; AbstractType < ? > type = null ; try { type = TypeParser . parse ( schemaTypes . get ( ByteBuffer . wrap ( thriftColumnNam...
Compose column value .
35,546
protected List populateEntitiesFromKeySlices ( EntityMetadata m , boolean isWrapReq , List < String > relations , List < KeySlice > keys , CassandraDataHandler dataHandler ) throws Exception { List results ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . ge...
Populate entities from key slices .
35,547
protected List < String > createInsertQuery ( EntityMetadata entityMetadata , Object entity , Cassandra . Client cassandra_client , List < RelationHolder > rlHolders , Object ttlColumns ) { List < String > insert_Queries = new ArrayList < String > ( ) ; CQLTranslator translator = new CQLTranslator ( ) ; HashMap < Trans...
Return insert query string for given entity .
35,548
private StringBuilder onRelationColumns ( String columnNames , String columnValues , StringBuilder columnNameBuilder , StringBuilder columnValueBuilder , RelationHolder rl ) { int relnameIndx = columnNameBuilder . indexOf ( "\"" + rl . getRelationName ( ) + "\"" ) ; if ( relnameIndx != - 1 && rl . getRelationValue ( ) ...
On relation columns .
35,549
protected List < String > getPersistQueries ( EntityMetadata entityMetadata , Object entity , org . apache . cassandra . thrift . Cassandra . Client conn , List < RelationHolder > rlHolders , Object ttlColumns ) { List < String > queries ; if ( entityMetadata . isCounterColumnType ( ) ) { queries = createUpdateQueryFor...
Gets the persist queries .
35,550
protected String onDeleteQuery ( EntityMetadata metadata , String tableName , MetamodelImpl metaModel , Object keyObject ) { CQLTranslator translator = new CQLTranslator ( ) ; String deleteQuery = CQLTranslator . DELETE_QUERY ; deleteQuery = StringUtils . replace ( deleteQuery , CQLTranslator . COLUMN_FAMILY , translat...
On delete query .
35,551
protected void onWhereClause ( EntityMetadata metadata , Object key , CQLTranslator translator , StringBuilder queryBuilder , MetamodelImpl metaModel , SingularAttribute attribute ) { if ( metaModel . isEmbeddable ( attribute . getBindableJavaType ( ) ) ) { Field [ ] fields = attribute . getBindableJavaType ( ) . getDe...
On where clause .
35,552
public Cassandra . Client getRawClient ( final String schema ) { Cassandra . Client client = null ; Object pooledConnection ; pooledConnection = getConnection ( ) ; client = ( org . apache . cassandra . thrift . Cassandra . Client ) getConnection ( pooledConnection ) ; try { client . set_cql_version ( getCqlVersion ( )...
Returns raw cassandra client from thrift connection pool .
35,553
protected Object executeCQLQuery ( String cqlQuery , boolean isCql3Enabled ) { Cassandra . Client conn = null ; Object pooledConnection = null ; pooledConnection = getConnection ( ) ; conn = ( org . apache . cassandra . thrift . Cassandra . Client ) getConnection ( pooledConnection ) ; try { if ( isCql3Enabled || isCql...
Executes query string using cql3 .
35,554
private void populateCqlVersion ( Map < String , Object > externalProperties ) { String cqlVersion = externalProperties != null ? ( String ) externalProperties . get ( CassandraConstants . CQL_VERSION ) : null ; if ( cqlVersion == null || ! ( cqlVersion != null && ( cqlVersion . equals ( CassandraConstants . CQL_VERSIO...
Populate cql version .
35,555
public < T > T execute ( final String query , final Object connection , final List < KunderaQuery . BindParameter > parameters ) { throw new KunderaException ( "not implemented" ) ; }
Execute with bind parameters
35,556
protected void persistJoinTableByCql ( JoinTableData joinTableData , Cassandra . Client conn ) { String joinTableName = joinTableData . getJoinTableName ( ) ; String invJoinColumnName = joinTableData . getInverseJoinColumnName ( ) ; Map < Object , Set < Object > > joinTableRecords = joinTableData . getJoinTableRecords ...
Persist join table by cql .
35,557
protected < E > List < E > getColumnsByIdUsingCql ( String schemaName , String tableName , String pKeyColumnName , String columnName , Object pKeyColumnValue , Class columnJavaType ) { List results = new ArrayList ( ) ; CQLTranslator translator = new CQLTranslator ( ) ; String selectQuery = translator . SELECT_QUERY ; ...
Find inverse join column values for join column .
35,558
protected < E > List < E > findIdsByColumnUsingCql ( String schemaName , String tableName , String pKeyName , String columnName , Object columnValue , Class entityClazz ) { EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClazz ) ; return getColumnsByIdUsingCql ( schemaName...
Find join column values for inverse join column .
35,559
private boolean checkValidClass ( Class < ? > clazz ) { return clazz . isAnnotationPresent ( Entity . class ) || clazz . isAnnotationPresent ( MappedSuperclass . class ) || clazz . isAnnotationPresent ( Embeddable . class ) ; }
checks for a valid entity definition
35,560
public List parseResponse ( SearchResponse response , AbstractAggregationBuilder aggregation , String [ ] fieldsToSelect , MetamodelImpl metaModel , Class clazz , final EntityMetadata entityMetadata , KunderaQuery query ) { logger . debug ( "Response of query: " + response ) ; List results = new ArrayList ( ) ; EntityT...
Parses the response .
35,561
private List parseAggregatedResponse ( SearchResponse response , KunderaQuery query , MetamodelImpl metaModel , Class clazz , EntityMetadata entityMetadata ) { List results , temp = new ArrayList < > ( ) ; InternalAggregations internalAggs = ( ( InternalFilter ) response . getAggregations ( ) . getAsMap ( ) . get ( ESC...
Parses the aggregated response .
35,562
private List onIterateBuckets ( Terms buckets , KunderaQuery query , MetamodelImpl metaModel , Class clazz , EntityMetadata entityMetadata ) { List temp , results = new ArrayList < > ( ) ; for ( Terms . Bucket entry : buckets . getBuckets ( ) ) { logger . debug ( "key [{}], doc_count [{}]" , entry . getKey ( ) , entry ...
On iterate buckets .
35,563
public Map < String , Object > parseAggregations ( SearchResponse response , KunderaQuery query , MetamodelImpl metaModel , Class clazz , EntityMetadata m ) { Map < String , Object > aggregationsMap = new LinkedHashMap < > ( ) ; if ( query . isAggregated ( ) == true && response . getAggregations ( ) != null ) { Interna...
Parses the aggregations .
35,564
private Map < String , Object > buildRecords ( ListIterable < Expression > iterable , InternalAggregations internalAgg ) { Map < String , Object > temp = new HashMap < > ( ) ; Iterator < Expression > itr = iterable . iterator ( ) ; while ( itr . hasNext ( ) ) { Expression exp = itr . next ( ) ; if ( AggregateFunction ....
Builds the records .
35,565
private List buildRecords ( InternalAggregations internalAgg , SearchHits topHits , KunderaQuery query , MetamodelImpl metaModel , Class clazz , EntityMetadata entityMetadata ) { List temp = new ArrayList < > ( ) ; Iterator < Expression > orderIterator = getSelectExpressionOrder ( query ) . iterator ( ) ; while ( order...
Parses the records .
35,566
private Terms filterBuckets ( Terms buckets , KunderaQuery query ) { Expression havingClause = query . getSelectStatement ( ) . getHavingClause ( ) ; if ( ! ( havingClause instanceof NullExpression ) && havingClause != null ) { Expression conditionalExpression = ( ( HavingClause ) havingClause ) . getConditionalExpress...
Filter buckets .
35,567
private boolean isValidBucket ( InternalAggregations internalAgg , KunderaQuery query , Expression conditionalExpression ) { if ( conditionalExpression instanceof ComparisonExpression ) { Expression expression = ( ( ComparisonExpression ) conditionalExpression ) . getLeftExpression ( ) ; Object leftValue = getAggregate...
Checks if is valid bucket .
35,568
private Object getFirstResult ( KunderaQuery query , String field , SearchHits hits , Class clazz , Metamodel metaModel , EntityMetadata entityMetadata ) { Object entity ; if ( query . getEntityAlias ( ) . equals ( field ) ) { entity = getEntityObjects ( clazz , entityMetadata , metaModel . entity ( clazz ) , hits ) . ...
Gets the first result .
35,569
private Object getAggregatedResult ( InternalAggregations internalAggs , String identifier , Expression exp ) { switch ( identifier ) { case Expression . MIN : return ( ( ( InternalMin ) internalAggs . get ( exp . toParsedText ( ) ) ) . getValue ( ) ) ; case Expression . MAX : return ( ( ( InternalMax ) internalAggs . ...
Gets the aggregated result .
35,570
public Object wrapFindResult ( Map < String , Object > searchResults , EntityType entityType , Object result , EntityMetadata metadata , boolean b ) { return wrap ( searchResults , entityType , result , metadata , b ) ; }
Wrap find result .
35,571
private Object onEnum ( Attribute attribute , Object fieldValue ) { if ( ( ( Field ) attribute . getJavaMember ( ) ) . getType ( ) . isEnum ( ) ) { EnumAccessor accessor = new EnumAccessor ( ) ; fieldValue = accessor . fromString ( ( ( AbstractAttribute ) attribute ) . getBindableJavaType ( ) , fieldValue . toString ( ...
On enum .
35,572
private Object onId ( Object key , Attribute attribute , Object fieldValue ) { if ( SingularAttribute . class . isAssignableFrom ( attribute . getClass ( ) ) && ( ( SingularAttribute ) attribute ) . isId ( ) ) { key = fieldValue ; } return key ; }
On id .
35,573
public ListIterable < Expression > getSelectExpressionOrder ( KunderaQuery query ) { if ( ! KunderaQueryUtils . isSelectStatement ( query . getJpqlExpression ( ) ) ) { return null ; } Expression selectExpression = ( ( SelectClause ) ( query . getSelectStatement ( ) ) . getSelectClause ( ) ) . getSelectExpression ( ) ; ...
Gets the select expression order .
35,574
private List getEntityObjects ( Class clazz , final EntityMetadata entityMetadata , EntityType entityType , SearchHits hits ) { List results = new ArrayList ( ) ; Object entity = null ; for ( SearchHit hit : hits . getHits ( ) ) { entity = KunderaCoreUtils . createNewInstance ( clazz ) ; Map < String , Object > hitResu...
Gets the entity objects .
35,575
private boolean isPluralAttribute ( Field attribute ) { return attribute . getType ( ) . equals ( Collection . class ) || attribute . getType ( ) . equals ( Set . class ) || attribute . getType ( ) . equals ( List . class ) || attribute . getType ( ) . equals ( Map . class ) ; }
Returns true if attribute belongs plural hierarchy .
35,576
static PersistentAttributeType getPersistentAttributeType ( Field member ) { PersistentAttributeType attributeType = PersistentAttributeType . BASIC ; if ( member . isAnnotationPresent ( ElementCollection . class ) ) { attributeType = PersistentAttributeType . ELEMENT_COLLECTION ; } else if ( member . isAnnotationPrese...
Gets the persistent attribute type .
35,577
private < X > AbstractManagedType < X > buildManagedType ( Class < X > clazz , boolean isIdClass ) { AbstractManagedType < X > managedType = null ; if ( clazz . isAnnotationPresent ( Embeddable . class ) ) { validate ( clazz , true ) ; if ( ! embeddables . containsKey ( clazz ) ) { managedType = new DefaultEmbeddableTy...
Builds the managed type .
35,578
private AbstractManagedType getType ( Class clazz , boolean isIdClass ) { if ( clazz != null && ! clazz . equals ( Object . class ) ) { return processInternal ( clazz , isIdClass ) ; } return null ; }
Gets the super type .
35,579
private < X > void onDeclaredFields ( Class < X > clazz , AbstractManagedType < X > managedType ) { Field [ ] embeddedFields = clazz . getDeclaredFields ( ) ; for ( Field f : embeddedFields ) { if ( isNonTransient ( f ) ) { new TypeBuilder < T > ( f ) . build ( managedType , f . getType ( ) ) ; } } }
On declared fields .
35,580
private void addPredicatesToScannerBuilder ( KuduScannerBuilder scannerBuilder , EmbeddableType embeddable , Field [ ] fields , MetamodelImpl metaModel , Object key ) { for ( Field f : fields ) { if ( ! ReflectUtils . isTransientOrStatic ( f ) ) { Object value = PropertyAccessorHelper . getObject ( key , f ) ; if ( f ....
Adds the predicates to scanner builder .
35,581
private void populateEmbeddedColumn ( Object entity , RowResult result , EmbeddableType embeddable , MetamodelImpl metaModel ) { Set < Attribute > attributes = embeddable . getAttributes ( ) ; Iterator < Attribute > iterator = attributes . iterator ( ) ; iterateAndPopulateEntity ( entity , result , metaModel , iterator...
Populate embedded column .
35,582
public void deleteByColumn ( String schemaName , String tableName , String columnName , Object columnValue ) { }
Delete by column .
35,583
private void populatePartialRow ( PartialRow row , EntityMetadata entityMetadata , Object entity ) { MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( entityMetadata . getPersistenceUnit ( ) ) ; Class entityClazz = entityMetadata . getEntityClazz ( ) ; EntityType ...
Populate partial row .
35,584
private void populatePartialRowForEmbeddedColumn ( PartialRow row , EmbeddableType embeddable , Object EmbEntity , MetamodelImpl metaModel ) { Set < Attribute > attributes = embeddable . getAttributes ( ) ; Iterator < Attribute > iterator = attributes . iterator ( ) ; iterateAndPopulateRow ( row , EmbEntity , metaModel...
Populate partial row for embedded column .
35,585
private void iterateAndPopulateRow ( PartialRow row , Object entity , MetamodelImpl metaModel , Iterator < Attribute > iterator ) { while ( iterator . hasNext ( ) ) { Attribute attribute = iterator . next ( ) ; Field field = ( Field ) attribute . getJavaMember ( ) ; Object value = PropertyAccessorHelper . getObject ( e...
Iterate and populate row .
35,586
private void addPrimaryKeyToRow ( PartialRow row , EmbeddableType embeddable , Field [ ] fields , MetamodelImpl metaModel , Object key ) { for ( Field f : fields ) { if ( ! ReflectUtils . isTransientOrStatic ( f ) ) { Object value = PropertyAccessorHelper . getObject ( key , f ) ; if ( f . getType ( ) . isAnnotationPre...
Adds the primary key to row .
35,587
public < E > E findById ( final Class < E > entityClass , final Object primaryKey ) { E e = find ( entityClass , primaryKey ) ; if ( e == null ) { return null ; } return ( E ) ( e ) ; }
Find object based on primary key either form persistence cache or from database
35,588
public void remove ( Object e ) { if ( e == null ) { throw new IllegalArgumentException ( "Entity to be removed must not be null." ) ; } EntityMetadata metadata = getMetadata ( e . getClass ( ) ) ; ObjectGraph graph = new GraphGenerator ( ) . generateGraph ( e , this , new ManagedState ( ) ) ; Node node = graph . getHe...
Removes an entity object from persistence cache .
35,589
public void detach ( Object entity ) { Node node = getPersistenceCache ( ) . getMainCache ( ) . getNodeFromCache ( entity , getMetadata ( entity . getClass ( ) ) , this ) ; if ( node != null ) { node . detach ( ) ; } }
Remove the given entity from the persistence context causing a managed entity to become detached .
35,590
boolean contains ( Object entity ) { Node node = getPersistenceCache ( ) . getMainCache ( ) . getNodeFromCache ( entity , getMetadata ( entity . getClass ( ) ) , this ) ; return node != null && node . isInState ( ManagedState . class ) ; }
Check if the instance is a managed entity instance belonging to the current persistence context .
35,591
public void refresh ( Object entity ) { if ( contains ( entity ) ) { MainCache mainCache = ( MainCache ) getPersistenceCache ( ) . getMainCache ( ) ; Node node = mainCache . getNodeFromCache ( entity , getMetadata ( entity . getClass ( ) ) , this ) ; try { lock . readLock ( ) . lock ( ) ; node . setPersistenceDelegator...
Refresh the state of the instance from the database overwriting changes made to the entity if any .
35,592
void populateClientProperties ( Map properties ) { if ( properties != null && ! properties . isEmpty ( ) ) { Map < String , Client > clientMap = getDelegate ( ) ; if ( ! clientMap . isEmpty ( ) ) { for ( Client client : clientMap . values ( ) ) { if ( client instanceof ClientPropertiesSetter ) { ClientPropertiesSetter ...
Populates client specific properties .
35,593
void loadClient ( String persistenceUnit , Client client ) { if ( ! clientMap . containsKey ( persistenceUnit ) && client != null ) { clientMap . put ( persistenceUnit , client ) ; } }
Pre load client specific to persistence unit .
35,594
private void execute ( ) { for ( Client client : clientMap . values ( ) ) { if ( client != null && client instanceof Batcher ) { if ( ( ( Batcher ) client ) . getBatchSize ( ) == 0 || ( ( Batcher ) client ) . executeBatch ( ) > 0 ) { flushJoinTableData ( ) ; } } } }
Executes batch .
35,595
private void flushJoinTableData ( ) { if ( applyFlush ( ) ) { for ( JoinTableData jtData : flushManager . getJoinTableData ( ) ) { if ( ! jtData . isProcessed ( ) ) { EntityMetadata m = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , jtData . getEntityClass ( ) ) ; Client client = getClient ( m ) ; if ( ...
On flushing join table data
35,596
Coordinator getCoordinator ( ) { coordinator = new Coordinator ( ) ; try { for ( String pu : clientMap . keySet ( ) ) { PersistenceUnitMetadata puMetadata = KunderaMetadataManager . getPersistenceUnitMetadata ( kunderaMetadata , pu ) ; String txResource = puMetadata . getProperty ( PersistenceProperties . KUNDERA_TRANS...
Returns transaction coordinator .
35,597
protected void loadClientMetadata ( Map < String , Object > puProperties ) { clientMetadata = new ClientMetadata ( ) ; String luceneDirectoryPath = puProperties != null ? ( String ) puProperties . get ( PersistenceProperties . KUNDERA_INDEX_HOME_DIR ) : null ; String indexerClass = puProperties != null ? ( String ) puP...
Load client metadata .
35,598
public Client getClientInstance ( ) { if ( isThreadSafe ( ) ) { logger . info ( "Returning threadsafe used client instance for persistence unit : " + persistenceUnit ) ; if ( client == null ) { client = instantiateClient ( persistenceUnit ) ; } } else { logger . debug ( "Returning fresh client instance for persistence ...
Gets the client instance .
35,599
private FilterList onFindKeyOnly ( FilterList filterList , boolean isFindKeyOnly ) { if ( isFindKeyOnly ) { if ( filterList == null ) { filterList = new FilterList ( ) ; } filterList . addFilter ( new KeyOnlyFilter ( ) ) ; } return filterList ; }
On find key only .