package java112.project5;
import java.util.*;
import java112.employee.*;
/**
* Description of the Class
*
*@author Nathan Sutton
*/
public class SearchResults
extends java.lang.Object {
String searchType;
String searchCriteria;
ArrayList queryResults;
String htmlQueryResults;
boolean employeesFound;
/**
* Returns the value of searchType.
*
*@return The searchType value
*/
public String getSearchType() {
return searchType;
}
/**
* Sets the value of searchType.
*
*@param searchType The value to assign searchType.
*/
public void setSearchType(String searchType) {
this.searchType = searchType;
}
/**
* Returns the value of searchCriteria.
*
*@return The searchCriteria value
*/
public String getSearchCriteria() {
return searchCriteria;
}
/**
* Sets the value of searchCriteria.
*
*@param searchCriteria The value to assign searchCriteria.
*/
public void setSearchCriteria(String searchCriteria) {
this.searchCriteria = searchCriteria;
}
/**
* Returns the value of queryResults.
*
*@return The queryResults value
*/
public ArrayList getQueryResults() {
return queryResults;
}
/**
* Sets the value of queryResults.
*
*@param queryResults The value to assign queryResults.
*/
public void setQueryResults(ArrayList queryResults) {
this.queryResults = queryResults;
}
/**
* Returns the value of htmlQueryResults.
*
*@return The htmlQueryResults value
*/
public String getHtmlQueryResults() {
return htmlQueryResults;
}
/**
* Sets the value of htmlQueryResults.
*
*@param htmlQueryResults The value to assign htmlQueryResults.
*/
public void setHtmlQueryResults(String htmlQueryResults) {
this.htmlQueryResults = htmlQueryResults;
}
/**
* Returns the value of employeesFound.
*
*@return The employeesFound value
*/
public boolean getEmployeesFound() {
return employeesFound;
}
/**
* Sets the value of employeesFound.
*
*@param employeesFound The value to assign employeesFound.
*/
public void setEmployeesFound(boolean employeesFound) {
this.employeesFound = employeesFound;
}
/**
* Constructor for the SearchResults object
*/
public SearchResults() { }
/**
* Description of the Method
*
*@return Description of the Return Value
*/
public String toString() {
StringBuilder sb = new StringBuilder();
for (Iterator it = queryResults.iterator(); it.hasNext(); ) {
sb.append("<tr>\n");
Employee emp = (Employee) it.next();
String tabbed = emp.getTabbedInfo();
String[] info = tabbed.split("\t");
for (int i = 0; i < info.length; i++) {
sb.append("<td>" + info[i] + "</td>\n");
}
sb.append("</tr>\n");
}
setHtmlQueryResults(sb.toString());
return getHtmlQueryResults();
}
}