idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
35,700 | public static KunderaProxy getProxy ( final String entityName , final Class < ? > persistentClass , final Class < ? > [ ] interfaces , final Method getIdentifierMethod , final Method setIdentifierMethod , final Object id , final PersistenceDelegator pd ) throws PersistenceException { final CglibLazyInitializer instance... | Gets the proxy . |
35,701 | private static KunderaProxy getProxyInstance ( Class factory , CglibLazyInitializer instance ) { KunderaProxy proxy ; try { Enhancer . registerCallbacks ( factory , new Callback [ ] { instance , null } ) ; proxy = ( KunderaProxy ) factory . newInstance ( ) ; } catch ( IllegalAccessException e ) { throw new LazyInitiali... | Gets the proxy instance . |
35,702 | public static Class getProxyFactory ( Class persistentClass , Class [ ] interfaces ) throws PersistenceException { Enhancer e = new Enhancer ( ) ; e . setSuperclass ( interfaces . length == 1 ? persistentClass : null ) ; e . setInterfaces ( interfaces ) ; e . setCallbackTypes ( new Class [ ] { InvocationHandler . class... | Gets the proxy factory . |
35,703 | public static boolean isFindKeyOnly ( EntityMetadata metadata , List < Map < String , Object > > colToOutput ) { if ( colToOutput != null && colToOutput . size ( ) == 1 ) { String idCol = ( ( AbstractAttribute ) metadata . getIdAttribute ( ) ) . getJPAColumnName ( ) ; return idCol . equals ( colToOutput . get ( 0 ) . g... | Checks if is find key only . |
35,704 | private Object findGFSEntity ( EntityMetadata entityMetadata , Class entityClass , Object key ) { GridFSDBFile outputFile = findGridFSDBFile ( entityMetadata , key ) ; return outputFile != null ? handler . getEntityFromGFSDBFile ( entityMetadata . getEntityClazz ( ) , instantiateEntity ( entityClass , null ) , entityMe... | Find GFS entity . |
35,705 | private GridFSDBFile findGridFSDBFile ( EntityMetadata entityMetadata , Object key ) { String id = ( ( AbstractAttribute ) entityMetadata . getIdAttribute ( ) ) . getJPAColumnName ( ) ; DBObject query = new BasicDBObject ( "metadata." + id , key ) ; KunderaGridFS gfs = new KunderaGridFS ( mongoDb , entityMetadata . get... | Find GRIDFSDBFile . |
35,706 | private < E > List < E > loadQueryDataGFS ( EntityMetadata entityMetadata , BasicDBObject mongoQuery , BasicDBObject orderBy , int maxResult , int firstResult , boolean isCountQuery ) { List < GridFSDBFile > gfsDBfiles = getGFSDBFiles ( mongoQuery , orderBy , entityMetadata . getTableName ( ) , maxResult , firstResult ... | Load query data gfs . |
35,707 | private < E > List < E > loadQueryData ( EntityMetadata entityMetadata , BasicDBObject mongoQuery , BasicDBObject orderBy , int maxResult , int firstResult , boolean isCountQuery , BasicDBObject keys , String ... results ) throws InstantiationException , IllegalAccessException { String documentName = entityMetadata . g... | Load query data . |
35,708 | private void populateGFSEntity ( EntityMetadata entityMetadata , List entities , GridFSDBFile gfsDBFile ) { Object entity = instantiateEntity ( entityMetadata . getEntityClazz ( ) , null ) ; handler . getEntityFromGFSDBFile ( entityMetadata . getEntityClazz ( ) , entity , entityMetadata , gfsDBFile , kunderaMetadata ) ... | Populate gfs entity . |
35,709 | public Object getDBCursorInstance ( BasicDBObject mongoQuery , BasicDBObject orderBy , int maxResult , int firstResult , BasicDBObject keys , String documentName , boolean isCountQuery ) { DBCollection dbCollection = mongoDb . getCollection ( documentName ) ; DBCursor cursor = null ; if ( isCountQuery ) return dbCollec... | Gets the DB cursor instance . |
35,710 | private List < GridFSDBFile > getGFSDBFiles ( BasicDBObject mongoQuery , BasicDBObject sort , String collectionName , int maxResult , int firstResult ) { KunderaGridFS gfs = new KunderaGridFS ( mongoDb , collectionName ) ; return gfs . find ( mongoQuery , sort , firstResult , maxResult ) ; } | Gets the GFSDB files . |
35,711 | public List < Object > findByRelation ( String colName , Object colValue , Class entityClazz ) { EntityMetadata m = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClazz ) ; DBCollection dbCollection = mongoDb . getCollection ( m . getTableName ( ) ) ; BasicDBObject query = new BasicDBObject ( ) ; ... | Method to find entity for given association name and association value . |
35,712 | private void saveGridFSFile ( GridFSInputFile gfsInputFile , EntityMetadata m ) { try { DBCollection coll = mongoDb . getCollection ( m . getTableName ( ) + MongoDBUtils . FILES ) ; createUniqueIndexGFS ( coll , ( ( AbstractAttribute ) m . getIdAttribute ( ) ) . getJPAColumnName ( ) ) ; gfsInputFile . save ( ) ; log . ... | Save GRID FS file . |
35,713 | private void onPersistGFS ( Object entity , Object entityId , EntityMetadata entityMetadata , boolean isUpdate ) { KunderaGridFS gfs = new KunderaGridFS ( mongoDb , entityMetadata . getTableName ( ) ) ; if ( ! isUpdate ) { GridFSInputFile gfsInputFile = handler . getGFSInputFileFromEntity ( gfs , entityMetadata , entit... | On persist GFS . |
35,714 | private void onFlushBatch ( Map < String , BulkWriteOperation > bulkWriteOperationMap ) { if ( ! bulkWriteOperationMap . isEmpty ( ) ) { for ( BulkWriteOperation builder : bulkWriteOperationMap . values ( ) ) { try { builder . execute ( getWriteConcern ( ) ) ; } catch ( BulkWriteException bwex ) { log . error ( "Batch ... | On flush batch . |
35,715 | private void onFlushCollection ( Map < String , List < DBObject > > collections ) { for ( String tableName : collections . keySet ( ) ) { DBCollection dbCollection = mongoDb . getCollection ( tableName ) ; KunderaCoreUtils . printQuery ( "Persist collection:" + tableName , showQuery ) ; try { dbCollection . insert ( co... | On collections flush . |
35,716 | private Map < String , List < DBObject > > onPersist ( Map < String , List < DBObject > > collections , Object entity , Object id , EntityMetadata metadata , List < RelationHolder > relationHolders , boolean isUpdate ) { persistenceUnit = metadata . getPersistenceUnit ( ) ; Map < String , DBObject > documents = handler... | Executes on list of entities to be persisted . |
35,717 | public Object executeScript ( String script ) { Object result = mongoDb . eval ( script ) ; KunderaCoreUtils . printQuery ( "Execute mongo jscripts:" + script , showQuery ) ; return result ; } | Method to execute mongo jscripts . |
35,718 | private MapReduceCommand parseMapReduceCommand ( String jsonClause ) { String collectionName = jsonClause . replaceFirst ( "(?ms).*?\\.\\s*(.+?)\\s*\\.\\s*mapReduce\\s*\\(.*" , "$1" ) ; if ( collectionName . contains ( "getCollection" ) ) { collectionName = collectionName . replaceFirst ( ".*getCollection\\s*\\(\\s*(['... | Parses the map reduce command . |
35,719 | private String findCommaSeparatedArgument ( String functionBody , int index ) { int start = 0 ; int found = - 1 ; int brackets = 0 ; int pos = 0 ; int length = functionBody . length ( ) ; while ( found < index && pos < length ) { char ch = functionBody . charAt ( pos ) ; switch ( ch ) { case ',' : if ( brackets == 0 ) ... | Find comma separated argument . |
35,720 | private DBCursor parseAndScroll ( String jsonClause , String collectionName ) throws JSONParseException { BasicDBObject clause = ( BasicDBObject ) JSON . parse ( jsonClause ) ; DBCursor cursor = mongoDb . getCollection ( collectionName ) . find ( clause ) ; return cursor ; } | Parses the and scroll . |
35,721 | public int handleUpdateFunctions ( BasicDBObject query , BasicDBObject update , String collName ) { DBCollection collection = mongoDb . getCollection ( collName ) ; KunderaCoreUtils . printQuery ( "Update collection:" + query , showQuery ) ; WriteResult result = null ; try { result = collection . update ( query , updat... | Handle update functions . |
35,722 | private void createUniqueIndexGFS ( DBCollection coll , String id ) { try { coll . createIndex ( new BasicDBObject ( "metadata." + id , 1 ) , new BasicDBObject ( "unique" , true ) ) ; } catch ( MongoException ex ) { throw new KunderaException ( "Error in creating unique indexes in " + coll . getFullName ( ) + " collect... | Creates the unique index gfs . |
35,723 | public static Bucket openBucket ( CouchbaseCluster cluster , String name , String password ) { if ( cluster == null ) { throw new KunderaException ( "CouchbaseCluster object can't be null" ) ; } try { Bucket bucket ; if ( password != null && ! password . trim ( ) . isEmpty ( ) ) { bucket = cluster . openBucket ( name ,... | Open bucket . |
35,724 | public static void closeBucket ( Bucket bucket ) { if ( bucket != null ) { if ( ! bucket . close ( ) ) { LOGGER . error ( "Not able to close bucket [" + bucket . name ( ) + "]." ) ; throw new KunderaException ( "Not able to close bucket [" + bucket . name ( ) + "]." ) ; } else { LOGGER . debug ( "Bucket [" + bucket . n... | Close bucket . |
35,725 | public Object find ( Class entityClass , Object rowId ) { EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClass ) ; StringBuilder builder = createSelectQuery ( rowId , metadata , metadata . getTableName ( ) ) ; ResultSet rSet = this . execute ( builder . toString ( ) , nul... | Finds an entity from database . |
35,726 | private StringBuilder createSelectQuery ( Object rowId , EntityMetadata metadata , String tableName ) { MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( metadata . getPersistenceUnit ( ) ) ; CQLTranslator translator = new CQLTranslator ( ) ; String select_Query =... | Creates the select query . |
35,727 | private void populateSecondaryTableData ( Object rowId , Object entity , MetamodelImpl metaModel , EntityMetadata metadata ) { AbstractManagedType managedType = ( AbstractManagedType ) metaModel . entity ( metadata . getEntityClazz ( ) ) ; List < String > secondaryTables = ( ( DefaultEntityAnnotationProcessor ) managed... | Populates data form secondary tables of entity for given row key . |
35,728 | private Object iteratorColumns ( EntityMetadata metadata , MetamodelImpl metamodel , EntityType entityType , Map < String , Object > relationalValues , Object entity , Row row , Iterator < Definition > columnDefIter ) { while ( columnDefIter . hasNext ( ) ) { Definition columnDef = columnDefIter . next ( ) ; final Stri... | Iterator columns . |
35,729 | private Object getCompoundKey ( Attribute attribute , Object entity ) throws InstantiationException , IllegalAccessException { Object compoundKeyObject = null ; if ( entity != null ) { compoundKeyObject = PropertyAccessorHelper . getObject ( entity , ( Field ) attribute . getJavaMember ( ) ) ; if ( compoundKeyObject ==... | Gets the compound key . |
35,730 | public void setKeyValues ( String keyName , Object obj ) { if ( this . keyValues == null ) { this . keyValues = new HashMap < String , Object > ( ) ; } this . keyValues . put ( keyName , obj ) ; } | Sets the key values . |
35,731 | public AggregationBuilder buildAggregation ( KunderaQuery query , EntityMetadata entityMetadata , QueryBuilder filter ) { SelectStatement selectStatement = query . getSelectStatement ( ) ; AggregationBuilder aggregationBuilder = buildWhereAggregations ( entityMetadata , filter ) ; if ( KunderaQueryUtils . hasGroupBy ( ... | Use aggregation . |
35,732 | private AggregationBuilder addHavingClause ( Expression havingExpression , AggregationBuilder aggregationBuilder , EntityMetadata entityMetadata ) { if ( havingExpression instanceof ComparisonExpression ) { Expression expression = ( ( ComparisonExpression ) havingExpression ) . getLeftExpression ( ) ; if ( ! isAggregat... | Adds the having clauses . |
35,733 | private TermsBuilder processGroupByClause ( Expression expression , EntityMetadata entityMetadata , KunderaQuery query ) { MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( entityMetadata . getPersistenceUnit ( ) ) ; Expression groupByClause = ( ( GroupByClause ) ... | Process group by clause . |
35,734 | private void processOrderByClause ( TermsBuilder termsBuilder , Expression orderByExpression , Expression groupByClause , EntityMetadata entityMetadata ) { Expression orderByClause = ( OrderByClause ) orderByExpression ; OrderByItem orderByItems = ( OrderByItem ) ( ( OrderByClause ) orderByClause ) . getOrderByItems ( ... | Process order by clause . |
35,735 | private TopHitsBuilder getTopHitsAggregation ( SelectStatement selectStatement , Integer size , EntityMetadata entityMetadata ) { TopHitsBuilder topHitsBuilder = AggregationBuilders . topHits ( ESConstants . TOP_HITS ) ; if ( size != null ) { topHitsBuilder . setSize ( size ) ; } return topHitsBuilder ; } | Gets the top hits aggregation . |
35,736 | private FilterAggregationBuilder buildWhereAggregations ( EntityMetadata entityMetadata , QueryBuilder filter ) { filter = filter != null ? filter : QueryBuilders . matchAllQuery ( ) ; FilterAggregationBuilder filteragg = AggregationBuilders . filter ( ESConstants . AGGREGATION_NAME ) . filter ( filter ) ; return filte... | Builds the where aggregations . |
35,737 | private AggregationBuilder buildSelectAggregations ( AggregationBuilder aggregationBuilder , SelectStatement selectStatement , EntityMetadata entityMetadata ) { Expression expression = ( ( SelectClause ) selectStatement . getSelectClause ( ) ) . getSelectExpression ( ) ; if ( expression instanceof CollectionExpression ... | Builds the select aggregations . |
35,738 | private AggregationBuilder appendAggregation ( CollectionExpression collectionExpression , EntityMetadata entityMetadata , AggregationBuilder aggregationBuilder ) { ListIterable < Expression > functionlist = collectionExpression . children ( ) ; for ( Expression function : functionlist ) { if ( isAggregationExpression ... | Append aggregation . |
35,739 | private MetricsAggregationBuilder getMetricsAggregation ( Expression expression , EntityMetadata entityMetadata ) { AggregateFunction function = ( AggregateFunction ) expression ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( entityMetadata . getPersistenceUni... | Gets the aggregation . |
35,740 | private boolean checkIfKeyExists ( String key ) { if ( aggregationsKeySet == null ) { aggregationsKeySet = new HashSet < String > ( ) ; } return aggregationsKeySet . add ( key ) ; } | Checks whether key exist in ES Query . |
35,741 | private void removePool ( IThriftPool pool ) { Pelops . removePool ( PelopsUtils . getPoolName ( pool ) ) ; Node [ ] nodes = ( ( CommonsBackedPool ) pool ) . getCluster ( ) . getNodes ( ) ; logger . warn ( "{} :{} host appears to be down, trying for next " , nodes , ( ( CommonsBackedPool ) pool ) . getCluster ( ) . ge... | Removes downed host pool from pool map . |
35,742 | public void dropSchema ( ) { try { for ( TableInfo tableInfo : tableInfos ) { HttpResponse deleteResponse = null ; Map < String , MapReduce > views = new HashMap < String , MapReduce > ( ) ; String id = CouchDBConstants . DESIGN + tableInfo . getTableName ( ) ; CouchDBDesignDocument designDocument = getDesignDocument (... | drop design document from db . |
35,743 | protected boolean initiateClient ( ) { try { SchemeSocketFactory ssf = null ; ssf = PlainSocketFactory . getSocketFactory ( ) ; SchemeRegistry schemeRegistry = new SchemeRegistry ( ) ; schemeRegistry . register ( new Scheme ( "http" , Integer . parseInt ( port ) , ssf ) ) ; PoolingClientConnectionManager ccm = new Pool... | Instantiate http client . |
35,744 | protected void validate ( List < TableInfo > tableInfos ) { try { if ( ! checkForDBExistence ( ) ) { throw new SchemaGenerationException ( "Database " + databaseName + " not exist" ) ; } for ( TableInfo tableInfo : tableInfos ) { Map < String , MapReduce > views = new HashMap < String , MapReduce > ( ) ; String id = Co... | Validate design document . |
35,745 | protected void update ( List < TableInfo > tableInfos ) { try { HttpResponse response = null ; createDatabaseIfNotExist ( false ) ; for ( TableInfo tableInfo : tableInfos ) { String id = CouchDBConstants . DESIGN + tableInfo . getTableName ( ) ; CouchDBDesignDocument designDocument = getDesignDocument ( id ) ; designDo... | Update design document . |
35,746 | protected void create ( List < TableInfo > tableInfos ) { try { HttpResponse response = null ; createDatabaseIfNotExist ( true ) ; for ( TableInfo tableInfo : tableInfos ) { CouchDBDesignDocument designDocument = new CouchDBDesignDocument ( ) ; Map < String , MapReduce > views = new HashMap < String , CouchDBDesignDocu... | Create database and design document . |
35,747 | private void createDesignDocForAggregations ( ) throws URISyntaxException , UnsupportedEncodingException , IOException , ClientProtocolException { HttpResponse response = null ; URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATO... | Creates the design doc for aggregations . |
35,748 | private void createViewForSelectSpecificFields ( Map < String , MapReduce > views ) { if ( views . get ( CouchDBConstants . FIELDS ) == null ) { MapReduce mapr = new MapReduce ( ) ; mapr . setMap ( "function(doc){for(field in doc){emit(field, doc[field]);}}" ) ; views . put ( CouchDBConstants . FIELDS , mapr ) ; } } | Creates the view for select specific fields . |
35,749 | private void createViewForCount ( Map < String , MapReduce > views ) { if ( views . get ( CouchDBConstants . COUNT ) == null ) { MapReduce mapr = new MapReduce ( ) ; mapr . setMap ( "function(doc){" + "for(field in doc){if(field!=\"" + CouchDBConstants . ENTITYNAME + "\"){var o = doc[field];emit(field+\"_\"+doc." + Cou... | Creates the view for count . |
35,750 | private void createViewForSum ( Map < String , MapReduce > views ) { if ( views . get ( CouchDBConstants . SUM ) == null ) { MapReduce mapr = new MapReduce ( ) ; mapr . setMap ( "function(doc){for(field in doc){var o = doc[field];if(typeof(o)==\"number\")emit(field+\"_\"+doc." + CouchDBConstants . ENTITYNAME + ", o);}}... | Creates the view for sum . |
35,751 | private void createViewForMax ( Map < String , MapReduce > views ) { if ( views . get ( CouchDBConstants . MAX ) == null ) { MapReduce mapr = new MapReduce ( ) ; mapr . setMap ( "function(doc){for(field in doc){var o = doc[field];if(typeof(o)==\"number\")emit(field+\"_\"+doc." + CouchDBConstants . ENTITYNAME + ", o);}}... | Creates the view for max . |
35,752 | private void createViewForMin ( Map < String , MapReduce > views ) { if ( views . get ( CouchDBConstants . MIN ) == null ) { MapReduce mapr = new MapReduce ( ) ; mapr . setMap ( "function(doc){for(field in doc){var o = doc[field];if(typeof(o)==\"number\")emit(field+\"_\"+doc." + CouchDBConstants . ENTITYNAME + ", o);}}... | Creates the view for min . |
35,753 | private void createViewForAvg ( Map < String , MapReduce > views ) { if ( views . get ( CouchDBConstants . AVG ) == null ) { MapReduce mapr = new MapReduce ( ) ; mapr . setMap ( "function(doc){for(field in doc){var o = doc[field];if(typeof(o)==\"number\")emit(field+\"_\"+doc." + CouchDBConstants . ENTITYNAME + ", o);}}... | Creates the view for avg . |
35,754 | private void createViewIfNotExist ( Map < String , MapReduce > views , String columnName ) { if ( views . get ( columnName ) == null ) { createView ( views , columnName ) ; } } | Creates the view if not exist . |
35,755 | private void createViewForSelectAllIfNotExist ( TableInfo tableInfo , Map < String , MapReduce > views ) { if ( views . get ( "all" ) == null ) { createViewForSelectAll ( tableInfo , views ) ; } } | Creates the view for select all if not exist . |
35,756 | private void createViewForSelectAll ( TableInfo tableInfo , Map < String , MapReduce > views ) { MapReduce mapr = new MapReduce ( ) ; mapr . setMap ( "function(doc){if(doc." + tableInfo . getIdColumnName ( ) + "){emit(null, doc);}}" ) ; views . put ( "all" , mapr ) ; } | Creates the view for select all . |
35,757 | private void createDatabaseIfNotExist ( boolean drop ) throws URISyntaxException , IOException , ClientProtocolException { boolean exist = checkForDBExistence ( ) ; if ( exist && drop ) { dropDatabase ( ) ; exist = false ; } if ( ! exist ) { URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostNam... | Creates the database if not exist . |
35,758 | private boolean checkForDBExistence ( ) throws ClientProtocolException , IOException , URISyntaxException { URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATOR + databaseName . toLowerCase ( ) , null , null ) ; HttpGet get = new... | Check for db existence . |
35,759 | private void dropDatabase ( ) throws IOException , ClientProtocolException , URISyntaxException { HttpResponse delRes = null ; try { URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATOR + databaseName . toLowerCase ( ) , null , n... | Drop database . |
35,760 | private Map < String , List < String > > mapClazztoPu ( Class < ? > clazz , String pu , Map < String , List < String > > clazzToPuMap ) { List < String > puCol = new ArrayList < String > ( 1 ) ; if ( clazzToPuMap == null ) { clazzToPuMap = new HashMap < String , List < String > > ( ) ; } else { if ( clazzToPuMap . cont... | Method to prepare class simple name to list of pu s mapping . 1 class can be mapped to multiple persistence units in case of RDBMS in other cases it will only be 1! |
35,761 | private void onUpdate ( EventLog log ) { if ( updateEvents == null ) { updateEvents = new ConcurrentHashMap < Object , EventLog > ( ) ; } updateEvents . put ( log . getEntityId ( ) , log ) ; } | On update . |
35,762 | private void onInsert ( EventLog log ) { if ( insertEvents == null ) { insertEvents = new ConcurrentHashMap < Object , EventLog > ( ) ; } insertEvents . put ( log . getEntityId ( ) , log ) ; } | On insert . |
35,763 | private void createIdIndex ( String bucketName ) { Bucket bucket = null ; try { bucket = CouchbaseBucketUtils . openBucket ( cluster , bucketName , csmd . getBucketProperty ( "bucket.password" ) ) ; bucket . bucketManager ( ) . createN1qlPrimaryIndex ( buildIndexName ( bucketName ) , true , false ) ; LOGGER . debug ( "... | Creates the id index . |
35,764 | private void removeBucket ( String name ) { try { if ( clusterManager . removeBucket ( name ) ) { LOGGER . info ( "Bucket [" + name + "] is removed!" ) ; } else { LOGGER . error ( "Not able to remove bucket [" + name + "]." ) ; throw new KunderaException ( "Not able to remove bucket [" + name + "]." ) ; } } catch ( Cou... | Removes the bucket . |
35,765 | private void addBucket ( String name ) { String qouta = csmd . getBucketProperty ( "bucket.quota" ) ; int bucketQuota = qouta != null ? Integer . parseInt ( qouta ) : DEFAULT_RAM_SIZE_IN_MB ; BucketSettings bucketSettings = new DefaultBucketSettings . Builder ( ) . type ( BucketType . COUCHBASE ) . name ( name ) . quot... | Adds the bucket . |
35,766 | private String buildIndexName ( String bucketName ) { if ( bucketName == null ) { throw new KunderaException ( "Bucket Name can't be null!" ) ; } return ( bucketName + CouchbaseConstants . INDEX_SUFFIX ) . toLowerCase ( ) ; } | Builds the index name . |
35,767 | public String getConnectionString ( EntityMetadata m ) { Properties properties = new Properties ( ) ; String fileName = "teradata.properties" ; InputStream inputStream = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( fileName ) ; if ( inputStream != null ) { try { properties . load ( inputStream ) ; } catch ... | Gets the connection string . |
35,768 | public void setImplementor ( ResourceManager implementor ) { KunderaTransaction tx = threadLocal . get ( ) ; if ( tx == null ) { throw new IllegalStateException ( "Cannot get Transaction to start" ) ; } tx . setImplementor ( implementor ) ; } | Links referenced resource to current transaction thread . |
35,769 | public String getJoinColumnName ( final KunderaMetadata kunderaMetadata ) { if ( joinColumnName == null && isJoinedByPrimaryKey ) { EntityMetadata joinClassMetadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , targetEntity ) ; joinColumnName = ( ( AbstractAttribute ) joinClassMetadata . getIdAttribu... | Gets the join column name . |
35,770 | public boolean isUnary ( ) { return type . equals ( Relation . ForeignKey . ONE_TO_ONE ) || type . equals ( Relation . ForeignKey . MANY_TO_ONE ) ; } | Checks if is unary . |
35,771 | public boolean isCollection ( ) { return type . equals ( Relation . ForeignKey . ONE_TO_MANY ) || type . equals ( Relation . ForeignKey . MANY_TO_MANY ) ; } | Checks if is collection . |
35,772 | private MapObject populateRmap ( EntityMetadata entityMetadata , Object entity ) { MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( entityMetadata . getPersistenceUnit ( ) ) ; Class entityClazz = entityMetadata . getEntityClazz ( ) ; EntityType entityType = metaM... | Populate rmap . |
35,773 | private MapObject iterateAndPopulateRmap ( Object entity , MetamodelImpl metaModel , Iterator < Attribute > iterator ) { MapObject map = r . hashMap ( ) ; while ( iterator . hasNext ( ) ) { Attribute attribute = iterator . next ( ) ; Field field = ( Field ) attribute . getJavaMember ( ) ; Object value = PropertyAccesso... | Iterate and populate rmap . |
35,774 | private E fetchObject ( ) { try { String previousSkip = "&skip=" + ( skipCounter - 1 ) ; String currentSkip = "&skip=" + skipCounter ; int indexOf = q . indexOf ( previousSkip ) ; if ( indexOf > 0 ) { q . replace ( indexOf , indexOf + previousSkip . length ( ) , currentSkip ) ; } else if ( skipCounter > 0 ) { q . appen... | Fetch object . |
35,775 | private String [ ] splitHostNames ( String hostNames ) { String [ ] hostArray = hostNames . split ( Constants . COMMA ) ; String [ ] hosts = new String [ hostArray . length ] ; for ( int i = 0 ; i < hostArray . length ; i ++ ) { hosts [ i ] = hostArray [ i ] . trim ( ) ; } return hosts ; } | Split host names . |
35,776 | private HTableDescriptor getTableMetaData ( List < TableInfo > tableInfos ) { HTableDescriptor tableDescriptor = new HTableDescriptor ( databaseName ) ; Properties tableProperties = null ; schemas = HBasePropertyReader . hsmd . getDataStore ( ) != null ? HBasePropertyReader . hsmd . getDataStore ( ) . getSchemas ( ) : ... | get Table metadata method returns the HTableDescriptor of table for given tableInfo |
35,777 | public void persistJoinTable ( JoinTableData joinTableData ) { Mutator mutator = clientFactory . getMutator ( pool ) ; String joinTableName = joinTableData . getJoinTableName ( ) ; String invJoinColumnName = joinTableData . getInverseJoinColumnName ( ) ; Map < Object , Set < Object > > joinTableRecords = joinTableData ... | Persists records into Join Table . |
35,778 | public final List < SuperColumn > loadSuperColumns ( String keyspace , String columnFamily , String rowId , String ... superColumnNames ) { if ( ! isOpen ( ) ) throw new PersistenceException ( "PelopsClient is closed." ) ; Selector selector = clientFactory . getSelector ( pool ) ; List < ByteBuffer > rowKeys = new Arra... | Load super columns . |
35,779 | public List findByRange ( byte [ ] minVal , byte [ ] maxVal , EntityMetadata m , boolean isWrapReq , List < String > relations , List < String > columns , List < IndexExpression > conditions , int maxResults ) throws Exception { Selector selector = clientFactory . getSelector ( pool ) ; SlicePredicate slicePredicate = ... | Find by range . |
35,780 | public String getJPAColumnName ( ) { Column column = ( ( AbstractManagedType ) this . managedType ) . getAttributeBinding ( member ) ; if ( column != null ) { columnName = column . name ( ) ; } return columnName ; } | Returns assigned jpa column name . |
35,781 | private ClientProperties onParseXML ( String propertyFileName , PersistenceUnitMetadata puMetadata ) { InputStream inStream = puMetadata . getClassLoader ( ) . getResourceAsStream ( propertyFileName ) ; if ( inStream == null ) { propertyFileName = KunderaCoreUtils . resolvePath ( propertyFileName ) ; try { inStream = n... | If property file is xml . |
35,782 | private void initiateJPQLObject ( final String jpaQuery ) { JPQLGrammar jpqlGrammar = EclipseLinkJPQLGrammar2_4 . instance ( ) ; this . jpqlExpression = new JPQLExpression ( jpaQuery , jpqlGrammar , "ql_statement" , true ) ; setKunderaQueryTypeObject ( ) ; } | Initiate jpql object . |
35,783 | private void setKunderaQueryTypeObject ( ) { try { if ( isSelectStatement ( ) ) { this . setSelectStatement ( ( SelectStatement ) ( this . getJpqlExpression ( ) . getQueryStatement ( ) ) ) ; } else if ( isUpdateStatement ( ) ) { this . setUpdateStatement ( ( UpdateStatement ) ( this . getJpqlExpression ( ) . getQuerySt... | Sets the kundera query type object . |
35,784 | public List < Object > getClauseValue ( String paramString ) { if ( typedParameter != null && typedParameter . getParameters ( ) != null ) { List < FilterClause > clauses = typedParameter . getParameters ( ) . get ( paramString ) ; if ( clauses != null ) { return clauses . get ( 0 ) . getValue ( ) ; } else { throw new ... | Returns clause value for supplied parameter . |
35,785 | public List < Object > getClauseValue ( Parameter param ) { Parameter match = null ; if ( typedParameter != null && typedParameter . jpaParameters != null ) { for ( Parameter p : typedParameter . jpaParameters ) { if ( p . equals ( param ) ) { match = p ; if ( typedParameter . getType ( ) . equals ( Type . NAMED ) ) { ... | Returns specific clause value . |
35,786 | private void initUpdateClause ( ) { for ( UpdateClause updateClause : updateClauseQueue ) { onTypedParameter ( updateClause . getValue ( ) , updateClause , updateClause . getProperty ( ) . trim ( ) ) ; } } | Inits the update clause . |
35,787 | private void initEntityClass ( ) { if ( from == null ) { throw new JPQLParseException ( "Bad query format FROM clause is mandatory for SELECT queries" ) ; } String fromArray [ ] = from . split ( " " ) ; if ( ! this . isDeleteUpdate ) { if ( fromArray . length == 3 && fromArray [ 1 ] . equalsIgnoreCase ( "as" ) ) { from... | Inits the entity class . |
35,788 | private void initFilter ( ) { EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClass ) ; Metamodel metaModel = kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( getPersistenceUnit ( ) ) ; EntityType entityType = metaModel . entity ( entityClass ) ; if ( null == ... | Inits the filter . |
35,789 | private void addDiscriminatorClause ( List < String > clauses , EntityType entityType ) { if ( ( ( AbstractManagedType ) entityType ) . isInherited ( ) ) { String discrColumn = ( ( AbstractManagedType ) entityType ) . getDiscriminatorColumn ( ) ; String discrValue = ( ( AbstractManagedType ) entityType ) . getDiscrimin... | Adds the discriminator clause . |
35,790 | private void filterJPAParameterInfo ( Type type , String name , String fieldName ) { String attributeName = getAttributeName ( fieldName ) ; Attribute entityAttribute = ( ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( persistenceUnit ) ) . getEntityAttribute ( entityClass , attributeNam... | Filter jpa parameter info . |
35,791 | private String getAttributeName ( String fieldName ) { String attributeName = fieldName ; if ( fieldName . indexOf ( "." ) != - 1 ) { attributeName = fieldName . substring ( 0 , fieldName . indexOf ( "." ) ) ; } return attributeName ; } | Gets the attribute name . |
35,792 | public void addUpdateClause ( final String property , final String value ) { UpdateClause updateClause = new UpdateClause ( property . trim ( ) , value . trim ( ) ) ; updateClauseQueue . add ( updateClause ) ; addTypedParameter ( value . trim ( ) . startsWith ( "?" ) ? Type . INDEXED : value . trim ( ) . startsWith ( "... | Adds the update clause . |
35,793 | public void addFilterClause ( final String property , final String condition , final Object value , final String fieldName , final boolean ignoreCase ) { if ( property != null && condition != null ) { FilterClause filterClause = new FilterClause ( property . trim ( ) , condition . trim ( ) , value , fieldName ) ; filte... | Adds the filter clause . |
35,794 | private static Object getValue ( Object value ) { if ( value != null && value . getClass ( ) . isAssignableFrom ( String . class ) ) { return ( ( String ) value ) . replaceAll ( "^'" , "" ) . replaceAll ( "'$" , "" ) . replaceAll ( "''" , "'" ) ; } return value ; } | Method to skip string literal as per JPA specification . if literal starts is enclose within then skip and include in case of replace it with . |
35,795 | static List < User > onQueryByEmail ( final EntityManager em , final User user ) { String query = "Select u from User u where u.emailId =?1" ; logger . info ( "" ) ; logger . info ( "" ) ; logger . info ( query ) ; System . out . println ( "#######################Querying##########################################" ) ; ... | on query with user email id |
35,796 | static void onPersist ( final EntityManager em , final User user ) { logger . info ( "" ) ; logger . info ( "" ) ; logger . info ( "#######################Persisting##########################################" ) ; logger . info ( "" ) ; logger . info ( user . toString ( ) ) ; persist ( user , em ) ; logger . info ( "" )... | On persist user . |
35,797 | static User findByKey ( final EntityManager em , final String userId ) { User user = em . find ( User . class , userId ) ; logger . info ( "[On Find by key]" ) ; System . out . println ( "#######################START##########################################" ) ; logger . info ( "\n" ) ; logger . info ( "\t\t User's fi... | On find by user id . |
35,798 | @ SuppressWarnings ( "unchecked" ) static void findByQuery ( final EntityManager em , final String query ) { Query q = em . createNamedQuery ( query ) ; logger . info ( "[On Find All by Query]" ) ; List < User > users = q . getResultList ( ) ; if ( users == null || users . isEmpty ( ) ) { logger . info ( "0 Users Retur... | on find by wild search query . |
35,799 | @ SuppressWarnings ( "unchecked" ) static void findByNativeQuery ( final EntityManager em , final String query ) { Query q = em . createNativeQuery ( query , Tweets . class ) ; Map < String , Client > clients = ( Map < String , Client > ) em . getDelegate ( ) ; ThriftClient client = ( ThriftClient ) clients . get ( "tw... | On find by native CQL3 query . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.