idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
35,300
public static SubsystemSuspensionLevels findBySubsystem ( EntityManager em , SubSystem subSystem ) { SystemAssert . requireArgument ( em != null , "Entity manager can not be null." ) ; SystemAssert . requireArgument ( subSystem != null , "Subsystem cannot be null." ) ; TypedQuery < SubsystemSuspensionLevels > query = e...
Retrieves the SubsystemSuspensionLevels object for the given subsystem .
35,301
public static Map < Integer , Long > getSuspensionLevelsBySubsystem ( EntityManager em , SubSystem subSystem ) { return findBySubsystem ( em , subSystem ) . getLevels ( ) ; }
Retrieves the suspension levels for the given subsystem .
35,302
public void setLevels ( Map < Integer , Long > levels ) { SystemAssert . requireArgument ( levels != null , "Levels cannot be null" ) ; this . levels . clear ( ) ; this . levels . putAll ( levels ) ; }
Sets the suspension time in milliseconds for the corresponding infraction count .
35,303
public static SystemMain getInstance ( Properties config ) { return Guice . createInjector ( new SystemInitializer ( config ) ) . getInstance ( SystemMain . class ) ; }
Returns an instance of the system . Configuration is read from the supplied properties file .
35,304
protected void doStart ( ) { try { String build = _configuration . getValue ( SystemConfiguration . Property . BUILD ) ; String version = _configuration . getValue ( SystemConfiguration . Property . VERSION ) ; String year = new SimpleDateFormat ( "yyyy" ) . format ( new Date ( ) ) ; _log . info ( "Argus version {} bui...
Starts the system .
35,305
protected void doStop ( ) { try { _dispose ( _serviceFactory . getWardenService ( ) ) ; _dispose ( _serviceFactory . getMonitorService ( ) ) ; _dispose ( _serviceFactory . getSchedulingService ( ) ) ; _dispose ( _serviceFactory . getGlobalInterlockService ( ) ) ; _dispose ( _serviceFactory . getMQService ( ) ) ; _dispo...
Stops the system .
35,306
public static MetricDto transformToDto ( Metric metric ) { if ( metric == null ) { throw new WebApplicationException ( "Null entity object cannot be converted to Dto object." , Status . INTERNAL_SERVER_ERROR ) ; } MetricDto result = createDtoObject ( MetricDto . class , metric ) ; return result ; }
Converts a metric entity to a DTO .
35,307
public static long _9sComplement ( long creationTime ) { String time = String . valueOf ( creationTime ) ; char [ ] timeArr = time . toCharArray ( ) ; StringBuilder sb = new StringBuilder ( ) ; for ( char c : timeArr ) { sb . append ( 9 - Character . getNumericValue ( c ) ) ; } return Long . parseLong ( sb . toString (...
Return a 9 s complement of the given timestamp . Since AsyncHBase doesn t allow a reverse scan and we want to scan data in descending order of creation time .
35,308
public Dashboard getDashboard ( BigInteger dashboardId ) throws IOException , TokenExpiredException { String requestUrl = RESOURCE + "/" + dashboardId . toString ( ) ; ArgusResponse response = getClient ( ) . executeHttpRequest ( ArgusHttpClient . RequestType . GET , requestUrl , null ) ; assertValidResponse ( response...
Returns the batch for the given ID .
35,309
public static String internalReducer ( Metric metric , String reducerType ) { Map < Long , Double > sortedDatapoints = new TreeMap < > ( ) ; List < Double > operands = new ArrayList < Double > ( ) ; if ( ! reducerType . equals ( InternalReducerType . NAME . getName ( ) ) ) { if ( metric . getDatapoints ( ) != null && m...
Reduces the give metric to a single value based on the specified reducer .
35,310
public static Map < Metric , String > sortByValue ( Map < Metric , String > map , final String reducerType ) { List < Map . Entry < Metric , String > > list = new LinkedList < > ( map . entrySet ( ) ) ; Collections . sort ( list , new Comparator < Map . Entry < Metric , String > > ( ) { public int compare ( Map . Entry...
Sorts a metric .
35,311
public static NotificationDto transformToDto ( Notification notification ) { if ( notification == null ) { throw new WebApplicationException ( "Null entity object cannot be converted to Dto object." , Status . INTERNAL_SERVER_ERROR ) ; } NotificationDto result = createDtoObject ( NotificationDto . class , notification ...
Converts notification entity object to notificationDto object .
35,312
public static List < NotificationDto > transformToDto ( List < Notification > notifications ) { if ( notifications == null ) { throw new WebApplicationException ( "Null entity object cannot be converted to Dto object." , Status . INTERNAL_SERVER_ERROR ) ; } List < NotificationDto > result = new ArrayList < Notification...
Converts list of notification entity objects to list of notificationDto objects .
35,313
public static boolean isSignatureValid ( String payload , String signature , String appSecret ) { try { final Mac mac = Mac . getInstance ( HMAC_SHA1 ) ; mac . init ( new SecretKeySpec ( appSecret . getBytes ( ) , HMAC_SHA1 ) ) ; final byte [ ] rawHmac = mac . doFinal ( payload . getBytes ( ) ) ; final String expected ...
Verifies the provided signature of the payload .
35,314
public ProxyDataSourceBuilder autoRetrieveGeneratedKeys ( boolean autoClose , ResultSetProxyLogicFactory factory ) { this . autoRetrieveGeneratedKeys = true ; this . autoCloseGeneratedKeys = autoClose ; this . generatedKeysProxyLogicFactory = factory ; return this ; }
Enable auto retrieval of generated keys with proxy created by specified factory .
35,315
protected SortedMap < String , String > getParametersToDisplay ( List < ParameterSetOperation > params ) { SortedMap < String , String > paramMap = new TreeMap < String , String > ( new StringAsIntegerComparator ( ) ) ; for ( ParameterSetOperation param : params ) { String key = getParameterKeyToDisplay ( param ) ; Str...
populate param map with sorted by key .
35,316
public static QueryType getQueryType ( String query ) { final String trimmedQuery = removeCommentAndWhiteSpace ( query ) ; if ( trimmedQuery == null || trimmedQuery . length ( ) < 1 ) { return QueryType . OTHER ; } final char firstChar = trimmedQuery . charAt ( 0 ) ; final QueryType type ; switch ( firstChar ) { case '...
Returns type of query from given query string .
35,317
protected void writeConnectionIdEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "Connection:" ) ; sb . append ( execInfo . getConnectionId ( ) ) ; sb . append ( ", " ) ; }
Write connection ID when enabled .
35,318
protected void writeTimeEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "Time:" ) ; sb . append ( execInfo . getElapsedTime ( ) ) ; sb . append ( ", " ) ; }
Write elapsed time .
35,319
protected void writeResultEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "Success:" ) ; sb . append ( execInfo . isSuccess ( ) ? "True" : "False" ) ; sb . append ( ", " ) ; }
Write query result whether successful or not .
35,320
protected void writeTypeEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "Type:" ) ; sb . append ( getStatementType ( execInfo . getStatementType ( ) ) ) ; sb . append ( ", " ) ; }
Write statement type .
35,321
protected void writeParamsEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { boolean isPrepared = execInfo . getStatementType ( ) == StatementType . PREPARED ; sb . append ( "Params:[" ) ; for ( QueryInfo queryInfo : queryInfoList ) { for ( List < ParameterSetOperation > parameters...
Write query parameters .
35,322
protected void writeParamsForSinglePreparedEntry ( StringBuilder sb , SortedMap < String , String > paramMap , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "(" ) ; for ( Map . Entry < String , String > paramEntry : paramMap . entrySet ( ) ) { sb . append ( paramEntry . getValue ( ) ) ; sb...
Write query parameters for PreparedStatement .
35,323
protected String getArguments ( Object [ ] args ) { if ( args == null || args . length == 0 ) { return "" ; } StringBuilder sb = new StringBuilder ( ) ; if ( args . length == 1 ) { Object arg = args [ 0 ] ; String param = getSingleArgParameterAsString ( arg ) ; String displayParam = getSingleArgDisplayParameter ( param...
Convert method parameters to a string .
35,324
protected String getDisplayParameter ( String parameter ) { if ( parameter . length ( ) <= this . parameterDisplayLength ) { return parameter ; } return parameter . substring ( 0 , this . parameterDisplayLength - 3 ) + "..." ; }
Construct parameter value to display .
35,325
protected String constructMessage ( long seq , Throwable thrown , long execTime , String connectionId , Class < ? > targetClass , Method method , String args ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "[" ) ; sb . append ( seq ) ; sb . append ( "]" ) ; sb . append ( "[" ) ; sb . append ( thrown == nul...
Construct a message to log .
35,326
public void setRowId ( String parameterName , RowId x ) { recordByName ( parameterName , getDeclaredMethod ( CallableStatement . class , "setRowId" , String . class , RowId . class ) , parameterName , x ) ; }
since 1 . 6
35,327
protected void writeDataSourceNameEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { String name = execInfo . getDataSourceName ( ) ; sb . append ( "\"name\":\"" ) ; sb . append ( name == null ? "" : escapeSpecialCharacter ( name ) ) ; sb . append ( "\", " ) ; }
Write datasource name when enabled as json .
35,328
protected void writeBatchEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "\"batch\":" ) ; sb . append ( execInfo . isBatch ( ) ? "true" : "false" ) ; sb . append ( ", " ) ; }
Write whether batch execution or not as json .
35,329
protected void writeQuerySizeEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "\"querySize\":" ) ; sb . append ( queryInfoList . size ( ) ) ; sb . append ( ", " ) ; }
Write query size as json .
35,330
protected void writeBatchSizeEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "\"batchSize\":" ) ; sb . append ( execInfo . getBatchSize ( ) ) ; sb . append ( ", " ) ; }
Write batch size as json .
35,331
protected void writeQueriesEntry ( StringBuilder sb , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "\"query\":[" ) ; for ( QueryInfo queryInfo : queryInfoList ) { sb . append ( "\"" ) ; sb . append ( escapeSpecialCharacter ( queryInfo . getQuery ( ) ) ) ; sb . append ( "\"," ) ; } chompIf...
Write queries as json .
35,332
protected void writeParamsForSinglePreparedEntry ( StringBuilder sb , SortedMap < String , String > paramMap , ExecutionInfo execInfo , List < QueryInfo > queryInfoList ) { sb . append ( "[" ) ; for ( Map . Entry < String , String > paramEntry : paramMap . entrySet ( ) ) { Object value = paramEntry . getValue ( ) ; if ...
Write parameters for single execution as json .
35,333
public QueryBuilder populateFilterBuilder ( Expression condtionalExp , EntityMetadata m ) { log . info ( "Populating filter for expression: " + condtionalExp ) ; QueryBuilder filter = null ; if ( condtionalExp instanceof SubExpression ) { filter = populateFilterBuilder ( ( ( SubExpression ) condtionalExp ) . getExpress...
Populate filter builder .
35,334
private QueryBuilder populateLikeQuery ( LikeExpression likeExpression , EntityMetadata metadata ) { Expression patternValue = likeExpression . getPatternValue ( ) ; String field = likeExpression . getStringExpression ( ) . toString ( ) ; String likePattern = ( patternValue instanceof InputParameter ) ? kunderaQuery . ...
Populate like query .
35,335
private QueryBuilder populateInQuery ( InExpression inExpression , EntityMetadata metadata ) { String property = getField ( inExpression . getExpression ( ) . toParsedText ( ) ) ; Expression inItemsParameter = inExpression . getInItems ( ) ; log . debug ( "IN query parameters for field " + property + " is: " + inItemsP...
Populate IN query filter .
35,336
private Collection getInValuesCollection ( Expression inClauseValues ) { Collection inParameterCollection = new ArrayList < > ( ) ; if ( inClauseValues instanceof NullExpression ) { log . debug ( "No items passed in IN clause values, returning blank IN values list" ) ; return inParameterCollection ; } if ( inClauseValu...
Returns the collection of IN clause values .
35,337
private QueryBuilder populateBetweenFilter ( BetweenExpression betweenExpression , EntityMetadata m ) { String lowerBoundExpression = getBetweenBoundaryValues ( betweenExpression . getLowerBoundExpression ( ) ) ; String upperBoundExpression = getBetweenBoundaryValues ( betweenExpression . getUpperBoundExpression ( ) ) ...
Populate between filter .
35,338
private String getBetweenBoundaryValues ( Expression boundExpression ) { if ( boundExpression instanceof IdentificationVariable || boundExpression instanceof NumericLiteral || boundExpression instanceof InputParameter ) { Object value = ( boundExpression instanceof InputParameter ) ? kunderaQuery . getParametersMap ( )...
Gets the between boundary values .
35,339
private String checkInputParameter ( Expression expression ) { return ( expression instanceof InputParameter ) ? kunderaQuery . getParametersMap ( ) . get ( ( expression ) . toParsedText ( ) ) . toString ( ) : expression . toParsedText ( ) . toString ( ) ; }
Check input parameter .
35,340
private QueryBuilder populateLogicalFilterBuilder ( Expression logicalExp , EntityMetadata m ) { String identifier = ( ( LogicalExpression ) logicalExp ) . getIdentifier ( ) ; return ( identifier . equalsIgnoreCase ( LogicalExpression . AND ) ) ? getAndFilterBuilder ( logicalExp , m ) : ( identifier . equalsIgnoreCase ...
Populate logical filter builder .
35,341
private AndQueryBuilder getAndFilterBuilder ( Expression logicalExp , EntityMetadata m ) { AndExpression andExp = ( AndExpression ) logicalExp ; Expression leftExpression = andExp . getLeftExpression ( ) ; Expression rightExpression = andExp . getRightExpression ( ) ; return new AndQueryBuilder ( populateFilterBuilder ...
Gets the and filter builder .
35,342
private OrQueryBuilder getOrFilterBuilder ( Expression logicalExp , EntityMetadata m ) { OrExpression orExp = ( OrExpression ) logicalExp ; Expression leftExpression = orExp . getLeftExpression ( ) ; Expression rightExpression = orExp . getRightExpression ( ) ; return new OrQueryBuilder ( populateFilterBuilder ( leftEx...
Gets the or filter builder .
35,343
private FilterClause populateFilterClause ( ComparisonExpression conditionalExpression ) { String property = ( ( StateFieldPathExpression ) conditionalExpression . getLeftExpression ( ) ) . getPath ( 1 ) ; String condition = conditionalExpression . getComparisonOperator ( ) ; Expression rightExpression = conditionalExp...
Populate filter clause .
35,344
public final void validate ( final Class < ? > clazz ) { if ( classes . contains ( clazz ) ) { return ; } if ( log . isDebugEnabled ( ) ) log . debug ( "Validating " + clazz . getName ( ) ) ; if ( ! clazz . isAnnotationPresent ( Entity . class ) ) { throw new InvalidEntityDefinitionException ( clazz . getName ( ) + " i...
Checks the validity of a class for Cassandra entity .
35,345
private URL [ ] findResourcesInUrls ( String classRelativePath , URL [ ] urls ) { List < URL > list = new ArrayList < URL > ( ) ; for ( URL url : urls ) { if ( AllowedProtocol . isValidProtocol ( url . getProtocol ( ) . toUpperCase ( ) ) && url . getPath ( ) . endsWith ( ".jar" ) ) { try { JarFile jarFile = new JarFile...
Scan class resource in the provided urls with the additional Class - Path of each jar checking
35,346
private final URL [ ] findResourcesByContextLoader ( ) { List < URL > list = new ArrayList < URL > ( ) ; ClassLoader classLoader = this . getClass ( ) . getClassLoader ( ) ; assert classLoader != null ; URL [ ] urls = ( ( URLClassLoader ) classLoader ) . getURLs ( ) ; for ( String fullyQualifiedClassName : classesToSca...
Scan class resources into a basePackagetoScan path .
35,347
public static InputStream toInputStream ( String s ) { InputStream is = new ByteArrayInputStream ( s . getBytes ( ) ) ; return is ; }
Converts String to Input Stream
35,348
private MongoClient onSetMongoServerProperties ( String contactNode , String defaultPort , String poolSize , List < ServerAddress > addrs , List < MongoCredential > credentials ) { MongoClientOptions mo ; MongoDBSchemaMetadata metadata = MongoDBPropertyReader . msmd ; ClientProperties cp = metadata != null ? metadata ....
On set mongo server properties .
35,349
private void buildHosts ( Map externalProperties , List < Server > servers , String persistenceUnit , final KunderaMetadata kunderaMetadata ) { persistenceUnitMetadata = kunderaMetadata . getApplicationMetadata ( ) . getPersistenceUnitMetadata ( persistenceUnit ) ; Properties props = persistenceUnitMetadata . getProper...
Build host array .
35,350
private void onCheckRelation ( ) { try { results = populateEntities ( entityMetadata , client ) ; if ( entityMetadata . isRelationViaJoinTable ( ) || ( entityMetadata . getRelationNames ( ) != null && ! ( entityMetadata . getRelationNames ( ) . isEmpty ( ) ) ) ) { query . setRelationalEntities ( results , client , enti...
on check relation event invokes populate entities and set relational entities in case relations are present .
35,351
private String appendWhereClauseWithScroll ( String parsedQuery ) { String queryWithoutLimit = parsedQuery . replaceAll ( parsedQuery . substring ( parsedQuery . lastIndexOf ( CQLTranslator . LIMIT ) , parsedQuery . length ( ) ) , "" ) ; CQLTranslator translator = new CQLTranslator ( ) ; final String tokenCondition = p...
Appends where claues and prepare for next fetch . Method to be called in case cql3 enabled .
35,352
private String replaceAndAppendLimit ( String parsedQuery ) { StringBuilder builder = new StringBuilder ( parsedQuery ) ; onLimit ( builder ) ; parsedQuery = builder . toString ( ) ; return parsedQuery ; }
Replace and append limit .
35,353
private void onLimit ( StringBuilder builder ) { builder . append ( CQLTranslator . LIMIT ) ; builder . append ( this . maxResult ) ; }
Append limit to sql3 query .
35,354
private Map < Boolean , String > getConditionOnIdColumn ( String idColumn ) { Map < Boolean , String > filterIdResult = new HashMap < Boolean , String > ( ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( entityMetadata . getPersistenceUnit ( ) ) ; EmbeddableT...
Gets the condition on id column .
35,355
private byte [ ] idValueInByteArr ( ) { Object entity = results . get ( results . size ( ) - 1 ) ; Object id = PropertyAccessorHelper . getId ( entity , entityMetadata ) ; String idName = ( ( AbstractAttribute ) entityMetadata . getIdAttribute ( ) ) . getJPAColumnName ( ) ; Class idClazz = ( ( AbstractAttribute ) entit...
Id value in byte arr .
35,356
private Field getPartitionKeyField ( ) { Field [ ] embeddedFields = entityMetadata . getIdAttribute ( ) . getBindableJavaType ( ) . getDeclaredFields ( ) ; Field field = null ; for ( Field embeddedField : embeddedFields ) { if ( ! ReflectUtils . isTransientOrStatic ( embeddedField ) ) { field = embeddedField ; break ; ...
Will return partition key part of composite id .
35,357
private E getEntity ( Object entity ) { return ( E ) ( entity . getClass ( ) . isAssignableFrom ( EnhanceEntity . class ) ? ( ( EnhanceEntity ) entity ) . getEntity ( ) : entity ) ; }
Extract wrapped entity object from enhanced entity .
35,358
private String replaceAppliedToken ( String query ) { final String tokenRegex = "\\btoken\\(" ; final String pattern = "#TOKENKUNDERA#" ; query = query . replaceAll ( tokenRegex , pattern ) ; if ( query . indexOf ( pattern ) > - 1 ) { CQLTranslator translator = new CQLTranslator ( ) ; int closingIndex = query . indexOf...
Replace applied token .
35,359
public Node getParentNode ( String parentNodeId ) { NodeLink link = new NodeLink ( parentNodeId , getNodeId ( ) ) ; if ( this . parents == null ) { return null ; } else { return this . parents . get ( link ) ; } }
Retrieves parent node of this node for a given parent node ID
35,360
public Node getChildNode ( String childNodeId ) { NodeLink link = new NodeLink ( getNodeId ( ) , childNodeId ) ; if ( this . children == null ) { return null ; } else { return this . children . get ( link ) ; } }
Retrieves child node of this node for a given child node ID
35,361
public Map < String , EntityMetadata > getEntityMetadataMap ( ) { if ( entityMetadataMap == null ) { entityMetadataMap = new HashMap < String , EntityMetadata > ( ) ; } return entityMetadataMap ; }
Gets the entity metadata map .
35,362
public Map < String , Class < ? > > getEntityNameToClassMap ( ) { if ( entityNameToClassMap == null ) { entityNameToClassMap = new HashMap < String , Class < ? > > ( ) ; } return entityNameToClassMap ; }
Gets the entity name to class map .
35,363
public void assignManagedTypes ( Map < Class < ? > , EntityType < ? > > managedTypes ) { if ( this . entityTypes == null ) { this . entityTypes = managedTypes ; } else { this . entityTypes . putAll ( managedTypes ) ; } }
Assign to managedTypes .
35,364
public void assignEmbeddables ( Map < Class < ? > , ManagedType < ? > > embeddables ) { if ( this . embeddables == null ) { this . embeddables = embeddables ; } else { this . embeddables . putAll ( embeddables ) ; } }
Assign embeddables to embeddables collection .
35,365
public void assignMappedSuperClass ( Map < Class < ? > , ManagedType < ? > > mappedSuperClass ) { if ( this . mappedSuperClassTypes == null ) { this . mappedSuperClassTypes = mappedSuperClass ; } else { this . mappedSuperClassTypes . putAll ( mappedSuperClassTypes ) ; } }
Adds mapped super class to mapped super class collection .
35,366
public boolean isEmbeddable ( Class embeddableClazz ) { return embeddables != null ? embeddables . containsKey ( embeddableClazz ) && embeddables . get ( embeddableClazz ) . getPersistenceType ( ) . equals ( PersistenceType . EMBEDDABLE ) : false ; }
Returns true if attribute is embeddable .
35,367
public Attribute getEntityAttribute ( Class clazz , String fieldName ) { if ( entityTypes != null && entityTypes . containsKey ( clazz ) ) { EntityType entityType = entityTypes . get ( clazz ) ; return entityType . getAttribute ( fieldName ) ; } throw new IllegalArgumentException ( "No entity found: " + clazz ) ; }
Returns entity attribute for given managed entity class .
35,368
public Map < String , EmbeddableType > getEmbeddables ( Class clazz ) { Map < String , EmbeddableType > embeddableAttibutes = new HashMap < String , EmbeddableType > ( ) ; if ( entityTypes != null ) { EntityType entity = entityTypes . get ( clazz ) ; Iterator < Attribute > iter = entity . getAttributes ( ) . iterator (...
Custom implementation to offer map of embeddables available for given entityType .
35,369
private String prepareCompositeIndexName ( String indexedColumns , final EntityType entityType , EntityMetadata metadata ) { StringTokenizer tokenizer = new StringTokenizer ( indexedColumns , "," ) ; StringBuilder builder = new StringBuilder ( ) ; while ( tokenizer . hasMoreTokens ( ) ) { String fieldName = ( String ) ...
prepare composite index .
35,370
public LoadState isLoadedWithoutReference ( Object paramObject , String paramString ) { return PersistenceUtilHelper . isLoadedWithoutReference ( paramObject , paramString , provider . getCache ( ) ) ; }
If the provider determines that the entity has been provided by itself and that the state of the specified attribute has been loaded this method returns LoadState . LOADED . If the provider determines that the entity has been provided by itself and that either entity attributes with FetchType EAGER have not been loaded...
35,371
private int toInt ( byte [ ] data ) { if ( data == null || data . length != 4 ) return 0x0 ; return ( int ) ( ( 0xff & data [ 0 ] ) << 24 | ( 0xff & data [ 1 ] ) << 16 | ( 0xff & data [ 2 ] ) << 8 | ( 0xff & data [ 3 ] ) << 0 ) ; }
To int .
35,372
public void download ( ) { DataKeeperService service = DataKeeperUtils . getService ( ) ; setDocumentId ( Integer . parseInt ( FacesUtils . getRequest ( ) . getParameter ( "documentId" ) ) ) ; DocumentInfo document = service . findDocumentByDocumentId ( getDocumentId ( ) ) ; final HttpServletResponse response = ( HttpS...
Download file used for downloading photo .
35,373
public DataFrame getDataFrame ( String query , EntityMetadata m , KunderaQuery kunderaQuery ) { PersistenceUnitMetadata puMetadata = kunderaMetadata . getApplicationMetadata ( ) . getPersistenceUnitMetadata ( persistenceUnit ) ; String clientName = puMetadata . getProperty ( DATA_CLIENT ) . toLowerCase ( ) ; SparkDataC...
Gets the data frame .
35,374
private void onIdAttribute ( final MetaModelBuilder builder , EntityMetadata entityMetadata , final Class clazz , Field f ) { EntityType entity = ( EntityType ) builder . getManagedTypes ( ) . get ( clazz ) ; Attribute attrib = entity . getAttribute ( f . getName ( ) ) ; if ( ! attrib . isCollection ( ) && ( ( Singular...
On id attribute .
35,375
private void onFamilyType ( EntityMetadata entityMetadata , final Class clazz , Field f ) { if ( entityMetadata . getType ( ) == null || ! entityMetadata . getType ( ) . equals ( Type . SUPER_COLUMN_FAMILY ) ) { if ( ( f . isAnnotationPresent ( Embedded . class ) && f . getType ( ) . getAnnotation ( Embeddable . class ...
On family type .
35,376
public String encriptPassword ( String password ) { String newpassword = null ; byte [ ] defaultBytes = password . getBytes ( ) ; try { MessageDigest algorithm = MessageDigest . getInstance ( "MD5" ) ; algorithm . reset ( ) ; algorithm . update ( defaultBytes ) ; byte messageDigest [ ] = algorithm . digest ( ) ; String...
encriptPassword method used for encrypting password .
35,377
protected EnhanceEntity findById ( Object primaryKey , EntityMetadata m , Client client ) { try { Object o = client . find ( m . getEntityClazz ( ) , primaryKey ) ; if ( o == null ) { return null ; } else { return o instanceof EnhanceEntity ? ( EnhanceEntity ) o : new EnhanceEntity ( o , getId ( o , m ) , null ) ; } } ...
Retrieves an entity from ID
35,378
private void onRelation ( final Object entity , final Map < String , Object > relationsMap , final EntityMetadata m , final PersistenceDelegator pd , Relation relation , ForeignKey relationType , boolean lazilyloaded , Map < Object , Object > relationStack ) { FetchType fetchType = relation . getFetchType ( ) ; if ( ! ...
Parse over each relation of fetched entity .
35,379
private void onRelation ( Object entity , Map < String , Object > relationsMap , final Relation relation , final EntityMetadata metadata , final PersistenceDelegator pd , boolean lazilyloaded , Map < Object , Object > relationStack ) { final Object entityId = PropertyAccessorHelper . getId ( entity , metadata ) ; Objec...
Method to handle one to one association relation events .
35,380
private void onParseRelation ( Object entity , final PersistenceDelegator pd , EntityMetadata targetEntityMetadata , Object relationEntity , Relation relation , boolean lazilyloaded , Map < Object , Object > relationStack ) { parseRelations ( entity , getEntity ( relationEntity ) , getPersistedRelations ( relationEntit...
Invokes parseRelations for relation entity and set relational entity within entity
35,381
private void setRelationToEntity ( Object entity , Object relationEntity , Relation relation ) { if ( relation . getTargetEntity ( ) . isAssignableFrom ( getEntity ( relationEntity ) . getClass ( ) ) ) { if ( relation . isUnary ( ) ) { PropertyAccessorHelper . set ( entity , relation . getProperty ( ) , getEntity ( rel...
After successfully parsing set relational entity object within entity object .
35,382
private void parseRelations ( final Object originalEntity , final Object relationEntity , final Map < String , Object > relationsMap , final PersistenceDelegator pd , final EntityMetadata metadata , boolean lazilyloaded , Map < Object , Object > relationStack ) { for ( Relation relation : metadata . getRelations ( ) ) ...
Parse relations of provided relationEntity .
35,383
private Map < String , Object > getPersistedRelations ( Object relationEntity ) { return relationEntity != null && relationEntity . getClass ( ) . isAssignableFrom ( EnhanceEntity . class ) ? ( ( EnhanceEntity ) relationEntity ) . getRelations ( ) : null ; }
Returns wrapped relations .
35,384
private Object getEntity ( Object relationEntity ) { return relationEntity != null && relationEntity . getClass ( ) . isAssignableFrom ( EnhanceEntity . class ) ? ( ( EnhanceEntity ) relationEntity ) . getEntity ( ) : relationEntity ; }
Returns wrapped entity .
35,385
protected List < EnhanceEntity > onAssociationUsingLucene ( EntityMetadata m , Client client , List < EnhanceEntity > ls ) { Set < String > rSet = fetchDataFromLucene ( m . getEntityClazz ( ) , client ) ; List resultList = client . findAll ( m . getEntityClazz ( ) , null , rSet . toArray ( new String [ ] { } ) ) ; retu...
On association using lucene .
35,386
protected Set < String > fetchDataFromLucene ( Class < ? > clazz , Client client ) { String luceneQueryFromJPAQuery = KunderaCoreUtils . getLuceneQueryFromJPAQuery ( kunderaQuery , kunderaMetadata ) ; Map < String , Object > results = client . getIndexManager ( ) . search ( clazz , luceneQueryFromJPAQuery ) ; Set rSet ...
Fetch data from lucene .
35,387
private boolean compareTo ( Object relationalEntity , Object originalEntity ) { if ( relationalEntity != null && originalEntity != null && relationalEntity . getClass ( ) . isAssignableFrom ( originalEntity . getClass ( ) ) ) { EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , ori...
Compares original with relational entity .
35,388
private void createOrUpdateSchema ( Boolean isUpdate ) { createNamespace ( isUpdate ) ; readExternalProperties ( ) ; Map < Class < ? > , EntityType < ? > > entityMap = kunderaMetadata . getApplicationMetadata ( ) . getMetaModelBuilder ( puMetadata . getPersistenceUnitName ( ) ) . getManagedTypes ( ) ; for ( Class < ? >...
Creates the or update schema .
35,389
private HTableDescriptor getTableDescriptor ( Class < ? > clazz , EntityType < ? > entityType , String tableName ) { try { AbstractManagedType < ? > ent = ( AbstractManagedType < ? > ) entityType ; HTableDescriptor tableDescriptor = null ; String hTableName = HBaseUtils . getHTableName ( databaseName , tableName ) ; ta...
Gets the table descriptor .
35,390
private void addJoinTable ( List < Relation > relations ) { for ( Relation relation : relations ) { if ( relation . getType ( ) . equals ( ForeignKey . MANY_TO_MANY ) && relation . isRelatedViaJoinTable ( ) ) { String joinTableName = relation . getJoinTableMetadata ( ) . getJoinTableName ( ) ; String hTableName = HBase...
Adds the join table .
35,391
private void addColumnFamilyAndSetProperties ( HTableDescriptor tableDescriptor , String colFamilyName ) { if ( ! tableDescriptor . hasFamily ( colFamilyName . getBytes ( ) ) ) { HColumnDescriptor hColumnDescriptor = getColumnDescriptor ( colFamilyName ) ; tableDescriptor . addFamily ( hColumnDescriptor ) ; setExternal...
Adds the column family and set properties .
35,392
private void setExternalProperties ( String name , HColumnDescriptor hColumnDescriptor ) { Properties properties = externalProperties != null ? externalProperties . get ( name ) : null ; if ( properties != null && ! properties . isEmpty ( ) ) { for ( Object obj : properties . keySet ( ) ) { hColumnDescriptor . setValue...
Sets the external properties .
35,393
private void createNamespace ( boolean isUpdate ) { boolean isNameSpaceAvailable = isNamespaceAvailable ( databaseName ) ; if ( isNameSpaceAvailable && ! isUpdate ) { drop ( ) ; } if ( ! ( isNameSpaceAvailable && isUpdate ) ) { try { NamespaceDescriptor descriptor = NamespaceDescriptor . create ( databaseName ) . build...
Creates the namespace .
35,394
private boolean isNamespaceAvailable ( String databaseName ) { try { for ( NamespaceDescriptor ns : admin . listNamespaceDescriptors ( ) ) { if ( ns . getName ( ) . equals ( databaseName ) ) { return true ; } } return false ; } catch ( IOException ioex ) { logger . error ( "Either table isn't in enabled state or some n...
Checks if is namespace available .
35,395
private void createOrUpdateTable ( String tablename , HTableDescriptor hTableDescriptor ) { try { if ( admin . isTableAvailable ( tablename ) ) { admin . modifyTable ( tablename , hTableDescriptor ) ; } else { admin . createTable ( hTableDescriptor ) ; } } catch ( IOException ioex ) { logger . error ( "Either table isn...
Creates the or update table .
35,396
private void vaildateHostPort ( String host , String port ) { if ( host == null || ! StringUtils . isNumeric ( port ) || port . isEmpty ( ) ) { logger . error ( "Host or port should not be null / port should be numeric" ) ; throw new IllegalArgumentException ( "Host or port should not be null / port should be numeric" ...
Vaildate host port .
35,397
private void readExternalProperties ( ) { schemas = HBasePropertyReader . hsmd . getDataStore ( ) != null ? HBasePropertyReader . hsmd . getDataStore ( ) . getSchemas ( ) : null ; List < Table > tables = null ; if ( schemas != null && ! schemas . isEmpty ( ) ) { for ( Schema s : schemas ) { if ( s . getName ( ) != null...
Read external properties .
35,398
public static void closeContent ( HttpResponse response ) { if ( response != null ) { try { InputStream content = response . getEntity ( ) . getContent ( ) ; content . close ( ) ; } catch ( Exception e ) { throw new KunderaException ( e ) ; } } }
Close content .
35,399
static Object appendQuotes ( Object value ) { if ( value instanceof String || value instanceof Character ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "\"" ) ; builder . append ( value ) ; builder . append ( "\"" ) ; return builder . toString ( ) ; } return value ; }
Append quotes .