public void testWithQuery() throws Exception { WhatIfEngineInstance ei = getWhatifengineiEngineInstance(getCatalogue()); SpagoBIPivotModel pivotModel = (SpagoBIPivotModel) ei.getPivotModel(); SpagoBICellSetWrapper cellSetWrapper = (SpagoBICellSetWrapper) pivotModel.getCellSet(); SpagoBICellWrapper cellWrapper = (SpagoBICellWrapper) cellSetWrapper.getCell(0); cellWrapper.getMembers()[1].setProperty(WhatIfConstants.MEMBER_PROPERTY_LEAF, null); EqualPartitioningOnLeafsAllocationAlgorithm ae = new EqualPartitioningOnLeafsAllocationAlgorithm(ei); Long leafs = ae.getDataManager().getLeafs(cellWrapper.getMembers()); System.out.println(leafs); }
public static String buildCrossNavigationUrl( int targetIndex, SpagoBICellWrapper cellWrapper, WhatIfEngineInstance ei) throws Exception { logger.debug("IN"); SpagoBIPivotModel modelWrapper = ei.getSpagoBIPivotModel(); Target target = modelWrapper.getCrossNavigation().getTargets().get(targetIndex); List<TargetParameter> parameters = target.getParameters(); StringBuffer buffer = new StringBuffer( "parent.execCrossNavigation(window.name, '" + StringEscapeUtils.escapeJavaScript(target.documentLabel) + "', '"); if (!parameters.isEmpty()) { for (int i = 0; i < parameters.size(); i++) { TargetParameter aParameter = parameters.get(i); String parameterName = aParameter.name; String parameterValue = getParameterValue(aParameter, ei, cellWrapper); if (parameterValue != null) { buffer.append( StringEscapeUtils.escapeJavaScript(parameterName + "=" + parameterValue + "&")); } } } if (buffer.charAt(buffer.length() - 1) == '&') { buffer.deleteCharAt(buffer.length() - 1); } if (target.customizedView != null) { buffer.append("', '" + StringEscapeUtils.escapeJavaScript(target.customizedView) + "'"); } else { buffer.append("', ''"); } if (target.titleCross != null && target.targetCross != null && target.targetCross.equalsIgnoreCase("tab")) { buffer.append(",'" + target.titleCross + "','tab'"); } else if (target.titleCross != null) { buffer.append(",'" + target.titleCross + "'"); } buffer.append(");"); String toReturn = buffer.toString(); logger.debug("OUT: returning [" + toReturn + "]"); return toReturn; }