Show
Ignore:
Timestamp:
03-06-10 12:27:08 (4 years ago)
Author:
roberth
Message:

Publications can be added to a study in the create study wizard. Publications are searched for on Pubmed, and when needed, added to the system.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/studycapturing/PublicationController.groovy

    r496 r518  
    144144        } 
    145145    } 
     146 
     147    /** 
     148     * Searches for an ID in the current database, based on the pubMedID 
     149     * If the publication is not found in the database, it is added 
     150     */ 
     151    def getID = { 
     152        // Find the ID 
     153        def pubMedID = params.get( 'publication-pubMedID' ); 
     154        if( pubMedID ) { 
     155            def publication = Publication.findByPubMedID( pubMedID ); 
     156            if( !publication ) { 
     157                publication = new Publication( 
     158                    title: params.get( 'publication-title' ), 
     159                    authorsList: params.get( 'publication-authorsList' ), 
     160                    pubMedID: params.get( 'publication-pubMedID' ), 
     161                    DOI: params.get( 'publication-doi' ) 
     162                ).save(flush:true); 
     163            } 
     164 
     165            // Return the ID 
     166            render publication.id; 
     167        } else { 
     168            response.status = 500; 
     169            render "No pubMedID found in request"; 
     170        } 
     171    } 
    146172}