Ignore:
Timestamp:
Jun 3, 2010, 12:27:08 PM (7 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.

File:
1 edited

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}
Note: See TracChangeset for help on using the changeset viewer.