{
HashMap hmap = new HashMap();
Stack stack = getTableTrack(target, source);
Set tableSet = new TreeSet();
String pop1 = "";
String pop2 = "";
pop1 = (String)stack.pop();
tableSet.add(pop1);
String searchClause = " ";
while(!stack.empty())
{
pop2 = (String)stack.pop();
tableSet.add(pop1);
tableSet.add(pop2);
Vector vec = (Vector) ((HashMap)this.get(pop2)).get(pop1);
String clause = "";
String othTableNames = "";
if (vec.size() == 1)
{
TableRelate tr = (TableRelate)vec.get(0);
clause = tr.getCaluse();
String othName = tr.getOthertablename();
if(othName == null)
othName = "";
othTableNames = othName;
}
else
{
clause = clause + " AND ( ";
for (int i = 0;i<vec.size();i++)
{
TableRelate tr = (TableRelate)vec.get(i);
if(i > 0)
clause = clause + " OR ( 1 = 1 "+ tr.getCaluse() + " ) ";
else
clause = clause + " ( 1 = 1 "+ tr.getCaluse() + " ) ";
String othName = tr.getOthertablename();
if(othName == null)
othName = "";
if( !((othTableNames.trim()).equals("")))
othTableNames = othTableNames +" , "+ othName;
}
clause = clause + " ) ";
}
StringTokenizer parse = new StringTokenizer(othTableNames, ",");
while (parse.hasMoreTokens ())
{
tableSet.add(parse.nextToken().toString());
}
searchClause = searchClause +" "+clause;
pop1 = pop2;