/**************************************************************** ** Licensed Materials - Property of IBM ** ** BI and PM: qs ** ** (C) Copyright IBM Corp. 2001, 2015 ** ** US Government Users Restricted Rights - Use, duplication or ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *****************************************************************/ // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved. // 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. var MODELFILTER_FEATURE_ID = "ModelFilter"; var MODELFILTER_ERROR_NO_SELECTIONS = 21; var MODELFILTER_ERROR_TOO_MANY_SELECTIONS = 22; var MODELFILTER_ERROR_INVALID_SELECTION = 23; function CModelFilter() { this.m_bFeatureRequiresQualityOfService = true; this.m_sFilterId = ""; }; CModelFilter.prototype = new AFeatureObject(); CModelFilter.prototype.processErrorState = function () { if (this.m_iErrorState === FEATURE_OBJECT_NO_ERROR) { return false; } else if (this.m_iErrorState === MODELFILTER_ERROR_NO_SELECTIONS) { dlgShowMessage("FILTER_TITLE", "", "FILTER_NO_COLUMN"); return true; } else if (this.m_iErrorState === MODELFILTER_ERROR_TOO_MANY_SELECTIONS) { dlgShowMessage("FILTER_TITLE", "", "FILTER_TOO_MANY_SELECTIONS"); return true; } else if (this.m_iErrorState === MODELFILTER_ERROR_INVALID_SELECTION) { dlgShowMessage("FILTER_TITLE", "", "FILTER_INVALID_SELECTION"); return true; } }; CModelFilter.prototype.proceedWithoutDialog = function () { return false; }; CModelFilter.prototype.setup = function (aFeatureParams) { var oCC = getCombinedFilter(); if (typeof oCC != "object") { oCC = convertToCombinedFilter(); cfgSet("combinedFilters", oCC); } this.m_aParams = []; this.m_bRequiresDialog = true; this.m_iErrorState = FEATURE_OBJECT_NO_ERROR; if (aFeatureParams instanceof Array && aFeatureParams.length > 0 && aFeatureParams[0] == "MODELFILTER") { this.m_sFilterId = aFeatureParams[1]; } this.m_sFilterSummaryType = "raw"; if (oCC.getSummaryFilter().getFilterById(this.m_sFilterId)) { this.m_sFilterSummaryType = "detail"; } if (this.m_sFilterId !== "") { cfgSet("LAST_DIALOG", "filter"); this.setupDialogParams(); } }; CModelFilter.prototype.setupDialogParams = function () { var oMQMgr = goApplicationManager.getMiniQueryManager(); this.m_aParams.m = "/" + qs_dir + "/filterModel.xts"; var nFilter = null; var oCC = getCombinedFilter(); if (oCC) { var oFilter = oCC.getFilterById(this.m_sFilterId); if (oFilter) { nFilter = oFilter.m_nNode; } } if (!nFilter) { nFilter = oMQMgr.getElementById(this.m_sFilterId); } if (typeof nFilter == "object") { var sFilterName = nFilter.getAttribute("modelFilter"); if (!sFilterName) { sFilterName = nFilter.getAttribute("name"); } this.m_sLabel = encodeURIComponent(sFilterName); this.m_bNOT = (nFilter.getAttribute("negate") == "true"); } this.m_bShowNullOption = true; }; CModelFilter.prototype.execute = function (aParameters) { try { var oMQMgr = goApplicationManager.getMiniQueryManager(); var sNOToption = aParameters[0]; var sSummaryOption = aParameters[1]; var oCC = getCombinedFilter(); if (oCC) { var oF = oCC.getFilterById(this.m_sFilterId); if (oF !== null) { if (aParameters[0] == "DELETE") { oF.removeSelf(); } else { oF.setNot(sNOToption); var oFG = null; if (sSummaryOption == "raw") { oFG = oCC.getRawFilter(); } else if (sSummaryOption == "detail") { oFG = oCC.getSummaryFilter(); } if (oFG !== null && oFG.getFilterById(this.m_sFilterId) === null) { oF.removeSelf(); oFG.addPredicate(oF); } } } if (getFilterMode() == giFILTERCPLXMODE_WIZARD || getFilterMode() == giFILTERCPLXMODE_PRE_WIZARD) { dlgSetParm("m", "/" + qs_dir + "/filterCombine.xts"); dlgSetParm("m_tab", (sSummaryOption == "raw" ? "r" : "s")); if (isDetailFilterEnabled()) { dlgGlobalSetParm("xxAllowDetail", true); } dlgSubmit(); } else { addColumnsForReselection(); sendCmd(oCC.getCommand(), "", true); goApplicationManager.getWindowManager().hideDialogFrame(); } } } catch (e) { } };