Last change
on this file since 954 was
920,
checked in by gav, 13 years ago
|
Svn merge -r874:r919 trunk/ into branches/features/purchaseOrders.
This brings the purchaseOrder branch fully up to date.
|
File size:
1.6 KB
|
Line | |
---|
1 | import org.codehaus.groovy.grails.commons.ConfigurationHolder |
---|
2 | |
---|
3 | /** |
---|
4 | * Provides a quartz job that rebuilds the searchable index for the inventory search. |
---|
5 | * With concurrent=false the next job is blocked until the previous job completes. |
---|
6 | * We need a hibernate session otherwise we get a LazyInitializationException, default is true but we specify it to be sure. |
---|
7 | * Rebuilding the index is required since searchable components are not updated when they change, that is |
---|
8 | * until the parent is updated and reindexed. Cascade update is broken in searchable-0.5.5 |
---|
9 | */ |
---|
10 | class InventoryIndexJob { |
---|
11 | |
---|
12 | def concurrent = false |
---|
13 | def sessionRequired = true |
---|
14 | |
---|
15 | static triggers = { |
---|
16 | // Cron fields: |
---|
17 | // 'Seconds Minutes Hours DOM Month DOW Year(Optional)' |
---|
18 | // See: http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html |
---|
19 | // Trigger every hour on the hour: |
---|
20 | //cron name: 'RebuildInventoryIndex', cronExpression: "0 0 * * * ?" |
---|
21 | } |
---|
22 | |
---|
23 | def execute(context) { |
---|
24 | |
---|
25 | // Some information can be accessed if we run with "def execute(context) ". |
---|
26 | // For more info see: http://quartz.sourceforge.net/javadoc/org/quartz/JobExecutionContext.html |
---|
27 | // log.debug context.getTrigger() |
---|
28 | // log.debug context.getPreviousFireTime() |
---|
29 | // log.debug context.getFireTime() |
---|
30 | |
---|
31 | // Called by. |
---|
32 | def calledBy = context.mergedJobDataMap.get('calledBy') |
---|
33 | log.info "Called By: " + calledBy |
---|
34 | |
---|
35 | // Rebuild the Inventory searchable index. |
---|
36 | log.info "Calling, Inventory.index()." |
---|
37 | InventoryItem.index() |
---|
38 | } |
---|
39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.