}
SearchCollection scol = new SearchCollection();
ArrayList list = scol.getSearchCollection(powerEditString);
Set globalSet = new TreeSet();
StringBuffer newsb = new StringBuffer();
newsb.append(" And ( 1 =1 ");
String searchClause = "";
for (int i = 0; i < list.size(); i++)
{
String srecord = (String)list.get(i);
SearchRecord aa = new SearchRecord(this.dataSource);
aa.setPowerString(srecord);
String tableName = aa.getTable();
if (tableName != null)
tableName = tableName.trim();
String columnName = aa.getColumn();
if (columnName != null)
columnName = columnName.trim();
String condition = aa.getCondition();
if (condition != null)
condition = condition.trim();
String criteria = aa.getCriteria();
if (criteria != null)
criteria = criteria.trim();
String join = aa.getJoin();
if (join == null)
join = "AND";
// String target = "Entity";
// String source = "Address";
String source = tableName;
HashMap map = mdir.getQuryData(target, source);
searchClause = searchClause + (String)map.get("Search");
Set tablesName = (Set)map.get("Table");
Object[] objArray = tablesName.toArray();
for (int j = 0; j < objArray.length; j++)
{
globalSet.add((String)objArray[j]);
}
String cl = " " + join + " " + tableName + "." + columnName;
if (condition.equalsIgnoreCase("begins with"))
{
cl = cl + " like '" + criteria + "%'";
} else if (condition.equalsIgnoreCase("ends with")) {
cl = cl + " like '%" + criteria + "'";
} else if (condition.equalsIgnoreCase("contains")) {
cl = cl + " like '%" + criteria + "%'";
} else if (condition.equalsIgnoreCase("equals")) {
cl = cl + " = '" + criteria + "'";
} else if (condition.equalsIgnoreCase("less than")) {
cl = cl + " < '" + criteria + "'";
} else if (condition.equalsIgnoreCase("greater than")) {
cl = cl + " < '" + criteria + "'";
}
newsb.append(cl);
}// end of for
newsb.append(" ) ");
String finalSql = " Select " + primaryType + " from ";
Object[] objArray = globalSet.toArray();
for (int j = 0; j < objArray.length; j++)
{
finalSql = finalSql + " " + (String)objArray[j];
if (j < objArray.length - 1)
{