001/*
002 *                    BioJava development code
003 *
004 * This code may be freely distributed and modified under the
005 * terms of the GNU Lesser General Public Licence.  This should
006 * be distributed with the code.  If you do not have a copy,
007 * see:
008 *
009 *      http://www.gnu.org/copyleft/lesser.html
010 *
011 * Copyright for this code is held jointly by the individual
012 * authors.  These should be listed in @author doc comments.
013 *
014 * For more information on the BioJava project and its aims,
015 * or to join the biojava-l mailing list, visit the home page
016 * at:
017 *
018 *      http://www.biojava.org/
019 *
020 */
021package org.biojava.bio.program.blast2html;
022
023import java.util.Properties;
024
025
026/**
027 * Simple URL generator for Entrez at the NCBI.
028 *
029 * Primary author -
030 *                 Colin Hardman      (CAT)
031 * Other authors  -
032 *                 Tim Dilks          (CAT)
033 *                 Simon Brocklehurst (CAT)
034 *                 Stuart Johnston    (CAT)
035 *                 Lawerence Bower    (CAT)
036 *                 Derek Crockford    (CAT)
037 *                 Neil Benn          (CAT)
038 *
039 * Copyright 2001 Cambridge Antibody Technology Group plc.
040 *
041 * This code released to the biojava project, May 2001
042 * under the LGPL license.
043 *
044 * @author Cambridge Antibody Technology Group plc
045 * @version 1.0
046 */
047public class NcbiDatabaseURLGenerator implements DatabaseURLGenerator {
048
049    public String toURL( String poID,  Properties poProperties ) {
050
051        int index = poID.indexOf( ";" );
052        if ( index != -1 ) {
053            poID = poID.substring( 0, index );
054        }
055
056        return "http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Search&db=".concat( poProperties.getProperty( "db" )).
057            concat( "&term=").concat( poID );
058    }
059
060    public String toLink( String poID, Properties poProperties ) {
061        return "[<A class=\"dbRetrieve\" HREF=\"".concat
062            ( this.toURL( poID, poProperties ) ).concat
063            ( "\">retrieve hit from ncbi</A>]");
064    }
065}