idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
35,400
private Status executeDebug ( Stmt . Debug stmt , CallStack frame , EnclosingScope scope ) { RValue . Array arr = executeExpression ( ARRAY_T , stmt . getOperand ( ) , frame ) ; for ( RValue item : arr . getElements ( ) ) { RValue . Int i = ( RValue . Int ) item ; char c = ( char ) i . intValue ( ) ; debug . print ( c ...
Execute a Debug statement at a given point in the function or method body . This will write the provided string out to the debug stream .
35,401
private Status executeFail ( Stmt . Fail stmt , CallStack frame , EnclosingScope scope ) { throw new AssertionError ( "Runtime fault occurred" ) ; }
Execute a fail statement at a given point in the function or method body . This will generate a runtime fault .
35,402
private Status executeIf ( Stmt . IfElse stmt , CallStack frame , EnclosingScope scope ) { RValue . Bool operand = executeExpression ( BOOL_T , stmt . getCondition ( ) , frame ) ; if ( operand == RValue . True ) { return executeBlock ( stmt . getTrueBranch ( ) , frame , scope ) ; } else if ( stmt . hasFalseBranch ( ) )...
Execute an if statement at a given point in the function or method body . This will proceed done either the true or false branch .
35,403
private Status executeNamedBlock ( Stmt . NamedBlock stmt , CallStack frame , EnclosingScope scope ) { return executeBlock ( stmt . getBlock ( ) , frame , scope ) ; }
Execute a named block which is simply a block of statements .
35,404
private Status executeWhile ( Stmt . While stmt , CallStack frame , EnclosingScope scope ) { Status r ; do { RValue . Bool operand = executeExpression ( BOOL_T , stmt . getCondition ( ) , frame ) ; if ( operand == RValue . False ) { return Status . NEXT ; } r = executeBlock ( stmt . getBody ( ) , frame , scope ) ; } wh...
Execute a While statement at a given point in the function or method body . This will loop over the body zero or more times .
35,405
private Status executeReturn ( Stmt . Return stmt , CallStack frame , EnclosingScope scope ) { Decl . Callable context = scope . getEnclosingScope ( FunctionOrMethodScope . class ) . getContext ( ) ; Tuple < Decl . Variable > returns = context . getReturns ( ) ; RValue [ ] values = executeExpressions ( stmt . getReturn...
Execute a Return statement at a given point in the function or method body
35,406
private Status executeSkip ( Stmt . Skip stmt , CallStack frame , EnclosingScope scope ) { return Status . NEXT ; }
Execute a skip statement at a given point in the function or method body
35,407
private Status executeSwitch ( Stmt . Switch stmt , CallStack frame , EnclosingScope scope ) { Tuple < Stmt . Case > cases = stmt . getCases ( ) ; Object value = executeExpression ( ANY_T , stmt . getCondition ( ) , frame ) ; for ( int i = 0 ; i != cases . size ( ) ; ++ i ) { Stmt . Case c = cases . get ( i ) ; Stmt . ...
Execute a Switch statement at a given point in the function or method body
35,408
private Status executeVariableDeclaration ( Decl . Variable stmt , CallStack frame ) { if ( stmt . hasInitialiser ( ) ) { RValue value = executeExpression ( ANY_T , stmt . getInitialiser ( ) , frame ) ; frame . putLocal ( stmt . getName ( ) , value ) ; } return Status . NEXT ; }
Execute a variable declaration statement at a given point in the function or method body
35,409
private RValue executeConst ( Expr . Constant expr , CallStack frame ) { Value v = expr . getValue ( ) ; switch ( v . getOpcode ( ) ) { case ITEM_null : return RValue . Null ; case ITEM_bool : { Value . Bool b = ( Value . Bool ) v ; if ( b . get ( ) ) { return RValue . True ; } else { return RValue . False ; } } case I...
Execute a Constant expression at a given point in the function or method body
35,410
private RValue executeConvert ( Expr . Cast expr , CallStack frame ) { RValue operand = executeExpression ( ANY_T , expr . getOperand ( ) , frame ) ; return operand . convert ( expr . getType ( ) ) ; }
Execute a type conversion at a given point in the function or method body
35,411
private boolean executeQuantifier ( int index , Expr . Quantifier expr , CallStack frame ) { Tuple < Decl . Variable > vars = expr . getParameters ( ) ; if ( index == vars . size ( ) ) { RValue . Bool r = executeExpression ( BOOL_T , expr . getOperand ( ) , frame ) ; boolean q = ( expr instanceof Expr . UniversalQuanti...
Execute one range of the quantifier or the body if no ranges remain .
35,412
private RValue executeVariableAccess ( Expr . VariableAccess expr , CallStack frame ) { Decl . Variable decl = expr . getVariableDeclaration ( ) ; return frame . getLocal ( decl . getName ( ) ) ; }
Execute a variable access expression at a given point in the function or method body . This simply loads the value of the given variable from the frame .
35,413
private RValue [ ] executeExpressions ( Tuple < Expr > expressions , CallStack frame ) { RValue [ ] [ ] results = new RValue [ expressions . size ( ) ] [ ] ; int count = 0 ; for ( int i = 0 ; i != expressions . size ( ) ; ++ i ) { results [ i ] = executeMultiReturnExpression ( expressions . get ( i ) , frame ) ; count ...
Execute one or more expressions . This is slightly more complex than for the single expression case because of the potential to encounter positional operands . That is severals which arise from executing the same expression .
35,414
private RValue [ ] executeMultiReturnExpression ( Expr expr , CallStack frame ) { switch ( expr . getOpcode ( ) ) { case WyilFile . EXPR_indirectinvoke : return executeIndirectInvoke ( ( Expr . IndirectInvoke ) expr , frame ) ; case WyilFile . EXPR_invoke : return executeInvoke ( ( Expr . Invoke ) expr , frame ) ; case...
Execute an expression which has the potential to return more than one result . Thus the return type must accommodate this by allowing zero or more returned values .
35,415
private RValue [ ] executeIndirectInvoke ( Expr . IndirectInvoke expr , CallStack frame ) { RValue . Lambda src = executeExpression ( LAMBDA_T , expr . getSource ( ) , frame ) ; RValue [ ] arguments = executeExpressions ( expr . getArguments ( ) , frame ) ; frame = src . getFrame ( ) ; extractParameters ( frame , argum...
Execute an IndirectInvoke bytecode instruction at a given point in the function or method body . This first checks the operand is a function reference and then generates a recursive call to execute the given function . If the function does not exist or is provided with the wrong number of arguments then a runtime fault...
35,416
private RValue [ ] executeInvoke ( Expr . Invoke expr , CallStack frame ) { Decl . Callable decl = expr . getLink ( ) . getTarget ( ) ; RValue [ ] arguments = executeExpressions ( expr . getOperands ( ) , frame ) ; RValue [ ] rs = execute ( decl . getQualifiedName ( ) , decl . getType ( ) , frame , arguments ) ; return...
Execute an Invoke bytecode instruction at a given point in the function or method body . This generates a recursive call to execute the given function . If the function does not exist or is provided with the wrong number of arguments then a runtime fault will occur .
35,417
private LValue constructLVal ( Expr expr , CallStack frame ) { switch ( expr . getOpcode ( ) ) { case EXPR_arrayborrow : case EXPR_arrayaccess : { Expr . ArrayAccess e = ( Expr . ArrayAccess ) expr ; LValue src = constructLVal ( e . getFirstOperand ( ) , frame ) ; RValue . Int index = executeExpression ( INT_T , e . ge...
This method constructs a mutable representation of the lval . This is a bit strange but is necessary because values in the frame are currently immutable .
35,418
public static < T extends RValue > T checkType ( RValue operand , SyntacticItem context , Class < T > ... types ) { for ( int i = 0 ; i != types . length ; ++ i ) { if ( types [ i ] . isInstance ( operand ) ) { return ( T ) operand ; } } if ( operand == null ) { error ( "null operand" , context ) ; } else { error ( "op...
Check that a given operand value matches an expected type .
35,419
public String getCompileTargetVersion ( ) { String javaVersion = "1.5" ; if ( mavenProject != null ) { String mavenCompilerTargetProperty = mavenProject . getProperties ( ) . getProperty ( "maven.compiler.target" ) ; if ( mavenCompilerTargetProperty != null ) { javaVersion = mavenCompilerTargetProperty ; } else { Plugi...
Determines the Java compiler target version by inspecting the project s maven - compiler - plugin configuration .
35,420
public void run ( ) throws MojoExecutionException { try { runMojo . getAppEngineFactory ( ) . devServerRunSync ( ) . run ( configBuilder . buildRunConfiguration ( processServices ( ) , processProjectId ( ) ) ) ; } catch ( AppEngineException ex ) { throw new MojoExecutionException ( "Failed to run devappserver" , ex ) ;...
Run the dev appserver .
35,421
public void runAsync ( int startSuccessTimeout ) throws MojoExecutionException { runMojo . getLog ( ) . info ( "Waiting " + startSuccessTimeout + " seconds for the Dev App Server to start." ) ; try { runMojo . getAppEngineFactory ( ) . devServerRunAsync ( startSuccessTimeout ) . run ( configBuilder . buildRunConfigurat...
Run the dev appserver in async mode .
35,422
public String getProjectId ( ) { if ( project != null ) { if ( projectId != null ) { throw new IllegalArgumentException ( "Configuring <project> and <projectId> is not allowed, please use only <projectId>" ) ; } getLog ( ) . warn ( "Configuring <project> is deprecated," + " use <projectId> to set your Google Cloud Proj...
Return projectId from either projectId or project . Show deprecation message if configured as project and throw error if both specified .
35,423
public String getProjectId ( ) { try { String gcloudProject = gcloud . getConfig ( ) . getProject ( ) ; if ( gcloudProject == null || gcloudProject . trim ( ) . isEmpty ( ) ) { throw new RuntimeException ( "Project was not found in gcloud config" ) ; } return gcloudProject ; } catch ( CloudSdkNotFoundException | CloudS...
Return gcloud config property for project or error out if not found .
35,424
public void checkCloudSdk ( CloudSdk cloudSdk , String version ) throws CloudSdkVersionFileException , CloudSdkNotFoundException , CloudSdkOutOfDateException { if ( ! version . equals ( cloudSdk . getVersion ( ) . toString ( ) ) ) { throw new RuntimeException ( "Specified Cloud SDK version (" + version + ") does not ma...
Validates the cloud SDK installation
35,425
public Gcloud getGcloud ( ) { return Gcloud . builder ( buildCloudSdkMinimal ( ) ) . setMetricsEnvironment ( mojo . getArtifactId ( ) , mojo . getArtifactVersion ( ) ) . setCredentialFile ( mojo . getServiceAccountKeyFile ( ) ) . build ( ) ; }
Return a Gcloud instance using global configuration .
35,426
public List < Path > getServices ( ) { return ( services == null ) ? null : services . stream ( ) . map ( File :: toPath ) . collect ( Collectors . toList ( ) ) ; }
Return a list of Paths but can return also return an empty list or null .
35,427
public void deployAll ( ) throws MojoExecutionException { stager . stage ( ) ; ImmutableList . Builder < Path > computedDeployables = ImmutableList . builder ( ) ; Path appYaml = deployMojo . getStagingDirectory ( ) . resolve ( "app.yaml" ) ; if ( ! Files . exists ( appYaml ) ) { throw new MojoExecutionException ( "Fai...
Deploy a single application and any found yaml configuration files .
35,428
public void deployCron ( ) throws MojoExecutionException { stager . stage ( ) ; try { deployMojo . getAppEngineFactory ( ) . deployment ( ) . deployCron ( configBuilder . buildDeployProjectConfigurationConfiguration ( appengineDirectory ) ) ; } catch ( AppEngineException ex ) { throw new MojoExecutionException ( "Faile...
Deploy only cron . yaml .
35,429
static Function < String , ManagedCloudSdk > newManagedSdkFactory ( ) { return ( version ) -> { try { if ( Strings . isNullOrEmpty ( version ) ) { return ManagedCloudSdk . newManagedSdk ( ) ; } else { return ManagedCloudSdk . newManagedSdk ( new Version ( version ) ) ; } } catch ( UnsupportedOsException | BadCloudSdkVe...
for delayed instantiation because it can error unnecessarily
35,430
public List < Path > getExtraFilesDirectories ( ) { return extraFilesDirectories == null ? null : extraFilesDirectories . stream ( ) . map ( File :: toPath ) . collect ( Collectors . toList ( ) ) ; }
Returns a nullable list of Path to user configured extra files directories .
35,431
public String getUrl ( ) { if ( getRepositoryUrl ( ) == null ) return null ; return getRepositoryUrl ( ) + "/" + getGroupId ( ) . replace ( '.' , '/' ) + "/" + getArtifactId ( ) + "/" + getVersion ( ) + "/" + getFileNameWithBaseVersion ( ) ; }
URL of the artifact on the maven repository on which it has been deployed if it has been deployed .
35,432
public void stop ( Throwable cause ) throws Exception { stopping = true ; if ( task != null ) { task . cancel ( true ) ; } super . stop ( cause ) ; }
If the computation is going synchronously try to cancel that .
35,433
public static List < MavenArtifact > isSameCause ( MavenDependencyCause newMavenCause , Cause oldMavenCause ) { if ( ! ( oldMavenCause instanceof MavenDependencyCause ) ) { return Collections . emptyList ( ) ; } List < MavenArtifact > newCauseArtifacts = Preconditions . checkNotNull ( newMavenCause . getMavenArtifacts ...
Return matching artifact if the given causes refer to common Maven artifact . Empty list if there are no matching artifact
35,434
private void setupJDK ( ) throws AbortException , IOException , InterruptedException { String jdkInstallationName = step . getJdk ( ) ; if ( StringUtils . isEmpty ( jdkInstallationName ) ) { console . println ( "[withMaven] using JDK installation provided by the build agent" ) ; return ; } if ( withContainer ) { LOGGER...
Setup the selected JDK . If none is provided nothing is done .
35,435
private String readFromProcess ( String ... args ) throws InterruptedException { try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ) { ProcStarter ps = launcher . launch ( ) ; Proc p = launcher . launch ( ps . cmds ( args ) . stdout ( baos ) ) ; int exitCode = p . join ( ) ; if ( exitCode == 0 ) { return...
Executes a command and reads the result to a string . It uses the launcher to run the command to make sure the launcher decorator is used ie . docker . image step
35,436
private FilePath createWrapperScript ( FilePath tempBinDir , String name , String content ) throws IOException , InterruptedException { FilePath scriptFile = tempBinDir . child ( name ) ; envOverride . put ( MVN_CMD , scriptFile . getRemote ( ) ) ; scriptFile . write ( content , getComputer ( ) . getDefaultCharset ( ) ...
Creates the actual wrapper script file and sets the permissions .
35,437
private String setupMavenLocalRepo ( ) throws IOException , InterruptedException { String expandedMavenLocalRepo ; if ( StringUtils . isEmpty ( step . getMavenLocalRepo ( ) ) ) { expandedMavenLocalRepo = null ; } else { String expandedPath = envOverride . expand ( env . expand ( step . getMavenLocalRepo ( ) ) ) ; if ( ...
Sets the maven repo location according to the provided parameter on the agent
35,438
private void globalSettingsFromConfig ( String mavenGlobalSettingsConfigId , FilePath mavenGlobalSettingsFile , Collection < Credentials > credentials ) throws AbortException { Config c = ConfigFiles . getByIdOrNull ( build , mavenGlobalSettingsConfigId ) ; if ( c == null ) { throw new AbortException ( "Could not find ...
Reads the global config file from Config File Provider expands the credentials and stores it in a file on the temp folder to use it with the maven wrapper script
35,439
private Computer getComputer ( ) throws AbortException { if ( computer != null ) { return computer ; } String node = null ; Jenkins j = Jenkins . getInstance ( ) ; for ( Computer c : j . getComputers ( ) ) { if ( c . getChannel ( ) == launcher . getChannel ( ) ) { node = c . getName ( ) ; break ; } } if ( node == null ...
Gets the computer for the current launcher .
35,440
protected DialectFactory createDialectFactory ( ) { DialectFactoryImpl factory = new DialectFactoryImpl ( ) ; factory . injectServices ( new ServiceRegistryImplementor ( ) { public < R extends Service > R getService ( Class < R > serviceRole ) { if ( serviceRole == DialectResolver . class ) { return ( R ) new StandardD...
should be using the ServiceRegistry but getting it from the SessionFactory at startup fails in Spring
35,441
protected boolean matchesFilter ( MetadataReader reader , MetadataReaderFactory readerFactory ) throws IOException { for ( TypeFilter filter : ENTITY_TYPE_FILTERS ) { if ( filter . match ( reader , readerFactory ) ) { return true ; } } return false ; }
Check whether any of the configured entity type filters matches the current class descriptor contained in the metadata reader .
35,442
public long deleteAll ( final QueryableCriteria criteria ) { return getHibernateTemplate ( ) . execute ( ( GrailsHibernateTemplate . HibernateCallback < Integer > ) session -> { JpaQueryBuilder builder = new JpaQueryBuilder ( criteria ) ; builder . setConversionService ( getMappingContext ( ) . getConversionService ( )...
Deletes all objects matching the given criteria .
35,443
public long updateAll ( final QueryableCriteria criteria , final Map < String , Object > properties ) { return getHibernateTemplate ( ) . execute ( ( GrailsHibernateTemplate . HibernateCallback < Integer > ) session -> { JpaQueryBuilder builder = new JpaQueryBuilder ( criteria ) ; builder . setConversionService ( getMa...
Updates all objects matching the given criteria and property values .
35,444
public static boolean isAtLeastVersion ( String required ) { String hibernateVersion = Hibernate . class . getPackage ( ) . getImplementationVersion ( ) ; if ( hibernateVersion != null ) { return GrailsVersion . isAtLeast ( hibernateVersion , required ) ; } else { return false ; } }
Check the current hibernate version
35,445
public static Query createQuery ( Session session , String query ) { return session . createQuery ( query ) ; }
Creates a query
35,446
private static PersistentProperty getGrailsDomainClassProperty ( AbstractHibernateDatastore datastore , Class < ? > targetClass , String propertyName ) { PersistentEntity grailsClass = datastore != null ? datastore . getMappingContext ( ) . getPersistentEntity ( targetClass . getName ( ) ) : null ; if ( grailsClass == ...
Get hold of the GrailsDomainClassProperty represented by the targetClass propertyName assuming targetClass corresponds to a GrailsDomainClass .
35,447
public static void cacheCriteriaByMapping ( Class < ? > targetClass , Criteria criteria ) { Mapping m = GrailsDomainBinder . getMapping ( targetClass ) ; if ( m != null && m . getCache ( ) != null && m . getCache ( ) . getEnabled ( ) ) { criteria . setCacheable ( true ) ; } }
Configures the criteria instance to cache based on the configured mapping .
35,448
public static FetchMode getFetchMode ( Object object ) { String name = object != null ? object . toString ( ) : "default" ; if ( name . equalsIgnoreCase ( FetchMode . JOIN . toString ( ) ) || name . equalsIgnoreCase ( "eager" ) ) { return FetchMode . JOIN ; } if ( name . equalsIgnoreCase ( FetchMode . SELECT . toString...
Retrieves the fetch mode for the specified instance ; otherwise returns the default FetchMode .
35,449
public static void setObjectToReadyOnly ( Object target , SessionFactory sessionFactory ) { Object resource = TransactionSynchronizationManager . getResource ( sessionFactory ) ; if ( resource != null ) { Session session = sessionFactory . getCurrentSession ( ) ; if ( canModifyReadWriteState ( session , target ) ) { if...
Sets the target object to read - only using the given SessionFactory instance . This avoids Hibernate performing any dirty checking on the object
35,450
public static void setObjectToReadWrite ( final Object target , SessionFactory sessionFactory ) { Session session = sessionFactory . getCurrentSession ( ) ; if ( ! canModifyReadWriteState ( session , target ) ) { return ; } SessionImplementor sessionImpl = ( SessionImplementor ) session ; EntityEntry ee = sessionImpl ....
Sets the target object to read - write allowing Hibernate to dirty check it and auto - flush changes .
35,451
public static void incrementVersion ( Object target ) { MetaClass metaClass = GroovySystem . getMetaClassRegistry ( ) . getMetaClass ( target . getClass ( ) ) ; if ( metaClass . hasProperty ( target , GormProperties . VERSION ) != null ) { Object version = metaClass . getProperty ( target , GormProperties . VERSION ) ;...
Increments the entities version number in order to force an update
35,452
public static void ensureCorrectGroovyMetaClass ( Object target , Class < ? > persistentClass ) { if ( target instanceof GroovyObject ) { GroovyObject go = ( ( GroovyObject ) target ) ; if ( ! go . getMetaClass ( ) . getTheClass ( ) . equals ( persistentClass ) ) { go . setMetaClass ( GroovySystem . getMetaClassRegistr...
Ensures the meta class is correct for a given class
35,453
public static HibernateProxy getAssociationProxy ( Object obj , String associationName ) { return proxyHandler . getAssociationProxy ( obj , associationName ) ; }
Returns the proxy for a given association or null if it is not proxied
35,454
public void enableMultiTenancyFilter ( ) { Serializable currentId = Tenants . currentId ( this ) ; if ( ConnectionSource . DEFAULT . equals ( currentId ) ) { disableMultiTenancyFilter ( ) ; } else { getHibernateTemplate ( ) . getSessionFactory ( ) . getCurrentSession ( ) . enableFilter ( GormProperties . TENANT_IDENTIT...
Enable the tenant id filter for the given datastore and entity
35,455
public static void configureNamingStrategy ( final Object strategy ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { configureNamingStrategy ( ConnectionSource . DEFAULT , strategy ) ; }
Override the default naming strategy for the default datasource given a Class or a full class name .
35,456
public static void configureNamingStrategy ( final String datasourceName , final Object strategy ) throws ClassNotFoundException , InstantiationException , IllegalAccessException { Class < ? > namingStrategyClass = null ; NamingStrategy namingStrategy ; if ( strategy instanceof Class < ? > ) { namingStrategyClass = ( C...
Override the default naming strategy given a Class or a full class name or an instance of a NamingStrategy .
35,457
protected boolean isUnidirectionalOneToMany ( PersistentProperty property ) { return ( ( property instanceof org . grails . datastore . mapping . model . types . OneToMany ) && ! ( ( Association ) property ) . isBidirectional ( ) ) ; }
Checks whether a property is a unidirectional non - circular one - to - many
35,458
protected void bindDependentKeyValue ( PersistentProperty property , DependantValue key , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "[GrailsDomainBinder] binding [" + property . getName ( ) + "] with dependant key" ) ; } PersistentEntity refD...
Binds the primary key value column
35,459
protected DependantValue createPrimaryKeyValue ( InFlightMetadataCollector mappings , PersistentProperty property , Collection collection , Map < ? , ? > persistentClasses ) { KeyValue keyValue ; DependantValue key ; String propertyRef = collection . getReferencedPropertyName ( ) ; if ( propertyRef == null ) { keyValue...
Creates the DependentValue object that forms a primary key reference for the collection .
35,460
protected void bindUnidirectionalOneToMany ( org . grails . datastore . mapping . model . types . OneToMany property , InFlightMetadataCollector mappings , Collection collection ) { Value v = collection . getElement ( ) ; v . createForeignKey ( ) ; String entityName ; if ( v instanceof ManyToOne ) { ManyToOne manyToOne...
Binds a unidirectional one - to - many creating a psuedo back reference property in the process .
35,461
protected void linkBidirectionalOneToMany ( Collection collection , PersistentClass associatedClass , DependantValue key , PersistentProperty otherSide ) { collection . setInverse ( true ) ; Iterator < ? > mappedByColumns = getProperty ( associatedClass , otherSide . getName ( ) ) . getValue ( ) . getColumnIterator ( )...
Links a bidirectional one - to - many configuring the inverse side and using a column copy to perform the link
35,462
protected void bindCollection ( ToMany property , Collection collection , PersistentClass owner , InFlightMetadataCollector mappings , String path , String sessionFactoryBeanName ) { String propertyName = getNameForPropertyAndPath ( property , path ) ; collection . setRole ( qualify ( property . getOwner ( ) . getName ...
First pass to bind collection to Hibernate metamodel sets up second pass
35,463
protected String calculateTableForMany ( ToMany property , String sessionFactoryBeanName ) { NamingStrategy namingStrategy = getNamingStrategy ( sessionFactoryBeanName ) ; String propertyColumnName = namingStrategy . propertyToColumnName ( property . getName ( ) ) ; PropertyConfig config = getPropertyConfig ( property ...
Calculates the mapping table for a many - to - many . One side of the relationship has to own the relationship so that there is not a situation where you have two mapping tables for left_right and right_left
35,464
protected String getTableName ( PersistentEntity domainClass , String sessionFactoryBeanName ) { Mapping m = getMapping ( domainClass ) ; String tableName = null ; if ( m != null && m . getTableName ( ) != null ) { tableName = m . getTableName ( ) ; } if ( tableName == null ) { String shortName = domainClass . getJavaC...
Evaluates the table name for the given property
35,465
public void bindClass ( PersistentEntity entity , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) throws MappingException { if ( entity . isRoot ( ) ) { bindRoot ( ( HibernatePersistentEntity ) entity , mappings , sessionFactoryBeanName ) ; } }
Binds a Grails domain class to the Hibernate runtime meta model
35,466
protected void trackCustomCascadingSaves ( Mapping mapping , Iterable < PersistentProperty > persistentProperties ) { for ( PersistentProperty property : persistentProperties ) { PropertyConfig propConf = mapping . getPropertyConfig ( property . getName ( ) ) ; if ( propConf != null && propConf . getCascade ( ) != null...
Checks for any custom cascading saves set up via the mapping DSL and records them within the persistent property .
35,467
protected boolean isSaveUpdateCascade ( String cascade ) { String [ ] cascades = cascade . split ( "," ) ; for ( String cascadeProp : cascades ) { String trimmedProp = cascadeProp . trim ( ) ; if ( CASCADE_SAVE_UPDATE . equals ( trimmedProp ) || CASCADE_ALL . equals ( trimmedProp ) || CASCADE_ALL_DELETE_ORPHAN . equals...
Check if a save - update cascade is defined within the Hibernate cascade properties string .
35,468
protected void bindClass ( PersistentEntity domainClass , PersistentClass persistentClass , InFlightMetadataCollector mappings ) { persistentClass . setLazy ( true ) ; final String entityName = domainClass . getName ( ) ; persistentClass . setEntityName ( entityName ) ; persistentClass . setJpaEntityName ( unqualify ( ...
Binds the specified persistant class to the runtime model based on the properties defined in the domain class
35,469
protected void addMultiTenantFilterIfNecessary ( HibernatePersistentEntity entity , PersistentClass persistentClass , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { if ( entity . isMultiTenant ( ) ) { TenantId tenantId = entity . getTenantId ( ) ; if ( tenantId != null ) { String filterCondition...
Add a Hibernate filter for multitenancy if the persistent class is multitenant
35,470
protected void bindSubClasses ( HibernatePersistentEntity domainClass , PersistentClass parent , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { final java . util . Collection < PersistentEntity > subClasses = domainClass . getMappingContext ( ) . getDirectChildEntities ( domainClass ) ; for ( Pe...
Binds the sub classes of a root class using table - per - heirarchy inheritance mapping
35,471
protected void bindSubClass ( HibernatePersistentEntity sub , PersistentClass parent , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { evaluateMapping ( sub , defaultMapping ) ; Mapping m = getMapping ( parent . getMappedClass ( ) ) ; Subclass subClass ; boolean tablePerSubclass = m != null && ! ...
Binds a sub class .
35,472
protected void bindJoinedSubClass ( HibernatePersistentEntity sub , JoinedSubclass joinedSubclass , InFlightMetadataCollector mappings , Mapping gormMapping , String sessionFactoryBeanName ) { bindClass ( sub , joinedSubclass , mappings ) ; String schemaName = getSchemaName ( mappings ) ; String catalogName = getCatalo...
Binds a joined sub - class mapping using table - per - subclass
35,473
protected void bindSubClass ( HibernatePersistentEntity sub , Subclass subClass , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { bindClass ( sub , subClass , mappings ) ; if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "Mapping subclass: " + subClass . getEntityName ( ) + " -> " + subClass . getTa...
Binds a sub - class using table - per - hierarchy inheritance mapping
35,474
protected void bindDiscriminatorProperty ( Table table , RootClass entity , InFlightMetadataCollector mappings ) { Mapping m = getMapping ( entity . getMappedClass ( ) ) ; SimpleValue d = new SimpleValue ( metadataBuildingContext , table ) ; entity . setDiscriminator ( d ) ; DiscriminatorConfig discriminatorConfig = m ...
Creates and binds the discriminator property used in table - per - hierarchy inheritance to discriminate between sub class instances
35,475
protected void bindComponent ( Component component , Embedded property , boolean isNullable , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { component . setEmbedded ( true ) ; Class < ? > type = property . getType ( ) ; String role = qualify ( type . getName ( ) , property . getName ( ) ) ; comp...
Binds a Hibernate component type using the given GrailsDomainClassProperty instance
35,476
@ SuppressWarnings ( "unchecked" ) protected void bindManyToOne ( Association property , ManyToOne manyToOne , String path , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { NamingStrategy namingStrategy = getNamingStrategy ( sessionFactoryBeanName ) ; bindManyToOneValues ( property , manyToOne ) ...
Binds a many - to - one relationship to the
35,477
private int calculateForeignKeyColumnCount ( PersistentEntity refDomainClass , String [ ] propertyNames ) { int expectedForeignKeyColumnLength = 0 ; for ( String propertyName : propertyNames ) { PersistentProperty referencedProperty = refDomainClass . getPropertyByName ( propertyName ) ; if ( referencedProperty instanc...
number of columns required for a column key we have to perform the calculation here
35,478
protected void bindProperty ( PersistentProperty grailsProperty , Property prop , InFlightMetadataCollector mappings ) { prop . setName ( grailsProperty . getName ( ) ) ; if ( isBidirectionalManyToOneWithListMapping ( grailsProperty , prop ) ) { prop . setInsertable ( false ) ; prop . setUpdateable ( false ) ; } else {...
Binds a property to Hibernate runtime meta model . Deals with cascade strategy based on the Grails domain model
35,479
protected void bindSimpleValue ( PersistentProperty property , PersistentProperty parentProperty , SimpleValue simpleValue , String path , InFlightMetadataCollector mappings , String sessionFactoryBeanName ) { bindSimpleValue ( property , parentProperty , simpleValue , path , getPropertyConfig ( property ) , sessionFac...
Binds a simple value to the Hibernate metamodel . A simple value is any type within the Hibernate type system
35,480
protected void bindSimpleValue ( String type , SimpleValue simpleValue , boolean nullable , String columnName , InFlightMetadataCollector mappings ) { simpleValue . setTypeName ( type ) ; Table t = simpleValue . getTable ( ) ; Column column = new Column ( ) ; column . setNullable ( nullable ) ; column . setValue ( simp...
Binds a value for the specified parameters to the meta model .
35,481
protected void bindStringColumnConstraints ( Column column , PersistentProperty constrainedProperty ) { final org . grails . datastore . mapping . config . Property mappedForm = constrainedProperty . getMapping ( ) . getMappedForm ( ) ; Number columnLength = mappedForm . getMaxSize ( ) ; List < ? > inListValues = mappe...
Interrogates the specified constraints looking for any constraints that would limit the length of the property s value . If such constraints exist this method adjusts the length of the column accordingly .
35,482
public org . grails . datastore . mapping . query . api . ProjectionList property ( String propertyName , String alias ) { final PropertyProjection propertyProjection = Projections . property ( calculatePropertyName ( propertyName ) ) ; addProjectionToList ( propertyProjection , alias ) ; return this ; }
A projection that selects a property name
35,483
protected void addProjectionToList ( Projection propertyProjection , String alias ) { if ( alias != null ) { projectionList . add ( propertyProjection , alias ) ; } else { projectionList . add ( propertyProjection ) ; } }
Adds a projection to the projectList for the given alias
35,484
public org . grails . datastore . mapping . query . api . ProjectionList distinct ( String propertyName , String alias ) { final Projection proj = Projections . distinct ( Projections . property ( calculatePropertyName ( propertyName ) ) ) ; addProjectionToList ( proj , alias ) ; return this ; }
A projection that selects a distince property name
35,485
public BuildableCriteria join ( String associationPath ) { criteria . setFetchMode ( calculatePropertyName ( associationPath ) , FetchMode . JOIN ) ; return this ; }
Use a join query
35,486
public void lock ( boolean shouldLock ) { String lastAlias = getLastAlias ( ) ; if ( shouldLock ) { if ( lastAlias != null ) { criteria . setLockMode ( lastAlias , LockMode . PESSIMISTIC_WRITE ) ; } else { criteria . setLockMode ( LockMode . PESSIMISTIC_WRITE ) ; } } else { if ( lastAlias != null ) { criteria . setLock...
Whether a pessimistic lock should be obtained .
35,487
public BuildableCriteria select ( String associationPath ) { criteria . setFetchMode ( calculatePropertyName ( associationPath ) , FetchMode . SELECT ) ; return this ; }
Use a select query
35,488
protected String calculatePropertyName ( String propertyName ) { String lastAlias = getLastAlias ( ) ; if ( lastAlias != null ) { return lastAlias + '.' + propertyName ; } return propertyName ; }
Calculates the property name including any alias paths
35,489
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) protected Object calculatePropertyValue ( Object propertyValue ) { if ( propertyValue instanceof CharSequence ) { return propertyValue . toString ( ) ; } if ( propertyValue instanceof QueryableCriteria ) { propertyValue = convertToHibernateCriteria ( ( QueryableCriter...
Calculates the property value converting GStrings if necessary
35,490
public void count ( String propertyName , String alias ) { final CountProjection proj = Projections . count ( calculatePropertyName ( propertyName ) ) ; addProjectionToList ( proj , alias ) ; }
Adds a projection that allows the criteria to return the property count
35,491
public org . grails . datastore . mapping . query . api . ProjectionList groupProperty ( String propertyName , String alias ) { final PropertyProjection proj = Projections . groupProperty ( calculatePropertyName ( propertyName ) ) ; addProjectionToList ( proj , alias ) ; return this ; }
Adds a projection that allows the criteria s result to be grouped by a property
35,492
public org . grails . datastore . mapping . query . api . ProjectionList min ( String propertyName , String alias ) { final AggregateProjection aggregateProjection = Projections . min ( calculatePropertyName ( propertyName ) ) ; addProjectionToList ( aggregateProjection , alias ) ; return this ; }
Adds a projection that allows the criteria to retrieve a minimum property value
35,493
public org . grails . datastore . mapping . query . api . ProjectionList sum ( String propertyName , String alias ) { final AggregateProjection proj = Projections . sum ( calculatePropertyName ( propertyName ) ) ; addProjectionToList ( proj , alias ) ; return this ; }
Adds a projection that allows the criteria to retrieve the sum of the results of a property
35,494
public void fetchMode ( String associationPath , FetchMode fetchMode ) { if ( criteria != null ) { criteria . setFetchMode ( associationPath , fetchMode ) ; } }
Sets the fetch mode of an associated path
35,495
public Criteria createAlias ( String associationPath , String alias ) { return criteria . createAlias ( associationPath , alias ) ; }
Join an association assigning an alias to the joined association .
35,496
public org . grails . datastore . mapping . query . api . Criteria geProperty ( String propertyName , String otherPropertyName ) { if ( ! validateSimpleExpression ( ) ) { throwRuntimeException ( new IllegalArgumentException ( "Call to [geProperty] with propertyName [" + propertyName + "] and other property name [" + ot...
Creates a Criterion that tests if the first property is greater than or equal to the second property
35,497
public org . grails . datastore . mapping . query . api . Criteria le ( String propertyName , Object propertyValue ) { if ( ! validateSimpleExpression ( ) ) { throwRuntimeException ( new IllegalArgumentException ( "Call to [le] with propertyName [" + propertyName + "] and value [" + propertyValue + "] not allowed here....
Creates a less than or equal to Criterion based on the specified property name and value
35,498
@ SuppressWarnings ( "rawtypes" ) public org . grails . datastore . mapping . query . api . Criteria inList ( String propertyName , Collection values ) { return in ( propertyName , values ) ; }
Delegates to in as in is a Groovy keyword
35,499
public org . grails . datastore . mapping . query . api . Criteria order ( String propertyName , String direction ) { if ( criteria == null ) { throwRuntimeException ( new IllegalArgumentException ( "Call to [order] with propertyName [" + propertyName + "]not allowed here." ) ) ; } propertyName = calculatePropertyName ...
Orders by the specified property name and direction