source: trunk/grails-app/domain/InventoryGroup.groovy @ 672

Last change on this file since 672 was 622, checked in by gav, 14 years ago

Apply bug fix for ticket #76.
Rename all instances of Lucene to Searchable.
Improved global directory config.
Add log levels for searchable plugin and compass.

File size: 882 bytes
Line 
1import org.codehaus.groovy.grails.commons.ConfigurationHolder
2
3class InventoryGroup {
4    String name
5    String description = ""
6    boolean isActive = true
7
8    static hasMany = [inventoryItems : InventoryItem]
9
10    static constraints = {
11        name(maxSize:50,unique:true,blank:false)
12        description(maxSize:100)
13    }
14
15    String toString() {"${this.name}"}
16
17    static searchable = {
18        root false // only index as a component of InventoryItem.
19        only = ['name']
20    }
21
22    def afterUpdate = {
23        // Update the Inventory searchable index, since cascading in searchable-0.5.5 is broken.
24        if(ConfigurationHolder.config.appSearchable.cascadeOnUpdate) {
25            try {
26                InventoryIndexJob.triggerNow(['calledBy':'InventoryGroup afterUpdate{}'])
27            }
28            catch(e) {log.error e}
29        } // if
30    } // afterUpdate
31
32}
Note: See TracBrowser for help on using the repository browser.