Ignore:
Timestamp:
Apr 12, 2011, 3:39:13 PM (9 years ago)
Author:
robert@…
Message:
  • Added sequence length histograms
  • Fixed bugs in files that remained on the file system after uploading (while they shouldn't)
  • Added extra options in run- and assay screens
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/nl/tno/massSequencing/FastaController.groovy

    r44 r49  
    22
    33import org.codehaus.groovy.grails.commons.ConfigurationHolder
     4import org.hibernate.SessionFactory
    45import grails.converters.*;
    56
     
    78        def fileService
    89        def fastaService
     10        def sessionFactory
    911       
    1012        /**************************************************************************
     
    187189        }
    188190
     191        /**
     192         * Returns from the upload wizard without saving the data. The uploaded files are removed
     193         */
     194        def returnWithoutSaving = {
     195                // Delete all uploaded files from disk
     196                session.processedFiles?.parsed?.success?.each {
     197                        fileService.delete( it.filename );
     198                }
     199
     200                // Redirect to the correct controller           
     201                switch( params.entityType ) {
     202                        case "run":
     203                        case "assay":
     204                                redirect( controller: params.entityType, action: "show", id: params.id );
     205                                return;
     206                        default:
     207                                response.setStatus( 404, "No entity found" );
     208                                render "";
     209                                return;
     210                }
     211               
     212               
     213        }
     214       
    189215        /**
    190216         * Saves processed files to the database, based on the selections made by the user
     
    266292                }
    267293
     294                // Return all files that have not been moved
     295                session.processedFiles?.parsed?.success?.each {
     296                        fileService.delete( it.filename );
     297                }
     298               
    268299                // Return a message to the user
    269300                if( numSuccesful == 0 ) {
     
    321352                 
    322353                def numFiles = sequenceData.numFiles();
    323                 sequenceData.delete();
    324 
     354                def sample = sequenceData.sample;
     355                 
     356                // Set flushmode to auto, since otherwise the sequencedata will
     357                // not be removed
     358                sessionFactory.getCurrentSession().setFlushMode( org.hibernate.FlushMode.AUTO );
     359               
     360                sample.removeFromSequenceData( sequenceData );
     361                sequenceData.delete(flush:true);
     362                sample.resetStats();
     363                sample.save();
     364               
    325365                flash.message = numFiles + " file" + (numFiles != 1 ? "s have" : " has" ) + " been deleted from this sample"
    326366
Note: See TracChangeset for help on using the changeset viewer.