All pastes #188627 Raw Edit

Untitled

public java v1 · immutable
·published 2006-10-02 09:59 UTC
rendered paste body
package doc.client;import java.util.ArrayList;import doc.bo.Document;import doc.bo.DocumentSearcher;/** * Client class of the DocumentSearcher. It's the interface to the enduser * @author Michael Glatter-Götz * <PRE> *         ID       date        description *         michael 02.10.2006   creation * </PRE> **/public class DocumentClient{    /**     * Main method which handles the command line parameters given by the user     * @param asArgs Array of parameters     **/    public static void main(String[] asArgs)    {        DocumentSearcher oDocumentSearcher = new DocumentSearcher();                if ((asArgs[0].contentEquals("-findAll")) && (asArgs.length == 1))        {            ArrayList<Document> _aoAllDocuments = oDocumentSearcher.findAll();                        for (Document i : _aoAllDocuments)            {                System.out.println(i.toString());            }        }                else if ((asArgs[0].contentEquals("-find")) && (asArgs.length == 2))        {            ArrayList<Document> aoFoundDocuments = oDocumentSearcher.findByAuthor(asArgs[1]);                        for (Document i : aoFoundDocuments)            {                System.out.println(i.toString());            }        }                else         {            usage();        }    }        /**     * Prints usage information for the DocumentClient     **/    public static void usage()    {        String sOut = "";        sOut += "Usage of the DocumentClient:\n";        sOut += "DocumentClient action [search string]\n\n";        sOut += "action:\n";        sOut += "    -findAll        finds and prints all documents\n";        sOut += "    -find [param]   finds all documents written by the given author (param)";                System.out.println(sOut);    }}