ws_roxiequeryservice.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. /*##############################################################################
  2. Copyright (C) 2011 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #pragma warning (disable : 4786)
  15. #include <math.h>
  16. #include "jfile.hpp"
  17. #include "wshelpers.hpp"
  18. #include "portlist.h"
  19. #include "jiface.hpp"
  20. #include "environment.hpp"
  21. #include "TpWrapper.hpp"
  22. #include "jstring.hpp"
  23. #include "dautils.hpp"
  24. #include "eclrtl.hpp"
  25. #include "fverror.hpp"
  26. #include "exception_util.hpp"
  27. #include "ws_roxiequeryservice.hpp"
  28. const unsigned int ROXIEQUERYID = 1;
  29. const unsigned int ROXIEQUERYWUID = 2;
  30. const unsigned int ROXIEQUERYCLUSTER = 3;
  31. const unsigned int ROXIEQUERYLABEL = 4;
  32. const unsigned int ROXIEQUERYSUSPENDED = 5;
  33. const unsigned int ROXIEQUERYHIGHPRIORITY = 6;
  34. const unsigned int ROXIEQUERYERROR = 7;
  35. const unsigned int ROXIEQUERYCOMMENT = 8;
  36. const unsigned int ROXIEQUERYASSOCIATEDNAME = 9;
  37. const unsigned int ROXIEQUERYHASALIASES = 10;
  38. const unsigned int ROXIEQUERYDEPLOYEDBY = 11;
  39. const unsigned int ROXIEQUERYUPDATEDBY = 12;
  40. static const char* FEATURE_URL="RoxieQueryAccess";
  41. static const char* ROXIE_CLUSTER="RoxieCluster";
  42. static const char* ROXIE_FARMERPROCESS1="RoxieServerProcess[1]";
  43. __int64 findPositionInRoxieQueryList(int type, const char *value, bool descend, IArrayOf<IEspRoxieQuery>& queries)
  44. {
  45. if (!value || (strlen(value) < 1))
  46. {
  47. if (descend)
  48. return -1;
  49. else
  50. return 0;
  51. }
  52. __int64 addToPos = -1;
  53. ForEachItemIn(i, queries)
  54. {
  55. IEspRoxieQuery& query = queries.item(i);
  56. char *Value = NULL;
  57. switch (type)
  58. {
  59. case ROXIEQUERYID:
  60. Value = (char *) query.getID();
  61. break;
  62. case ROXIEQUERYDEPLOYEDBY:
  63. Value = (char *) query.getDeployedBy();
  64. break;
  65. case ROXIEQUERYUPDATEDBY:
  66. Value = (char *) query.getUpdatedBy();
  67. break;
  68. case ROXIEQUERYWUID:
  69. Value = (char *) query.getWUID();
  70. break;
  71. case ROXIEQUERYSUSPENDED:
  72. Value = (char *) query.getSuspended();
  73. break;
  74. case ROXIEQUERYHIGHPRIORITY:
  75. Value = (char *) query.getHighPriority();
  76. break;
  77. case ROXIEQUERYERROR:
  78. Value = (char *) query.getError();
  79. break;
  80. case ROXIEQUERYCOMMENT:
  81. Value = (char *) query.getComment();
  82. break;
  83. case ROXIEQUERYHASALIASES:
  84. Value = (char *) query.getHasAliases();
  85. break;
  86. }
  87. if (!Value)
  88. continue;
  89. if (type != ROXIEQUERYID)
  90. {
  91. if (descend && strcmp(value, Value)>0)
  92. {
  93. addToPos = i;
  94. break;
  95. }
  96. if (!descend && strcmp(value, Value)<0)
  97. {
  98. addToPos = i;
  99. break;
  100. }
  101. }
  102. else
  103. {
  104. if (descend && stricmp(value, Value)>0)
  105. {
  106. addToPos = i;
  107. break;
  108. }
  109. if (!descend && stricmp(value, Value)<0)
  110. {
  111. addToPos = i;
  112. break;
  113. }
  114. }
  115. }
  116. return addToPos;
  117. }
  118. void getUserInformation(IEspContext &context, StringBuffer &username, StringBuffer &password)
  119. {
  120. context.getUserID(username);
  121. context.getPassword(password);
  122. }
  123. void CWsRoxieQueryEx::init(IPropertyTree *cfg, const char *process, const char *service)
  124. {
  125. IPropertyTree* pStyleSheets = cfg->queryPropTree("StyleSheets");
  126. const char* xslt = cfg->queryProp("xslt[@name='atts']");
  127. m_attsXSLT.append(getCFD()).append( xslt && *xslt ? xslt : "smc_xslt/atts.xslt");
  128. xslt = cfg->queryProp("xslt[@name='graphStats']");
  129. m_graphStatsXSLT.append(getCFD()).append( xslt && *xslt ? xslt : "smc_xslt/graphStats.xslt");
  130. }
  131. void CWsRoxieQueryEx::addToQueryString(StringBuffer &queryString, const char *name, const char *value)
  132. {
  133. if (queryString.length() > 0)
  134. {
  135. queryString.append("&amp;");
  136. }
  137. queryString.append(name);
  138. queryString.append("=");
  139. queryString.append(value);
  140. }
  141. void CWsRoxieQueryEx::addToQueryStringFromInt(StringBuffer &queryString, const char *name, int value)
  142. {
  143. if (queryString.length() > 0)
  144. {
  145. queryString.append("&amp;");
  146. }
  147. queryString.append(name);
  148. queryString.append("=");
  149. queryString.append(value);
  150. }
  151. void CWsRoxieQueryEx::getClusterConfig(char const * clusterType, char const * clusterName, char const * processName, StringBuffer& netAddress, int& port)
  152. {
  153. Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
  154. #if 0
  155. Owned<IConstEnvironment> environment = factory->openEnvironment();
  156. #else
  157. Owned<IConstEnvironment> environment = factory->openEnvironmentByFile();
  158. #endif
  159. Owned<IPropertyTree> pRoot = &environment->getPTree();
  160. StringBuffer xpath;
  161. xpath.appendf("Software/%s[@name='%s']", clusterType, clusterName);
  162. IPropertyTree* pCluster = pRoot->queryPropTree( xpath.str() );
  163. if (!pCluster)
  164. throw MakeStringException(ECLWATCH_CLUSTER_NOT_IN_ENV_INFO, "Failed to get environment information for the cluster '%s %s'.", clusterType, clusterName);
  165. xpath.clear().append(processName);
  166. xpath.append("@computer");
  167. const char* computer = pCluster->queryProp(xpath.str());
  168. if (!computer || strlen(computer) < 1)
  169. throw MakeStringException(ECLWATCH_CLUSTER_NOT_IN_ENV_INFO, "Failed to get the 'computer' information for the process '%s'. Please check environment settings for the cluster '%s %s'.", processName, clusterType, clusterName);
  170. xpath.clear().append(processName);
  171. xpath.append("@port");
  172. const char* portStr = pCluster->queryProp(xpath.str());
  173. port = ROXIE_SERVER_PORT;
  174. if (portStr && *portStr)
  175. {
  176. port = atoi(portStr);
  177. }
  178. Owned<IConstMachineInfo> pMachine = environment->getMachine(computer);
  179. if (pMachine)
  180. {
  181. SCMStringBuffer scmNetAddress;
  182. pMachine->getNetAddress(scmNetAddress);
  183. netAddress = scmNetAddress.str();
  184. #ifdef MACHINE_IP
  185. if (!strcmp(netAddress.str(), "."))
  186. netAddress = MACHINE_IP;
  187. #endif
  188. }
  189. return;
  190. }
  191. bool CWsRoxieQueryEx::onRoxieQuerySearch(IEspContext &context, IEspRoxieQuerySearchRequest & req, IEspRoxieQuerySearchResponse & resp)
  192. {
  193. try
  194. {
  195. if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
  196. throw MakeStringException(ECLWATCH_ROXIE_QUERY_ACCESS_DENIED, "Failed to Search Roxie Queries. Permission denied.");
  197. StringBuffer username;
  198. context.getUserID(username);
  199. DBGLOG("CWsRoxieQueryEx::onRoxieQuerySearch User=%s",username.str());
  200. CTpWrapper dummy;
  201. IArrayOf<IEspTpCluster> clusters;
  202. dummy.getClusterProcessList(eqRoxieCluster, clusters);
  203. if (clusters.length() <= 0)
  204. throw MakeStringException(ECLWATCH_CLUSTER_NOT_IN_ENV_INFO, "Roxie cluster not found.");
  205. StringArray roxieclusters;
  206. ForEachItemIn(k, clusters)
  207. {
  208. IEspTpCluster& cluster = clusters.item(k);
  209. roxieclusters.append(cluster.getName());
  210. }
  211. StringArray ftarray;
  212. ftarray.append("Suspended and Non-Suspended");
  213. ftarray.append("Non-Suspended Only");
  214. ftarray.append("Suspended Only");
  215. resp.setClusterNames(roxieclusters);
  216. resp.setSuspendedSelections(ftarray);
  217. }
  218. catch(IException* e)
  219. {
  220. FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
  221. }
  222. return true;
  223. }
  224. bool CWsRoxieQueryEx::getAllRoxieQueries(IEspContext &context, const char* cluster, const char* suspended, const char* sortBy, bool descending, __int64 displayEnd, IArrayOf<IEspRoxieQuery>& RoxieQueryList, __int64& totalFiles)
  225. {
  226. int port;
  227. StringBuffer netAddress;
  228. SocketEndpoint ep;
  229. getClusterConfig(ROXIE_CLUSTER, cluster, ROXIE_FARMERPROCESS1, netAddress, port);
  230. int suspendedFlag = 0;
  231. if (suspended && *suspended)
  232. {
  233. if (stricmp(suspended, "Suspended Only") == 0)
  234. {
  235. suspendedFlag = 2;
  236. }
  237. else if (stricmp(suspended, "Non-Suspended Only") == 0)
  238. {
  239. suspendedFlag = 1;
  240. }
  241. }
  242. ep.set(netAddress.str(), port);
  243. StringBuffer username, password;
  244. getUserInformation(context, username, password);
  245. StringBuffer currentDaliIp;
  246. const SocketEndpoint &ep1 = queryCoven().queryComm().queryGroup().queryNode(0).endpoint();
  247. ep1.getUrlStr(currentDaliIp);
  248. LogLevel loglevel = getEspLogLevel(&context);
  249. Owned<IRoxieQueryManager> queryManager = createRoxieQueryManager(ep, cluster, currentDaliIp, 60000, username.str(), password.str(), loglevel);
  250. Owned<IPropertyTree> result = queryManager->retrieveQueryList("*", false, false, false, false, 0);
  251. Owned<IPropertyTreeIterator> queries = result->getElements("Query");
  252. ForEach(*queries)
  253. {
  254. IPropertyTree &query = queries->query();
  255. const char* id = query.queryProp("@id");
  256. const char* wuid = query.queryProp("@wuid");
  257. const char* deployedby = query.queryProp("@deployedBy");
  258. const char* updatedby = query.queryProp("@suspendedBy");
  259. const char* comment = query.queryProp("@comment");
  260. const char* error = query.queryProp("@error");
  261. bool bSuspended = query.getPropBool("@suspended", false);
  262. bool bHighPriority = query.getPropBool("@priority", false);
  263. bool bHasAliases = query.getPropBool("@hasAlias", false);
  264. if (suspendedFlag > 1)
  265. {
  266. if (!bSuspended) //Suspended Only
  267. continue;
  268. }
  269. else if (suspendedFlag > 0)
  270. {
  271. if (bSuspended) //Non-Suspended Only
  272. continue;
  273. }
  274. StringBuffer strSuspended, strHighPriority, strHasAliases;
  275. if (bSuspended)
  276. strSuspended.append("Yes");
  277. else
  278. strSuspended.append("No");
  279. if (bHighPriority)
  280. strHighPriority.append("Yes");
  281. else
  282. strHighPriority.append("No");
  283. if (bHasAliases)
  284. strHasAliases.append("Yes");
  285. else
  286. strHasAliases.append("No");
  287. Owned<IEspRoxieQuery> roxieQuery = createRoxieQuery("","");
  288. if (id && *id)
  289. roxieQuery->setID(id);
  290. if (comment && *comment)
  291. roxieQuery->setComment(comment);
  292. if (error && *error)
  293. roxieQuery->setError("Yes");
  294. else
  295. roxieQuery->setError("No");
  296. roxieQuery->setHasAliases(strHasAliases.str());
  297. roxieQuery->setSuspended(strSuspended.str());
  298. roxieQuery->setHighPriority(strHighPriority.str());
  299. double version = context.getClientVersion();
  300. if (version > 1.00)
  301. {
  302. if (deployedby && *deployedby)
  303. roxieQuery->setDeployedBy(deployedby);
  304. if (updatedby && *updatedby)
  305. roxieQuery->setUpdatedBy(updatedby);
  306. }
  307. if (version > 1.01)
  308. {
  309. if (wuid && *wuid)
  310. roxieQuery->setWUID(wuid);
  311. }
  312. __int64 addToPos = -1; //Add to tail
  313. if (!sortBy)
  314. {
  315. addToPos = findPositionInRoxieQueryList(ROXIEQUERYID, id, false, RoxieQueryList);
  316. }
  317. else if (stricmp(sortBy, "ID")==0)
  318. {
  319. addToPos = findPositionInRoxieQueryList(ROXIEQUERYID, id, descending, RoxieQueryList);
  320. }
  321. else if (stricmp(sortBy, "DeployedBy")==0)
  322. {
  323. if (version > 1.00)
  324. {
  325. addToPos = findPositionInRoxieQueryList(ROXIEQUERYDEPLOYEDBY, deployedby, descending, RoxieQueryList);
  326. }
  327. }
  328. else if (stricmp(sortBy, "UpdatedBy")==0)
  329. {
  330. if (version > 1.00)
  331. {
  332. addToPos = findPositionInRoxieQueryList(ROXIEQUERYUPDATEDBY, updatedby, descending, RoxieQueryList);
  333. }
  334. }
  335. else if (stricmp(sortBy, "WUID")==0)
  336. {
  337. if (version > 1.01)
  338. {
  339. addToPos = findPositionInRoxieQueryList(ROXIEQUERYWUID, wuid, descending, RoxieQueryList);
  340. }
  341. }
  342. else if (stricmp(sortBy, "Suspended")==0)
  343. {
  344. addToPos = findPositionInRoxieQueryList(ROXIEQUERYSUSPENDED, strSuspended.str(), descending, RoxieQueryList);
  345. }
  346. else if (stricmp(sortBy, "HighPriority")==0)
  347. {
  348. addToPos = findPositionInRoxieQueryList(ROXIEQUERYHIGHPRIORITY, strHighPriority.str(), descending, RoxieQueryList);
  349. }
  350. else if (stricmp(sortBy, "Error")==0)
  351. {
  352. addToPos = findPositionInRoxieQueryList(ROXIEQUERYERROR, error, descending, RoxieQueryList);
  353. }
  354. else if (stricmp(sortBy, "Comment")==0)
  355. {
  356. addToPos = findPositionInRoxieQueryList(ROXIEQUERYCOMMENT, comment, descending, RoxieQueryList);
  357. }
  358. else if (stricmp(sortBy, "HasAliases")==0)
  359. {
  360. addToPos = findPositionInRoxieQueryList(ROXIEQUERYHASALIASES, strHighPriority.str(), descending, RoxieQueryList);
  361. }
  362. else
  363. {
  364. addToPos = findPositionInRoxieQueryList(ROXIEQUERYID, id, false, RoxieQueryList);
  365. }
  366. totalFiles++;
  367. if (addToPos < 0)
  368. RoxieQueryList.append(*roxieQuery.getClear());
  369. else
  370. RoxieQueryList.add(*roxieQuery.getClear(), (int) addToPos);
  371. }
  372. return true;
  373. }
  374. bool CWsRoxieQueryEx::onRoxieQueryList(IEspContext &context, IEspRoxieQueryListRequest & req, IEspRoxieQueryListResponse & resp)
  375. {
  376. try
  377. {
  378. if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
  379. throw MakeStringException(ECLWATCH_ROXIE_QUERY_ACCESS_DENIED, "Failed to List Roxie Queries. Permission denied.");
  380. StringBuffer username;
  381. context.getUserID(username);
  382. DBGLOG("CWsRoxieQueryEx::onRoxieQueryList User=%s",username.str());
  383. const char* sortBy = req.getSortby();
  384. bool descending = req.getDescending();
  385. unsigned pagesize = req.getPageSize();
  386. if (pagesize < 1)
  387. {
  388. pagesize = 100;
  389. }
  390. __int64 displayStartReq = 1;
  391. if (req.getPageStartFrom() > 0)
  392. displayStartReq = req.getPageStartFrom();
  393. __int64 displayStart = displayStartReq - 1;
  394. __int64 displayEnd = displayStart + pagesize;
  395. StringBuffer size;
  396. __int64 totalFiles = 0;
  397. IArrayOf<IEspRoxieQuery> RoxieQueryList;
  398. const char* name = req.getLogicalName();
  399. const char* cluster = req.getCluster();
  400. if (!cluster || !*cluster)
  401. throw MakeStringException(ECLWATCH_INVALID_INPUT,"Cluster is not specified for retrieving Roxie queries.");
  402. getAllRoxieQueries(context, cluster, req.getSuspended(), sortBy, descending, displayEnd, RoxieQueryList, totalFiles);
  403. resp.setNumFiles(totalFiles);
  404. resp.setPageSize(pagesize);
  405. resp.setPageStartFrom(displayStart+1);
  406. resp.setPageEndAt(displayEnd);
  407. if (displayStart - pagesize > 0)
  408. resp.setPrevPageFrom(displayStart - pagesize + 1);
  409. else if(displayStart > 0)
  410. resp.setPrevPageFrom(1);
  411. if(displayEnd < totalFiles)
  412. {
  413. resp.setNextPageFrom(displayEnd+1);
  414. resp.setLastPageFrom(pagesize * (int) floor((double) totalFiles/pagesize) + 1);
  415. }
  416. StringBuffer ParametersForSorting;
  417. addToQueryString(ParametersForSorting, "Cluster", cluster);
  418. resp.setCluster(cluster);
  419. if (name && *name)
  420. {
  421. addToQueryString(ParametersForSorting, "LogicalName", name);
  422. resp.setLogicalName(name);
  423. }
  424. if (req.getSuspended() && *req.getSuspended())
  425. addToQueryString(ParametersForSorting, "Suspended", req.getSuspended());
  426. StringBuffer ParametersForPaging;
  427. addToQueryStringFromInt(ParametersForPaging, "PageSize", pagesize);
  428. descending = false;
  429. if (sortBy && *sortBy)
  430. {
  431. if (req.getDescending())
  432. descending = req.getDescending();
  433. resp.setSortby(sortBy);
  434. resp.setDescending(descending);
  435. addToQueryString(ParametersForPaging, "Sortby", sortBy);
  436. if (descending)
  437. {
  438. addToQueryString(ParametersForPaging, "Descending", "1");
  439. }
  440. }
  441. if (ParametersForSorting.length() > 0)
  442. resp.setParametersForSorting(ParametersForSorting.str());
  443. if (ParametersForPaging.length() > 0)
  444. resp.setParametersForPaging(ParametersForPaging.str());
  445. resp.setRoxieQueries(RoxieQueryList);
  446. }
  447. catch(IException* e)
  448. {
  449. FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
  450. }
  451. return true;
  452. }
  453. bool CWsRoxieQueryEx::onQueryDetails(IEspContext &context, IEspRoxieQueryDetailsRequest & req, IEspRoxieQueryDetailsResponse & resp)
  454. {
  455. try
  456. {
  457. if (!context.validateFeatureAccess(FEATURE_URL, SecAccess_Read, false))
  458. throw MakeStringException(ECLWATCH_ROXIE_QUERY_ACCESS_DENIED, "Failed to get Query Details. Permission denied.");
  459. StringBuffer username, password;
  460. getUserInformation(context, username, password);
  461. DBGLOG("CWsRoxieQueryEx::onQueryDetails User=%s",username.str());
  462. const char* queryID = req.getQueryID();
  463. const char* cluster = req.getCluster();
  464. if (!queryID || !*queryID || !cluster || !*cluster)
  465. {
  466. throw MakeStringException(ECLWATCH_INVALID_INPUT,"Query ID or Cluster is not specified for retrieving query information.");
  467. }
  468. int port;
  469. StringBuffer netAddress;
  470. SocketEndpoint ep;
  471. getClusterConfig(ROXIE_CLUSTER, cluster, ROXIE_FARMERPROCESS1, netAddress, port);
  472. ep.set(netAddress.str(), port);
  473. StringBuffer currentDaliIp;
  474. const SocketEndpoint &ep1 = queryCoven().queryComm().queryGroup().queryNode(0).endpoint();
  475. ep1.getUrlStr(currentDaliIp);
  476. LogLevel loglevel = getEspLogLevel(&context);
  477. Owned<IRoxieQueryManager> queryManager = createRoxieQueryManager(ep, cluster, currentDaliIp, 60000, username.str(), password.str(), loglevel);
  478. Owned<IPropertyTree> result = queryManager->retrieveQueryList(queryID, false, false, false, false, 0);
  479. if (result)
  480. {
  481. Owned<IPropertyTreeIterator> queries = result->getElements("Query");
  482. ForEach(*queries)
  483. {
  484. IPropertyTree &query = queries->query();
  485. const char* wuid = query.queryProp("@wuid");
  486. const char* label = query.queryProp("@label");
  487. const char* associatedName = query.queryProp("@associatedName");
  488. const char* comment = query.queryProp("@comment");
  489. const char* error = query.queryProp("@error");
  490. const char* deployedby = query.queryProp("@deployedBy");
  491. const char* updatedby = query.queryProp("@suspendedBy");
  492. bool bSuspended = query.getPropBool("@suspended", false);
  493. bool bHighPriority = query.getPropBool("@priority", false);
  494. StringBuffer strSuspended, strHighPriority;
  495. if (bSuspended)
  496. resp.setSuspended("Yes");
  497. else
  498. resp.setSuspended("No");
  499. if (bHighPriority)
  500. resp.setHighPriority("Yes");
  501. else
  502. resp.setHighPriority("No");
  503. resp.setQueryID(queryID);
  504. resp.setCluster(cluster);
  505. if (wuid && *wuid)
  506. resp.setWUID(wuid);
  507. if (associatedName && *associatedName)
  508. resp.setAssociatedName(associatedName);
  509. if (label && *label)
  510. resp.setLabel(label);
  511. if (error && *error)
  512. resp.setError(error);
  513. if (comment && *comment)
  514. resp.setComment(comment);
  515. double version = context.getClientVersion();
  516. if (version > 1.00)
  517. {
  518. if (deployedby && *deployedby)
  519. resp.setDeployedBy(deployedby);
  520. if (updatedby && *updatedby)
  521. resp.setUpdatedBy(updatedby);
  522. }
  523. break;
  524. }
  525. IArrayOf<IEspRoxieQueryAlias> AliasList;
  526. Owned<IPropertyTreeIterator> queries1 = result->getElements("Alias");
  527. ForEach(*queries1)
  528. {
  529. IPropertyTree &query = queries1->query();
  530. const char* id = query.queryProp("@id");
  531. const char* original = query.queryProp("@original");
  532. Owned<IEspRoxieQueryAlias> alias = createRoxieQueryAlias("","");
  533. if (id && *id)
  534. alias->setID(id);
  535. if (original && *original)
  536. alias->setOriginal(original);
  537. AliasList.append(*alias.getClear());
  538. }
  539. resp.setAliases(AliasList);
  540. }
  541. }
  542. catch(IException* e)
  543. {
  544. FORWARDEXCEPTION(e, ECLWATCH_INTERNAL_ERROR);
  545. }
  546. return true;
  547. }