source: trunk/grails-app/controllers/nl/tno/metagenomics/integration/SynchronizeController.groovy @ 16

Last change on this file since 16 was 16, checked in by robert@…, 13 years ago

Improvement of the synchronization error handling and changes for deploying the module to dbnptest

File size: 1.2 KB
Line 
1package nl.tno.metagenomics.integration
2
3
4class SynchronizeController {
5        def synchronizationService
6       
7        // Show a 'waiting' page and perform a full synchronization afterwards
8    def full = { 
9                def redirectUrl = params.redirect;
10               
11                if( !redirectUrl )
12                        redirectUrl = g.createLink( controller: 'run' );
13               
14                // Set the date of last synchronization to now. Doing it here, prevents the
15                // application of entering an infinite loop if an error occurs:
16                //              /study                  -> redirect to synchronization
17                //              /synchronize    -> fails with an error, redirects to /study
18                //                      etc...
19                // synchronizationService.lastFullSynchronization = new Date();
20                [ url: redirectUrl ]
21        }
22       
23        def perform = {
24                try {
25                        synchronizationService.sessionToken = session.sessionToken
26                        synchronizationService.user = session.user
27       
28                        synchronizationService.fullSynchronization();
29                        render "";
30                } catch( Exception e ) {
31                        // Catch all exceptions, show them to the user (by rendering a text message) and print a stacktrace
32                        log.error "Exception during full synchronization: " + e.getMessage()
33                        e.printStackTrace()
34                       
35                        render "An error occurred during synchronization (" + e.class?.name + "): " + e.getMessage();
36                }
37        }
38}
Note: See TracBrowser for help on using the repository browser.