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

Last change on this file since 901 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
RevLine 
[622]1import org.codehaus.groovy.grails.commons.ConfigurationHolder
2
[175]3class InventoryLocation {
[116]4
5    InventoryStore inventoryStore
[175]6    String name
[116]7    Boolean isActive = true
8
[175]9    static hasMany = [inventoryItems: InventoryItem]
[116]10
[175]11//     static belongsTo = [InventoryStore]
[116]12
13    static constraints = {
[175]14        name(maxSize:50)
[116]15    }
16
17    String toString() {
[389]18        "${this.name}"
[116]19    }
[562]20
21    static searchable = {
22        root false // only index as a component of InventoryItem.
23        only = ['name']
24    }
25
[622]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
[116]36}
Note: See TracBrowser for help on using the repository browser.