|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Query.java | 100% | 100% | 100% | 100% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* Copyright (C) 2003, Marco Jansen / Contrado Technologies (http://www.contrado.nl)
|
|
| 3 |
*
|
|
| 4 |
* This program is free software; you can redistribute it and/or
|
|
| 5 |
* modify it under the terms of the GNU General Public License as
|
|
| 6 |
* published by the Free Software Foundation; either version 2 of the
|
|
| 7 |
* License, or (at your option) any later version.
|
|
| 8 |
*
|
|
| 9 |
* This program is distributed in the hope that it will be useful, but
|
|
| 10 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
| 12 |
* General Public License for more details.
|
|
| 13 |
*/
|
|
| 14 |
|
|
| 15 |
package net.sourceforge.anttestsetgen;
|
|
| 16 |
|
|
| 17 |
import org.apache.tools.ant.Task;
|
|
| 18 |
|
|
| 19 |
import java.util.ArrayList;
|
|
| 20 |
import java.util.Iterator;
|
|
| 21 |
import java.util.List;
|
|
| 22 |
|
|
| 23 |
/**
|
|
| 24 |
* The query object contains the query that will be executed to retrieve the results from the database.
|
|
| 25 |
*
|
|
| 26 |
* @author <a href="mailto:m.c.jansen.spam at planet.nl">Marco Jansen (Contrado Technologies)</a>
|
|
| 27 |
* @version $Id: Query.java,v 1.4 2004/01/04 15:00:18 mcjansen Exp $
|
|
| 28 |
*/
|
|
| 29 |
public class Query extends Task { |
|
| 30 |
|
|
| 31 |
/** A list with text lines that contains the query. */
|
|
| 32 |
private List textLines = new ArrayList(); |
|
| 33 |
|
|
| 34 |
/**
|
|
| 35 |
* Add a line of text to the query. If there are any properties, they will be replaced.
|
|
| 36 |
*
|
|
| 37 |
* @param text A line of text that should be added to the query.
|
|
| 38 |
*/
|
|
| 39 | 76 |
public void addText(String text) { |
| 40 | 76 |
textLines.add(text); |
| 41 |
} |
|
| 42 |
|
|
| 43 |
/**
|
|
| 44 |
* Retrieve the query as a string and replace properties.
|
|
| 45 |
*
|
|
| 46 |
* @return A string with the query.
|
|
| 47 |
*/
|
|
| 48 | 228 |
public String toString() {
|
| 49 | 228 |
StringBuffer query = new StringBuffer();
|
| 50 | 228 |
for (Iterator iterator = textLines.iterator(); iterator.hasNext();) {
|
| 51 | 228 |
String textLine = (String) iterator.next(); |
| 52 | 228 |
query.append(textLine); |
| 53 |
} |
|
| 54 | 228 |
return project.replaceProperties(query.toString());
|
| 55 |
} |
|
| 56 |
} |
|
| 57 |
|
|
||||||||||