idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
35,800
private static void onPrintTweets ( final List < Tweets > tweets ) { for ( Iterator < Tweets > iterator = tweets . iterator ( ) ; iterator . hasNext ( ) ; ) { int counter = 1 ; while ( iterator . hasNext ( ) ) { logger . info ( "\n" ) ; logger . info ( "\t\t Tweet No:#" + counter ++ ) ; Tweets rec = ( Tweets ) iterator...
On print tweets event .
35,801
public void addElementCollectionMetadata ( CollectionColumnInfo elementCollectionMetadata ) { if ( this . elementCollectionMetadatas == null ) { this . elementCollectionMetadatas = new ArrayList < CollectionColumnInfo > ( ) ; } if ( ! elementCollectionMetadatas . contains ( elementCollectionMetadata ) ) { elementCollec...
Adds the element collection metadata .
35,802
public void addColumnInfo ( ColumnInfo columnInfo ) { if ( this . columnMetadatas == null ) { this . columnMetadatas = new ArrayList < ColumnInfo > ( ) ; } if ( ! columnMetadatas . contains ( columnInfo ) && ! this . getIdColumnName ( ) . equals ( columnInfo . getColumnName ( ) ) ) { columnMetadatas . add ( columnInfo ...
Adds the column info .
35,803
public void addEmbeddedColumnInfo ( EmbeddedColumnInfo embdColumnInfo ) { if ( this . embeddedColumnMetadatas == null ) { this . embeddedColumnMetadatas = new ArrayList < EmbeddedColumnInfo > ( ) ; } if ( ! embeddedColumnMetadatas . contains ( embdColumnInfo ) ) { embeddedColumnMetadatas . add ( embdColumnInfo ) ; } }
Adds the embedded column info .
35,804
public void addCollectionColumnMetadata ( CollectionColumnInfo collectionColumnMetadata ) { if ( this . collectionColumnMetadatas == null ) { this . collectionColumnMetadatas = new ArrayList < CollectionColumnInfo > ( ) ; } if ( ! collectionColumnMetadatas . contains ( collectionColumnMetadata ) ) { collectionColumnMet...
Adds the collection column metadata .
35,805
public IndexInfo getColumnToBeIndexed ( String columnName ) { IndexInfo idxInfo = new IndexInfo ( columnName ) ; if ( columnToBeIndexed . contains ( idxInfo ) ) { int index = columnToBeIndexed . indexOf ( idxInfo ) ; return getColumnsToBeIndexed ( ) . get ( index ) ; } return idxInfo ; }
Gets the column to be indexed .
35,806
public void addToIndexedColumnList ( IndexInfo indexInfo ) { ColumnInfo columnInfo = new ColumnInfo ( ) ; columnInfo . setColumnName ( indexInfo . getColumnName ( ) ) ; if ( getEmbeddedColumnMetadatas ( ) . isEmpty ( ) || ! getEmbeddedColumnMetadatas ( ) . get ( 0 ) . getColumns ( ) . contains ( columnInfo ) ) { if ( !...
Adds the to indexed column list .
35,807
public final void close ( ) { if ( isOpen ( ) ) { closed = true ; if ( cacheProvider != null ) { cacheProvider . shutdown ( ) ; } for ( String pu : persistenceUnits ) { ( ( ClientLifeCycleManager ) clientFactories . get ( pu ) ) . destroy ( ) ; } this . persistenceUnits = null ; this . properties = null ; clientFactori...
Close the factory releasing any resources that it holds . After a factory instance has been closed all methods invoked on it will throw the IllegalStateException except for isOpen which will return false . Once an EntityManagerFactory has been closed all its entity managers are considered to be in the closed state .
35,808
public final EntityManager createEntityManager ( Map map ) { if ( isOpen ( ) ) { return new EntityManagerImpl ( this , map , transactionType , PersistenceContextType . EXTENDED ) ; } throw new IllegalStateException ( "Entity manager factory has been closed." ) ; }
Create a new application - managed EntityManager with the specified Map of properties . This method returns a new EntityManager instance each time it is invoked . The isOpen method will return true on the returned instance .
35,809
public Metamodel getMetamodel ( ) { if ( isOpen ( ) ) { MetamodelImpl metamodel = null ; for ( String pu : persistenceUnits ) { metamodel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( pu ) ; if ( metamodel != null ) { return metamodel ; } } } throw new IllegalStateException ( "Entity...
Return an instance of Metamodel interface for access to the metamodel of the persistence unit .
35,810
private void configureClientFactories ( ) { ClientMetadataBuilder builder = new ClientMetadataBuilder ( getProperties ( ) , kunderaMetadata , getPersistenceUnits ( ) ) ; builder . buildClientFactoryMetadata ( clientFactories , kunderaMetadata ) ; }
Initialize and load clientFactory for all persistenceUnit with external properties .
35,811
private CacheProvider initSecondLevelCache ( final PersistenceUnitMetadata puMetadata ) { String classResourceName = ( String ) getProperties ( ) . get ( PersistenceProperties . KUNDERA_CACHE_CONFIG_RESOURCE ) ; classResourceName = classResourceName != null ? classResourceName : puMetadata . getProperty ( PersistencePr...
Inits the second level cache .
35,812
public Block getBlockWithTransactions ( BigInteger blockNumber ) { return EtherObjectConverterUtil . convertEtherBlockToKunderaBlock ( client . getBlock ( blockNumber , true ) ) ; }
Gets the block with transactions .
35,813
private boolean ignoreScan ( String intf ) { for ( String ignored : ignoredPackages ) { if ( intf . startsWith ( ignored + "." ) ) { return true ; } } return false ; }
Ignore scan .
35,814
public Query getQueryImplementation ( String jpaQuery , PersistenceDelegator persistenceDelegator , Class mappedClass , boolean isNative , final KunderaMetadata kunderaMetadata ) { if ( jpaQuery == null ) { throw new QueryHandlerException ( "Query String should not be null " ) ; } if ( jpaQuery . trim ( ) . endsWith ( ...
Gets the query implementation .
35,815
private void addColumnFamilyToTable ( String tableName , String columnFamilyName ) throws IOException { HColumnDescriptor cfDesciptor = new HColumnDescriptor ( columnFamilyName ) ; try { if ( admin . tableExists ( tableName ) ) { if ( ! admin . isTableEnabled ( tableName ) ) { admin . enableTable ( tableName ) ; } HTab...
Adds the column family to table .
35,816
private void setHBaseDataIntoObject ( String columnName , byte [ ] columnValue , Map < String , Field > columnNameToFieldMap , Object columnFamilyObj , boolean isEmbeddeble ) throws PropertyAccessException { String qualifier = columnName . substring ( columnName . indexOf ( "#" ) + 1 , columnName . lastIndexOf ( "#" ) ...
Sets the h base data into object .
35,817
private void configureClientProperties ( PersistenceUnitMetadata puMetadata ) { SparkSchemaMetadata metadata = SparkPropertyReader . ssmd ; ClientProperties cp = metadata != null ? metadata . getClientProperties ( ) : null ; if ( cp != null ) { DataStore dataStore = metadata != null ? metadata . getDataStore ( puMetada...
Configure client properties .
35,818
public void setColumns ( List < Cell > columns ) { for ( Cell column : columns ) { putColumn ( CellUtil . cloneFamily ( column ) , CellUtil . cloneQualifier ( column ) , CellUtil . cloneValue ( column ) ) ; } }
Sets the columns .
35,819
private void putColumn ( byte [ ] family , byte [ ] qualifier , byte [ ] qualifierValue ) { this . columns . put ( Bytes . toString ( family ) + ":" + Bytes . toString ( qualifier ) , qualifierValue ) ; }
Put column .
35,820
public final Node buildNode ( Object entity , PersistenceDelegator pd , Object entityId , NodeState nodeState ) { String nodeId = ObjectGraphUtils . getNodeId ( entityId , entity . getClass ( ) ) ; Node node = this . graph . getNode ( nodeId ) ; if ( node != null ) { if ( this . generator . traversedNodes . contains ( ...
On build node .
35,821
RelationBuilder getRelationBuilder ( Object target , Relation relation , Node source ) { RelationBuilder relationBuilder = new RelationBuilder ( target , relation , source ) ; relationBuilder . assignGraphGenerator ( this . generator ) ; return relationBuilder ; }
Returns relation builder instance .
35,822
public < E > List < E > findData ( EntityMetadata m , Object rowKey , byte [ ] startRow , byte [ ] endRow , List < Map < String , Object > > columnsToOutput , Filter filters ) { String tableName = HBaseUtils . getHTableName ( m . getSchema ( ) , m . getTableName ( ) ) ; FilterList filterList = getFilterList ( filters )...
Find data .
35,823
private FilterList getFilterList ( Filter filters ) { FilterList filterList = null ; if ( filters != null ) { if ( FilterList . class . isAssignableFrom ( filters . getClass ( ) ) ) { filterList = ( FilterList ) filters ; } else { filterList = new FilterList ( ) ; filterList . addFilter ( filters ) ; } } return filterL...
Gets the filter list .
35,824
protected void addToRelationStack ( Map < Object , Object > relationStack , Object entity , EntityMetadata m ) { Object obj = entity ; if ( entity instanceof EnhanceEntity ) { obj = ( ( EnhanceEntity ) entity ) . getEntity ( ) ; } relationStack . put ( obj . getClass ( ) . getCanonicalName ( ) + "#" + PropertyAccessorH...
Adds the to relation stack .
35,825
private List < Object > populateEmbeddedIdUsingLucene ( EntityMetadata m , Client client , List < Object > result , Map < String , Object > searchFilter , MetamodelImpl metaModel ) { List < Object > compositeIds = new ArrayList < Object > ( ) ; for ( String compositeIdName : searchFilter . keySet ( ) ) { Object composi...
Populate using lucene for embeddeId .
35,826
private Object prepareCompositeIdObject ( final SingularAttribute attribute , Object compositeId , Map < String , String > uniquePKs , MetamodelImpl metaModel ) { Field [ ] fields = attribute . getBindableJavaType ( ) . getDeclaredFields ( ) ; EmbeddableType embeddable = metaModel . embeddable ( attribute . getBindable...
Prepare composite id object .
35,827
private List < Object > findUsingLucene ( EntityMetadata m , Client client , Object [ ] primaryKeys ) { String idField = m . getIdAttribute ( ) . getName ( ) ; String equals = "=" ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; E...
find data using lucene .
35,828
protected List < Object > populateUsingLucene ( EntityMetadata m , Client client , List < Object > result , String [ ] columnsToSelect ) { Set < Object > uniquePKs = null ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; if ( clien...
Populate using lucene .
35,829
private List populateUsingElasticSearch ( Client client , EntityMetadata m ) { Map < String , Object > searchFilter = client . getIndexManager ( ) . search ( kunderaMetadata , kunderaQuery , persistenceDelegeator , m , this . firstResult , this . maxResult ) ; Object [ ] primaryKeys = ( ( Map < String , Object > ) sear...
Populate using elastic search .
35,830
private void populateGroupByResponse ( Map < String , Object > aggregations , Iterable < Expression > resultOrderIterable , List < Object > results , Client client , EntityMetadata m ) { List temp ; Object entity = null ; for ( String entry : aggregations . keySet ( ) ) { entity = null ; Object obj = aggregations . get...
Populate group by response .
35,831
private Object getEntityFieldValue ( EntityMetadata entityMetadata , Object entity , String field ) { Class clazz = entityMetadata . getEntityClazz ( ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( entityMetadata . getPersistenceUnit ( ) ) ; EntityType entit...
Gets the entity field value .
35,832
protected int onUpdateDeleteEvent ( ) { if ( kunderaQuery . isDeleteUpdate ( ) ) { List result = fetch ( ) ; onDeleteOrUpdate ( result ) ; return result != null ? result . size ( ) : 0 ; } return 0 ; }
On update delete event .
35,833
protected void onDeleteOrUpdate ( List results ) { if ( results != null ) { if ( ! kunderaQuery . isUpdateClause ( ) ) { for ( Object result : results ) { PersistenceCacheManager . addEntityToPersistenceCache ( result , persistenceDelegeator , PropertyAccessorHelper . getId ( result , this . getEntityMetadata ( ) ) ) ;...
Performs delete or update based on query .
35,834
private Parameter getParameterByName ( String name ) { if ( getParameters ( ) != null ) { for ( Parameter p : parameters ) { if ( name . equals ( p . getName ( ) ) ) { return p ; } } } return null ; }
Returns specific parameter instance for given name .
35,835
private Parameter getParameterByOrdinal ( Integer position ) { for ( Parameter p : parameters ) { if ( position . equals ( p . getPosition ( ) ) ) { return p ; } } return null ; }
Returns parameter by ordinal .
35,836
private List < Object > onParameterValue ( String paramString ) { List < Object > value = kunderaQuery . getClauseValue ( paramString ) ; if ( value == null ) { throw new IllegalStateException ( "parameter has not been bound" + paramString ) ; } return value ; }
Returns parameter value .
35,837
protected void handlePostEvent ( ) { EntityMetadata metadata = getEntityMetadata ( ) ; if ( ! kunderaQuery . isDeleteUpdate ( ) ) { persistenceDelegeator . getEventDispatcher ( ) . fireEventListeners ( metadata , null , PostLoad . class ) ; } }
Handle post event callbacks .
35,838
protected List fetch ( ) { EntityMetadata metadata = getEntityMetadata ( ) ; Client client = persistenceDelegeator . getClient ( metadata ) ; List results = isRelational ( metadata ) ? recursivelyPopulateEntities ( metadata , client ) : populateEntities ( metadata , client ) ; return results ; }
Returns collection of fetched entities .
35,839
protected void onValidateSingleResult ( List results ) { if ( results == null || results . isEmpty ( ) ) { log . error ( "No result found for {} " , kunderaQuery . getJPAQuery ( ) ) ; throw new NoResultException ( "No result found!" ) ; } if ( results . size ( ) > 1 ) { log . error ( "Non unique results found for query...
On validate single result .
35,840
private void assignReferenceToProxy ( List results ) { if ( results != null ) { for ( Object obj : results ) { kunderaMetadata . getCoreMetadata ( ) . getLazyInitializerFactory ( ) . setProxyOwners ( getEntityMetadata ( ) , obj ) ; } } }
If returned collection of object holds a reference to .
35,841
public static Map < String , String > populatePersistenceUnitProperties ( PropertyReader reader ) { String dbType = reader . getProperty ( EthConstants . DATABASE_TYPE ) ; String host = reader . getProperty ( EthConstants . DATABASE_HOST ) ; String port = reader . getProperty ( EthConstants . DATABASE_PORT ) ; String d...
Populate persistence unit properties .
35,842
private static void propertyNullCheck ( String dbType , String host , String port , String dbName ) { if ( dbType == null || dbType . isEmpty ( ) ) { LOGGER . error ( "Property '" + EthConstants . DATABASE_TYPE + "' can't be null or empty" ) ; throw new KunderaException ( "Property '" + EthConstants . DATABASE_TYPE + "...
Property null check .
35,843
private static String getKunderaClientToLookupClass ( String client ) { Datasource datasource ; try { datasource = Datasource . valueOf ( client . toUpperCase ( ) ) ; } catch ( IllegalArgumentException ex ) { LOGGER . error ( client + " is not supported!" , ex ) ; throw new KunderaException ( client + " is not supporte...
Gets the kundera client to lookup class .
35,844
public static void set ( Object target , Field field , Object value ) { if ( target != null ) { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; } try { field . set ( target , value ) ; } catch ( IllegalArgumentException iarg ) { throw new PropertyAccessException ( iarg ) ; } catch ( IllegalAccessEx...
Sets an object onto a field .
35,845
public static Object getObject ( Object from , Field field ) { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; } try { return field . get ( from ) ; } catch ( IllegalArgumentException iarg ) { throw new PropertyAccessException ( iarg ) ; } catch ( IllegalAccessException iacc ) { throw new PropertyA...
Gets object from field .
35,846
public static Object getObjectCopy ( Object from , Field field ) { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; } try { PropertyAccessor < ? > accessor = PropertyAccessorFactory . getPropertyAccessor ( field ) ; return accessor . getCopy ( field . get ( from ) ) ; } catch ( IllegalArgumentExcept...
Retutrns copy of object
35,847
public static byte [ ] get ( Object from , Field field ) { PropertyAccessor < ? > accessor = PropertyAccessorFactory . getPropertyAccessor ( field ) ; return accessor . toBytes ( getObject ( from , field ) ) ; }
Gets field value as byte - array .
35,848
@ SuppressWarnings ( "null" ) public static final Object getObject ( Object obj , String fieldName ) { Field embeddedField ; try { embeddedField = obj . getClass ( ) . getDeclaredField ( fieldName ) ; if ( embeddedField != null ) { if ( ! embeddedField . isAccessible ( ) ) { embeddedField . setAccessible ( true ) ; } O...
Gets the embedded object .
35,849
public static Field [ ] getDeclaredFields ( Field relationalField ) { Field [ ] fields ; if ( isCollection ( relationalField . getType ( ) ) ) { fields = PropertyAccessorHelper . getGenericClass ( relationalField ) . getDeclaredFields ( ) ; } else { fields = relationalField . getType ( ) . getDeclaredFields ( ) ; } ret...
Gets the declared fields .
35,850
private static Class < ? > toClass ( Type o ) { if ( o instanceof GenericArrayType ) { Class clazz = Array . newInstance ( toClass ( ( ( GenericArrayType ) o ) . getGenericComponentType ( ) ) , 0 ) . getClass ( ) ; return clazz ; } return ( Class < ? > ) o ; }
Borrowed from java . lang . class
35,851
private static Class < ? > getTypedClass ( java . lang . reflect . Type type ) { if ( type instanceof Class ) { return ( ( Class ) type ) ; } else if ( type instanceof ParameterizedType ) { java . lang . reflect . Type rawParamterizedType = ( ( ParameterizedType ) type ) . getRawType ( ) ; return getTypedClass ( rawPar...
Gets the typed class .
35,852
public final void remove ( EntityMetadata metadata , Object entity , Object key ) { if ( indexer != null ) { if ( indexer . getClass ( ) . getName ( ) . equals ( IndexingConstants . LUCENE_INDEXER ) ) { ( ( com . impetus . kundera . index . lucene . Indexer ) indexer ) . unindex ( metadata , key , kunderaMetadata , nul...
Removes an object from Index .
35,853
public final void write ( EntityMetadata metadata , Object entity ) { if ( indexer != null ) { MetamodelImpl metamodel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( metadata . getPersistenceUnit ( ) ) ; ( ( com . impetus . kundera . index . lucene . Indexer ) indexer ) . index ( meta...
Indexes an object .
35,854
private static boolean compareOrdered ( DualKey dualKey , LinkedList < DualKey > stack , Collection visited ) { Collection col1 = ( Collection ) dualKey . _key1 ; Collection col2 = ( Collection ) dualKey . _key2 ; if ( ProxyHelper . isProxyCollection ( col1 ) || ProxyHelper . isProxyCollection ( col2 ) ) { return false...
Compare two Collections that must be same length and in same order .
35,855
private static boolean compareUnordered ( Collection col1 , Collection col2 , Set visited ) { if ( ProxyHelper . isProxyCollection ( col1 ) || ProxyHelper . isProxyCollection ( col2 ) ) { return false ; } if ( col1 . size ( ) != col2 . size ( ) ) { return false ; } int h1 = deepHashCode ( col1 ) ; int h2 = deepHashCode...
Deeply compare the two sets referenced by dualKey . This method attempts to quickly determine inequality by length then hash and finally does a deepEquals on each element if the two Sets passed by the prior tests .
35,856
@ SuppressWarnings ( "unchecked" ) protected < T > T lookup ( Class < T > entityClass , Object id ) { String key = cacheKey ( entityClass , id ) ; LOG . debug ( "Reading from L1 >> " + key ) ; T o = ( T ) sessionCache . get ( key ) ; if ( o == null ) { LOG . debug ( "Reading from L2 >> " + key ) ; Cache c = ( Cache ) g...
Find in cache .
35,857
protected void store ( Object id , Object entity ) { store ( id , entity , Boolean . TRUE ) ; }
Store in L1 only .
35,858
protected void store ( Object id , Object entity , boolean spillOverToL2 ) { String key = cacheKey ( entity . getClass ( ) , id ) ; LOG . debug ( "Writing to L1 >> " + key ) ; sessionCache . put ( key , entity ) ; if ( spillOverToL2 ) { LOG . debug ( "Writing to L2 >>" + key ) ; Cache c = ( Cache ) getL2Cache ( ) ; if ...
Save to cache .
35,859
protected < T > void remove ( Class < T > entityClass , Object id , boolean spillOverToL2 ) { String key = cacheKey ( entityClass , id ) ; LOG . debug ( "Removing from L1 >> " + key ) ; Object o = sessionCache . remove ( key ) ; if ( spillOverToL2 ) { LOG . debug ( "Removing from L2 >> " + key ) ; Cache c = ( Cache ) g...
Removes the from cache .
35,860
public void persist ( Node node ) { Object entity = node . getData ( ) ; Object id = node . getEntityId ( ) ; EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , node . getDataClass ( ) ) ; isUpdate = node . isUpdate ( ) ; List < RelationHolder > relationHolders = getRelationHolders...
Method to handle
35,861
private void buildEntityFromCursor ( Object entity , HashMap obj , EntityType entityType ) { Iterator < Attribute > iter = entityType . getAttributes ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { Attribute attribute = iter . next ( ) ; Field field = ( Field ) attribute . getJavaMember ( ) ; if ( field . isAnnotat...
Builds the entity from cursor .
35,862
public static ReqlFunction1 buildFunction ( final String colName , final Object obj , final String identifier ) { return new ReqlFunction1 ( ) { public Object apply ( ReqlExpr row ) { switch ( identifier ) { case "<" : return row . g ( colName ) . lt ( obj ) ; case "<=" : return row . g ( colName ) . le ( obj ) ; case ...
Builds the function .
35,863
public static final boolean checkIfZero ( String value , Class valueClazz ) { boolean returnValue = false ; if ( value != null && NumberUtils . isNumber ( value ) && numberTypes . get ( valueClazz ) != null ) { switch ( numberTypes . get ( valueClazz ) ) { case INTEGER : returnValue = Integer . parseInt ( value ) == ( ...
Check if zero
35,864
static Map < String , DBObject > getDocumentFromObject ( Metamodel metaModel , Object obj , Set < Attribute > columns , String tableName ) throws PropertyAccessException { Map < String , DBObject > embeddedObjects = new HashMap < String , DBObject > ( ) ; for ( Attribute column : columns ) { String collectionName = ( (...
Creates a MongoDB document object wrt a given Java object . columns in the document correspond Columns provided as List .
35,865
static BasicDBObject [ ] getDocumentListFromCollection ( Metamodel metaModel , Collection coll , Set < Attribute > columns , String tableName ) throws PropertyAccessException { BasicDBObject [ ] dBObjects = new BasicDBObject [ coll . size ( ) ] ; int count = 0 ; for ( Object o : coll ) { dBObjects [ count ] = ( BasicDB...
Creates a MongoDB document list from a given java collection . columns in the document correspond Columns provided as List .
35,866
static void extractFieldValue ( Object entity , DBObject dbObj , Attribute column ) throws PropertyAccessException { try { Object valueObject = PropertyAccessorHelper . getObject ( entity , ( Field ) column . getJavaMember ( ) ) ; if ( valueObject != null ) { Class javaType = column . getJavaType ( ) ; switch ( Attribu...
Extract entity field .
35,867
private JsonObject iterateAndPopulateJsonObject ( Object entity , Iterator < Attribute > iterator , String tableName ) { JsonObject obj = JsonObject . create ( ) ; while ( iterator . hasNext ( ) ) { Attribute attribute = iterator . next ( ) ; Field field = ( Field ) attribute . getJavaMember ( ) ; Object value = Proper...
Iterate and populate json object .
35,868
public static boolean hasInterface ( Class < ? > has , Class < ? > in ) { if ( has . equals ( in ) ) { return true ; } boolean match = false ; for ( Class < ? > intrface : in . getInterfaces ( ) ) { if ( intrface . getInterfaces ( ) . length > 0 ) { match = hasInterface ( has , intrface ) ; } else { match = intrface . ...
Checks for interface has in class in .
35,869
public static Type [ ] getTypeArguments ( Field property ) { Type type = property . getGenericType ( ) ; if ( type instanceof ParameterizedType ) { return ( ( ParameterizedType ) type ) . getActualTypeArguments ( ) ; } return null ; }
Gets the type arguments .
35,870
public static boolean hasSuperClass ( Class < ? > has , Class < ? > in ) { if ( in . equals ( has ) ) { return true ; } boolean match = false ; if ( in . getSuperclass ( ) != null && in . getSuperclass ( ) . equals ( Object . class ) ) { return match ; } match = in . getSuperclass ( ) != null ? hasSuperClass ( has , in...
Checks for super has in class in .
35,871
public static Class < ? > classForName ( String className , ClassLoader classLoader ) { try { Class < ? > c = null ; try { c = Class . forName ( className , true , ReflectUtils . class . getClassLoader ( ) ) ; } catch ( ClassNotFoundException e ) { try { c = Class . forName ( className ) ; } catch ( ClassNotFoundExcept...
Loads class with className using classLoader .
35,872
public static Class < ? > stripEnhancerClass ( Class < ? > c ) { String className = c . getName ( ) ; int enhancedIndex = className . indexOf ( "$$EnhancerByCGLIB" ) ; if ( enhancedIndex != - 1 ) { className = className . substring ( 0 , enhancedIndex ) ; } if ( className . equals ( c . getName ( ) ) ) { return c ; } e...
Strip enhancer class .
35,873
public void saveLOBFile ( Key key , File lobFile ) { try { FileInputStream fis = new FileInputStream ( lobFile ) ; Version version = kvStore . putLOB ( key , fis , client . getDurability ( ) , client . getTimeout ( ) , client . getTimeUnit ( ) ) ; } catch ( FileNotFoundException e ) { log . warn ( "Unable to find file ...
Saves LOB file to Oracle KV Store
35,874
public Map < Object , Map < Object , String > > getElementCollectionCache ( ) { if ( this . elementCollectionCache == null ) { this . elementCollectionCache = new HashMap < Object , Map < Object , String > > ( ) ; } return this . elementCollectionCache ; }
Gets the element collection cache .
35,875
public void addElementCollectionCacheMapping ( Object rowKey , Object elementCollectionObject , String elementCollObjectName ) { Map embeddedObjectMap = new HashMap < Object , String > ( ) ; if ( getElementCollectionCache ( ) . get ( rowKey ) == null ) { embeddedObjectMap . put ( elementCollectionObject , elementCollOb...
Adds the element collection cache mapping .
35,876
public String getElementCollectionObjectName ( Object rowKey , Object elementCollectionObject ) { if ( getElementCollectionCache ( ) . isEmpty ( ) || getElementCollectionCache ( ) . get ( rowKey ) == null ) { log . debug ( "No element collection object map found in cache for Row key " + rowKey ) ; return null ; } else ...
Gets the element collection object name .
35,877
public int getLastElementCollectionObjectCount ( Object rowKey ) { if ( getElementCollectionCache ( ) . get ( rowKey ) == null ) { log . debug ( "No element collection object map found in cache for Row key " + rowKey ) ; return - 1 ; } else { Map < Object , String > elementCollectionMap = getElementCollectionCache ( ) ...
Gets the last element collection object count .
35,878
public List < GridFSDBFile > find ( final DBObject query , final DBObject sort , final int firstResult , final int maxResult ) { List < GridFSDBFile > files = new ArrayList < GridFSDBFile > ( ) ; DBCursor c = null ; try { c = getFilesCollection ( ) . find ( query ) ; if ( sort != null ) { c . sort ( sort ) ; } c . skip...
Finds a list of files matching the given query .
35,879
public static ClientFactory getClientFactory ( String persistenceUnit , Map < String , Object > puProperties , final KunderaMetadata kunderaMetadata ) { ClientFactory clientFactory = instantiateClientFactory ( persistenceUnit , puProperties , kunderaMetadata ) ; clientFactories . put ( persistenceUnit , clientFactory )...
Gets the client factory .
35,880
private static ClientFactory instantiateClientFactory ( String persistenceUnit , Map < String , Object > puProperties , final KunderaMetadata kunderaMetadata ) { ClientFactory clientFactory = null ; logger . info ( "Initializing client factory for: " + persistenceUnit ) ; PersistenceUnitMetadata persistenceUnitMetadata...
Creates new instance of client factory for given persistence unit .
35,881
protected boolean isCappedCollection ( TableInfo tableInfo ) { return MongoDBPropertyReader . msmd != null ? MongoDBPropertyReader . msmd . isCappedCollection ( databaseName , tableInfo . getTableName ( ) ) : false ; }
Checks whether the given table is a capped collection
35,882
private void onValidateEmbeddable ( Object embeddedObject , EmbeddableType embeddedColumn ) { if ( embeddedObject instanceof Collection ) { for ( Object obj : ( Collection ) embeddedObject ) { for ( Object column : embeddedColumn . getAttributes ( ) ) { Attribute columnAttribute = ( Attribute ) column ; Field f = ( Fie...
Checks constraints present on embeddable attributes
35,883
public static SparkDataClient getDataClient ( String clientName ) { if ( clientPool . get ( clientName ) != null ) { return clientPool . get ( clientName ) ; } try { SparkDataClient dataClient = ( SparkDataClient ) KunderaCoreUtils . createNewInstance ( Class . forName ( clientNameToClass . get ( clientName ) ) ) ; cli...
Gets the data client .
35,884
private boolean validateSize ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } int objectSize = 0 ; int minSize = ( ( Size ) annotate ) . min ( ) ; int maxSize = ( ( Size ) annotate ) . max ( ) ; if ( validationObject != null ) { if ( String . class . isAs...
Checks whether the given attribute s value is within specified limit
35,885
private boolean validatePattern ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } java . util . regex . Pattern pattern = java . util . regex . Pattern . compile ( ( ( Pattern ) annotate ) . regexp ( ) , ( ( Pattern ) annotate ) . flags ( ) . length ) ; Ma...
Checks whether the given string is a valid pattern or not
35,886
private boolean validatePast ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } int res = 0 ; if ( validationObject . getClass ( ) . isAssignableFrom ( java . util . Date . class ) ) { Date today = new Date ( ) ; Date pastDate = ( Date ) validationObject ; ...
Checks whether the object is null or not
35,887
private boolean validateFuture ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } int res = 0 ; if ( validationObject . getClass ( ) . isAssignableFrom ( java . util . Date . class ) ) { Date today = new Date ( ) ; Date futureDate = ( Date ) validationObjec...
Checks whether a given date is that in future or not
35,888
private boolean validateNull ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } if ( ! validationObject . equals ( null ) || validationObject != null ) { throwValidationException ( ( ( Null ) annotate ) . message ( ) ) ; } return true ; }
Checks whether a given date is that in past or not
35,889
private boolean validateMinValue ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } Long minValue = ( ( Min ) annotate ) . value ( ) ; if ( checkvalidDigitTypes ( validationObject . getClass ( ) ) ) { if ( ( NumberUtils . toLong ( toString ( validationObjec...
Checks whether a given value is greater than given min value or not
35,890
private boolean validateMaxValue ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } Long maxValue = ( ( Max ) annotate ) . value ( ) ; if ( checkvalidDigitTypes ( validationObject . getClass ( ) ) ) { if ( ( NumberUtils . toLong ( toString ( validationObjec...
Checks whether a given value is lesser than given max value or not
35,891
private boolean validateDigits ( Object validationObject , Annotation annotate ) { if ( checkNullObject ( validationObject ) ) { return true ; } if ( checkvalidDigitTypes ( validationObject . getClass ( ) ) ) { if ( ! NumberUtils . isDigits ( toString ( validationObject ) ) ) { throwValidationException ( ( ( Digits ) a...
Checks whether a given value is is a number or not
35,892
private boolean validateMinDecimal ( Object validationObject , Annotation annotate ) { if ( validationObject != null ) { try { if ( checkvalidDeciDigitTypes ( validationObject . getClass ( ) ) ) { BigDecimal minValue = NumberUtils . createBigDecimal ( ( ( DecimalMin ) annotate ) . value ( ) ) ; BigDecimal actualValue =...
Checks whether a given value is a valid minimum decimal digit when compared to given value or not
35,893
private boolean validateMaxDecimal ( Object validationObject , Annotation annotate ) { if ( validationObject != null ) { try { if ( checkvalidDeciDigitTypes ( validationObject . getClass ( ) ) ) { BigDecimal maxValue = NumberUtils . createBigDecimal ( ( ( DecimalMax ) annotate ) . value ( ) ) ; BigDecimal actualValue =...
Checks whether a given value is a valid maximum decimal digit when compared to given value or not
35,894
public static Date getDateByPattern ( String date ) { if ( StringUtils . isNumeric ( date ) ) { return new Date ( Long . parseLong ( date ) ) ; } for ( String p : patterns ) { try { DateFormat formatter = new SimpleDateFormat ( p ) ; Date dt = formatter . parse ( date ) ; return dt ; } catch ( IllegalArgumentException ...
Get Date from given below formats .
35,895
public static String getFormattedObect ( String date ) { return date != null ? getDateByPattern ( date ) . toString ( ) : null ; }
Just to verify with supported types of date pattern . Get Date from given below formats
35,896
public Map < String , Object > getRelations ( ) { return relations != null ? Collections . unmodifiableMap ( relations ) : null ; }
Gets the relations .
35,897
private HostFailoverPolicy getFailoverPolicy ( String failoverOption ) { if ( failoverOption != null ) { if ( Constants . FAIL_FAST . equals ( failoverOption ) ) { return HostFailoverPolicy . FAIL_FAST ; } else if ( Constants . ON_FAIL_TRY_ALL_AVAILABLE . equals ( failoverOption ) ) { return HostFailoverPolicy . ON_FAI...
Resolve failover policy for Cassandra thrift .
35,898
public static String generatePoolName ( String node , int port , String keyspace ) { return node + ":" + port + ":" + keyspace ; }
Generate pool name .
35,899
public static SimpleConnectionAuthenticator getAuthenticationRequest ( String userName , String password ) { SimpleConnectionAuthenticator authenticator = null ; if ( userName != null || password != null ) { authenticator = new SimpleConnectionAuthenticator ( userName , password ) ; } return authenticator ; }
If userName and password provided Method prepares for AuthenticationRequest .