grails

Access job parameter in ItemReader (spring-batch using grails)

孤者浪人 提交于 2020-01-06 07:53:33
问题 I am launching a job from my service and code look like def jobParameters = new JobParametersBuilder() .addDate('toDate',toDate) .addDate('fromDate',fromDate) def jobEx = jobLauncher.run(billProcessJob,jobParameters.toJobParameters()) And it is executing successfully. But I need to access above job parameter in my Item Reader. My Item Reader looks like class MyDomainMapper implements FieldSetMapper { def mapLine(FieldSet fs) { if(!fs) { return null } log.debug('Record:'+fs);//Printing the

When does Grails assign an ID to an object?

≯℡__Kan透↙ 提交于 2020-01-06 06:55:18
问题 A Grails 2.3.4 application is connecting to an Oracle database using the following domain class: class Person { String name static mapping = { id column: "PERSON_ID", generator: "sequence", params: [sequence: 'person_seq'] } } The PersonController makes a call to a method in PersonService and it makes a call to UtilService . The method in UtilService being called has some logic based on wether this Person object is new: if (personInstance.id == null) { ... } What I have found is that the id

Spring security plugin not throwing events

我们两清 提交于 2020-01-06 06:52:34
问题 I am in the process of migrating to spring security plugin from acegi plugin.Currently working on grails environment. I am facing a weird issue as my authentication success event and authentication bad credentials event does not throw at all.I added println statements in the callback in config.groovy and also through listeners.However i can catch events like InteractiveAuthenticationSuccessEvent. Please do reply if you have gone through the same issue 回答1: As mentioned in Chapter 5 of the

Grails Spring Security UI Register Flash Messages

半世苍凉 提交于 2020-01-06 06:39:46
问题 I use the Spring Security UI Plugin. I dont want to use the view generated by Spring Security UI, but my own one. Therefore I want to show an error messages in my register/index view. How can I show the error messages in a list? I would like to have this in my view: <g:if test="${flash.message}"> <bootstrap:alert class="alert-info">${flash.message}</bootstrap:alert> </g:if> When i put this lines there, no error messages are shown. But in the generated register view errors are shown. When i

Grails Spring Security UI Register Flash Messages

自闭症网瘾萝莉.ら 提交于 2020-01-06 06:39:05
问题 I use the Spring Security UI Plugin. I dont want to use the view generated by Spring Security UI, but my own one. Therefore I want to show an error messages in my register/index view. How can I show the error messages in a list? I would like to have this in my view: <g:if test="${flash.message}"> <bootstrap:alert class="alert-info">${flash.message}</bootstrap:alert> </g:if> When i put this lines there, no error messages are shown. But in the generated register view errors are shown. When i

grails grom create criteria with many-to-many mapping

江枫思渺然 提交于 2020-01-06 04:41:26
问题 I have two domain classes: User and Book. class Book implements Serializable{ String bookName Timestamp createdDateTime Blob file static belongsTo = [User] static hasMany = [user :User] } I am able to add user in book using addToUser() method. But I am stuck in create criteria while applying filter in user. def query = Book.createCriteria(); def results = query.list () { eq("user",userObject) // not working since user field is a list of users. order("createdDateTime", "desc") } Please help me

How to get data from another data base in runtime

霸气de小男生 提交于 2020-01-06 04:35:12
问题 I need an optimal way to change Database in run-time, whether from hibernate or from JNDI or another. I need to change the database when a user clicks on a specific button (Change dependencies on events). 回答1: If you are running Grails 1.3.x you can to use the Burt Beckwith's Datasources plugin, in Grails 2.x that feature has been added to core. Then you can to use a parameter to pass database connection name def database = params.database if(!database) database = "default" and to use Groovy

Grails: Where is the startGrails script in Eclipse/STS on the Mac?

邮差的信 提交于 2020-01-06 04:24:06
问题 In order to fix another problem (Stackoverflow Question 6367763) I needed to modify the startGrails script. I made the necessary updates however the modifications are not being picked up when I run Grails commands from within Eclipse/STS. I put debug in the script and know it is functioning correctly when I call it directly from the command line. However STS appears to be running the original version. Does STS have another copy of the startGrails script? How can I update this one or ensure

Grails updating values in form using Ajax

笑着哭i 提交于 2020-01-06 03:44:05
问题 I have two groups of radio buttons, the first group represents size and the second group represents quantity along with price. I'm trying to update the price next to quantity with Ajax when changing the size radio has been changed. What I have thus far. <script> $(document).ready(function(){ $("input[name*='size']").click(function() { ${remoteFunction( controller:'product', action:'ajaxSize', params:'\'size=\' + this.value')} }) }); </script> <g:formRemote name="myForm" url="[controller:

Faker for Grails gives variable not defined error

∥☆過路亽.° 提交于 2020-01-06 03:42:06
问题 I have a Grails 2.4.4 application configured with spring-security-core. I want to generate fake users in the BootStrap using the faker plugin. However when I instantiate the bean fakerService in BootStrap and try using it ie. fakerService.firstname() , I get an error : ERROR context.GrailsContextLoaderListener - Error initializing the application: Cannot invoke method firstName() on null object Message: Cannot invoke method firstName() on null object I'm just a beginner in Grails. Am I doing