CLineage.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** BI and PM: qs
  5. **
  6. ** (C) Copyright IBM Corp. 2001, 2015
  7. **
  8. ** US Government Users Restricted Rights - Use, duplication or
  9. ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *****************************************************************/
  11. // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
  12. // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others.
  13. function CLineage(oHelper)
  14. {
  15. this.setHelper(oHelper);
  16. this.m_sSelectionContext = "";
  17. this.m_aParams = new Object();
  18. };
  19. CLineage.prototype = new AFeatureObject();
  20. CLineage.prototype.proceedWithoutDialog = function ()
  21. {
  22. this.m_oHelper = null;
  23. this.m_sSelectionContext = "";
  24. if (this.m_aParams[0] == 'metadataTree')
  25. {
  26. this.addMetadataSelectionItems();
  27. this.getHelper().open();
  28. }
  29. else
  30. {
  31. var oCVLineage = new LineageAction();
  32. oCVLineage.setCognosViewer(goApplicationManager.getReportManager().getCVObj());
  33. oCVLineage.execute();
  34. }
  35. };
  36. CLineage.prototype.addMetadataSelectionItems = function ()
  37. {
  38. var aNodes = metadataTree.getSelectionOrder();
  39. if (aNodes)
  40. {
  41. for (var iSelectIndex = 0; iSelectIndex < aNodes.length; iSelectIndex ++)
  42. {
  43. this.addItem(aNodes[iSelectIndex]);
  44. }
  45. }
  46. };
  47. CLineage.prototype.addItem = function(oNode)
  48. {
  49. var sNodeValue = oNode.getValue();
  50. if (typeof oNode.m_sRef !== "undefined")
  51. {
  52. sNodeValue = oNode.m_sRef;
  53. }
  54. this.getHelper().addItem(sNodeValue);
  55. };
  56. CLineage.prototype.getHelper = function()
  57. {
  58. if (!this.m_oHelper || typeof this.m_oHelper !== "object")
  59. {
  60. var oHelper = this.createHelper();
  61. this.setHelper(oHelper);
  62. }
  63. return this.m_oHelper;
  64. };
  65. CLineage.prototype.setHelper = function(oHelper)
  66. {
  67. this.m_oHelper = oHelper;
  68. };
  69. CLineage.prototype.createHelper = function()
  70. {
  71. var oCogConfig = new MDSRV_CognosConfiguration();
  72. var sGateway = cfgGet("gsGateway")
  73. oCogConfig.addProperty("lineageURI", gsMetadataInformationURI);
  74. oCogConfig.addProperty("gatewayURI", sGateway);
  75. var oHelper = new MDSRV_LineageFragmentContext(oCogConfig);
  76. var sExecutionParameters = goApplicationManager.getReportManager().getParameterManager().getExecutionParameters();
  77. if (sExecutionParameters && sExecutionParameters.length)
  78. {
  79. oHelper.setExecutionParameters(sExecutionParameters);
  80. }
  81. oHelper.setPackagePath(this.getSearchPath());
  82. return oHelper;
  83. };
  84. CLineage.prototype.getSelectionContext = function ()
  85. {
  86. var selectionController = goApplicationManager.getSelectionController();
  87. var selectionList = selectionController.getAllSelectedObjects();
  88. var sReturn = "";
  89. if(selectionList.length > 0)
  90. {
  91. sReturn = getViewerSelectionContext(selectionController, new CSelectionContext(this.getSearchPath()));
  92. }
  93. return sReturn;
  94. };
  95. CLineage.prototype.setup = function(aParams)
  96. {
  97. this.m_aParams = aParams;
  98. };
  99. CLineage.prototype.getSearchPath = function()
  100. {
  101. var sSearchPath = goApplicationManager.getApplicationFrame().gsPackageBase;
  102. if (!sSearchPath || !sSearchPath.length)
  103. {
  104. sSearchPath = decodeURIComponent(goApplicationManager.getApplicationFrame().gsUiObject);
  105. }
  106. return sSearchPath;
  107. };