source: trunk/grails-app/domain/InventoryLocation.groovy @ 865

Last change on this file since 865 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: 895 bytes
Line 
1import org.codehaus.groovy.grails.commons.ConfigurationHolder
2
3class InventoryLocation {
4
5    InventoryStore inventoryStore
6    String name
7    Boolean isActive = true
8
9    static hasMany = [inventoryItems: InventoryItem]
10
11//     static belongsTo = [InventoryStore]
12
13    static constraints = {
14        name(maxSize:50)
15    }
16
17    String toString() {
18        "${this.name}"
19    }
20
21    static searchable = {
22        root false // only index as a component of InventoryItem.
23        only = ['name']
24    }
25
26    def afterUpdate = {
27        // Update the Inventory searchable index, since cascading in searchable-0.5.5 is broken.
28        if(ConfigurationHolder.config.appSearchable.cascadeOnUpdate) {
29            try {
30                InventoryIndexJob.triggerNow(['calledBy':'InventoryLocation afterUpdate{}'])
31            }
32            catch(e) {log.error e}
33        } // if
34    } // afterUpdate
35
36}
Note: See TracBrowser for help on using the repository browser.