@Test public void testFilterParameterDrillDownParameterArray() { DrillDownParameter[] drillDownParameters = { drillDownParameterSolution, drillDownParameterPath, drillDownParameterName }; PentahoSugarDrillDownController remoteDrillDownControllerSpy = spy( new PentahoSugarDrillDownController() ); doReturn( pathWrapper ).when( remoteDrillDownControllerSpy ).getPentahoPathWrapper(); DrillDownParameter[] result = remoteDrillDownControllerSpy.filterParameter( drillDownParameters ); assertNotNull( result ); assertEquals( 0, result.length ); doReturn( "testSolution" ).when( pathWrapper ).getSolution(); doReturn( "path:in:solution" ).when( pathWrapper ).getPath(); doReturn( "filename" ).when( pathWrapper ).getName(); doReturn( "testSolution/path/in/solution/filename" ).when( pathWrapper ).getLocalPath(); doReturn( "solution" ).when( drillDownParameterSolution ).getName(); doReturn( "path" ).when( drillDownParameterPath ).getName(); doReturn( "name" ).when( drillDownParameterName ).getName(); doReturn( "testSolution" ).when( drillDownParameterSolution ).getFormulaFragment(); doReturn( "path:in:solution" ).when( drillDownParameterPath ).getFormulaFragment(); doReturn( "filename" ).when( drillDownParameterName ).getFormulaFragment(); result = remoteDrillDownControllerSpy.filterParameter( drillDownParameters ); assertNotNull( result ); assertEquals( 1, result.length ); }
protected DrillDownParameter[] filterParameter( final DrillDownParameter[] parameter ) { final PentahoPathModel pentahoPathWrapper = getPentahoPathWrapper(); final ArrayList<DrillDownParameter> list = new ArrayList<DrillDownParameter>(); boolean pathAdded = false; for ( int i = 0; i < parameter.length; i++ ) { final DrillDownParameter drillDownParameter = parameter[i]; if ( "::pentaho-path".equals( drillDownParameter.getName() ) && pathAdded == false ) { list.add( new DrillDownParameter( "::pentaho-path", FormulaUtil.quoteString( pentahoPathWrapper.getLocalPath() ) ) ); pathAdded = true; } else { if ( !( "solution".equals( drillDownParameter.getName() ) || "path".equals( drillDownParameter.getName() ) || "name" .equals( drillDownParameter.getName() ) ) ) { list.add( drillDownParameter ); } } } if ( pathAdded == false ) { list.add( 0, new DrillDownParameter( "::pentaho-path", FormulaUtil .quoteString( pentahoPathWrapper.getLocalPath() ) ) ); } return super.filterParameter( list.toArray( new DrillDownParameter[list.size()] ) ); }
PentahoSugarDrillDownController extends PentahoDrillDownController { protected DrillDownParameter[] filterParameter( final DrillDownParameter[] parameter ) { final PentahoPathModel pentahoPathWrapper = getPentahoPathWrapper(); final ArrayList<DrillDownParameter> list = new ArrayList<DrillDownParameter>(); boolean pathAdded = false; for ( int i = 0; i < parameter.length; i++ ) { final DrillDownParameter drillDownParameter = parameter[i]; if ( "::pentaho-path".equals( drillDownParameter.getName() ) && pathAdded == false ) { list.add( new DrillDownParameter( "::pentaho-path", FormulaUtil.quoteString( pentahoPathWrapper.getLocalPath() ) ) ); pathAdded = true; } else { if ( !( "solution".equals( drillDownParameter.getName() ) || "path".equals( drillDownParameter.getName() ) || "name" .equals( drillDownParameter.getName() ) ) ) { list.add( drillDownParameter ); } } } if ( pathAdded == false ) { list.add( 0, new DrillDownParameter( "::pentaho-path", FormulaUtil .quoteString( pentahoPathWrapper.getLocalPath() ) ) ); } return super.filterParameter( list.toArray( new DrillDownParameter[list.size()] ) ); } }
PentahoSugarDrillDownController extends PentahoDrillDownController { protected DrillDownParameter[] filterParameter( final DrillDownParameter[] parameter ) { final PentahoPathModel pentahoPathWrapper = getPentahoPathWrapper(); final ArrayList<DrillDownParameter> list = new ArrayList<DrillDownParameter>(); boolean pathAdded = false; for ( int i = 0; i < parameter.length; i++ ) { final DrillDownParameter drillDownParameter = parameter[i]; if ( "::pentaho-path".equals( drillDownParameter.getName() ) && pathAdded == false ) { list.add( new DrillDownParameter( "::pentaho-path", FormulaUtil.quoteString( pentahoPathWrapper.getLocalPath() ) ) ); pathAdded = true; } else { if ( !( "solution".equals( drillDownParameter.getName() ) || "path".equals( drillDownParameter.getName() ) || "name" .equals( drillDownParameter.getName() ) ) ) { list.add( drillDownParameter ); } } } if ( pathAdded == false ) { list.add( 0, new DrillDownParameter( "::pentaho-path", FormulaUtil .quoteString( pentahoPathWrapper.getLocalPath() ) ) ); } return super.filterParameter( list.toArray( new DrillDownParameter[list.size()] ) ); } PentahoSugarDrillDownController(); }
PentahoSugarDrillDownController extends PentahoDrillDownController { protected DrillDownParameter[] filterParameter( final DrillDownParameter[] parameter ) { final PentahoPathModel pentahoPathWrapper = getPentahoPathWrapper(); final ArrayList<DrillDownParameter> list = new ArrayList<DrillDownParameter>(); boolean pathAdded = false; for ( int i = 0; i < parameter.length; i++ ) { final DrillDownParameter drillDownParameter = parameter[i]; if ( "::pentaho-path".equals( drillDownParameter.getName() ) && pathAdded == false ) { list.add( new DrillDownParameter( "::pentaho-path", FormulaUtil.quoteString( pentahoPathWrapper.getLocalPath() ) ) ); pathAdded = true; } else { if ( !( "solution".equals( drillDownParameter.getName() ) || "path".equals( drillDownParameter.getName() ) || "name" .equals( drillDownParameter.getName() ) ) ) { list.add( drillDownParameter ); } } } if ( pathAdded == false ) { list.add( 0, new DrillDownParameter( "::pentaho-path", FormulaUtil .quoteString( pentahoPathWrapper.getLocalPath() ) ) ); } return super.filterParameter( list.toArray( new DrillDownParameter[list.size()] ) ); } PentahoSugarDrillDownController();  }
PentahoSugarDrillDownController extends PentahoDrillDownController { protected DrillDownParameter[] filterParameter( final DrillDownParameter[] parameter ) { final PentahoPathModel pentahoPathWrapper = getPentahoPathWrapper(); final ArrayList<DrillDownParameter> list = new ArrayList<DrillDownParameter>(); boolean pathAdded = false; for ( int i = 0; i < parameter.length; i++ ) { final DrillDownParameter drillDownParameter = parameter[i]; if ( "::pentaho-path".equals( drillDownParameter.getName() ) && pathAdded == false ) { list.add( new DrillDownParameter( "::pentaho-path", FormulaUtil.quoteString( pentahoPathWrapper.getLocalPath() ) ) ); pathAdded = true; } else { if ( !( "solution".equals( drillDownParameter.getName() ) || "path".equals( drillDownParameter.getName() ) || "name" .equals( drillDownParameter.getName() ) ) ) { list.add( drillDownParameter ); } } } if ( pathAdded == false ) { list.add( 0, new DrillDownParameter( "::pentaho-path", FormulaUtil .quoteString( pentahoPathWrapper.getLocalPath() ) ) ); } return super.filterParameter( list.toArray( new DrillDownParameter[list.size()] ) ); } PentahoSugarDrillDownController();   }