@@ -0,0 +1,1209 @@
+package gov.nih.nci.cbiit.cmps.transform;%0A%0Aimport java.util.StringTokenizer;%0A%0Apublic class QueryBuilderUtil %7B%0A%0A%09/**%0A%09 * Retrieve the relative path of an xpath based on current home path%0A%09 * @param currentHome%0A%09 * @param path%0A%09 * @return%0A%09 */%0A%09public static String  retrieveRelativePath(String currentHome, String path)%0A%09%7B%0A%09%09System.out.println(%22QueryBuilderUtil.retrieveRelativePath()..currentHome=%22+currentHome+%22...path=%22+path);%0A%09%09if (path.startsWith(currentHome))%0A%09%09%09return path.substring(currentHome.length());%0A%09%09%0A%09%09StringBuilder ancestorPath = new StringBuilder();%0A%09%09StringTokenizer stCur = new StringTokenizer(currentHome, %22/%22);%0A%09%09StringTokenizer stNew = new StringTokenizer(path, %22/%22);%0A %0A%09%09//find the common shared ancestor%0A%09%09while(stCur.hasMoreTokens() && stNew.hasMoreTokens()) %0A%09%09%7B%0A%09%09%09String t = stCur.nextToken(); %0A%09%09%09if (t.equals(stNew.nextToken()))%0A %09%09%09%09ancestorPath.append(%22/%22).append(t);%0A%09%09%09else %0A%09%09%09%09break;%0A%09%09%7D%0A%09%09if (ancestorPath.length()==0)//there not any shared ancestor%0A%09%09%09return null;%0A%09%09%0A%09%09//There are shared ancestor%0A%09%09String ret = %22%22;%0A%09%09ret += %22/..%22;%0A%09%09while(stCur.hasMoreTokens()) %7B%0A%09%09%09ret += %22/..%22;%0A%09%09%7D%0A%09%09%0A%09%09ret += path.substring(ancestorPath.toString().length());%09%0A%09%09return ret;%09%0A%09%7D%0A%7D%0A

create Util class