|
Hi all!
I'm writing an archival tool for one of our systems, and have a property in one of my domain objects which should be a folder local to the server. I first tried to use a service: def fileService But that failed with MissingPropertyExceptions on the fileService (oddly, suggesting I tried fileService): Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is groovy.lang.MissingPropertyException: No such property: fileService for class: org.picr.workflow.Project So then, I got rid of the service, and tried this: static constraints = { This works, but fetches the foldernames at startup, and then does not update when the folder structure updates Is there any way to get this constraint to update? Cheers, Tim |
|
Hi Tim,
You are using the 'inList'. Wouldn't it be better to use custom validation in this case? Maybe something like: static constraints = { (new File( CH.config.folder.origin ).listFiles().findAll { it.directory }*.name }()).contains(val) ) Haven't tested it though, so it might not work Erik Pragt On 6 jul 2010, at 11:17, Tim Yates wrote: Hi all! |
|
Hi Erik!
Yeah, that works great! Thanks!! :-) I was trying to use inList, as the same bit of code could fill my select box in the view as well (hence my first thought of using a service) But I'll stick with this now as it works :-) Shame we can't use services in custom validators though, as it would eliminate the code duplication Thanks again, Tim On Tue, Jul 6, 2010 at 11:13 AM, Erik Pragt <[hidden email]> wrote:
|
| Powered by Nabble | Edit this page |
