Package org.pentaho.platform.api.engine.perspective

Examples of org.pentaho.platform.api.engine.perspective.IPluginPerspectiveManager


  @GET
  @Path( "/perspectives" )
  @Produces( { APPLICATION_JSON } )
  @Facet ( name = "Unsupported" )
  public ArrayList<PluginPerspective> getPluginPerpectives() {
    IPluginPerspectiveManager manager =
        PentahoSystem.get( IPluginPerspectiveManager.class, PentahoSessionHolder.getSession() ); //$NON-NLS-1$

    ArrayList<PluginPerspective> perspectives = new ArrayList<PluginPerspective>();

    for ( IPluginPerspective perspective : manager.getPluginPerspectives() ) {
      PluginPerspective pp = new PluginPerspective();
      pp.setId( perspective.getId() );
      pp.setTitle( perspective.getTitle() );
      pp.setContentUrl( perspective.getContentUrl() );
      pp.setLayoutPriority( perspective.getLayoutPriority() );
View Full Code Here


    return perspective;
  }

  @Test
  public void testPerspectiveManager() {
    IPluginPerspectiveManager manager = PentahoSystem.get( IPluginPerspectiveManager.class );
    assertNotNull( manager );

    IPluginPerspective testPerspective = createTestPerspective( "test-perspective-id", "test-perspective-title" );
    manager.addPluginPerspective( testPerspective );

    assertEquals( 1, manager.getPluginPerspectives().size() );
    assertEquals( "test-perspective-id", manager.getPluginPerspectives().get( 0 ).getId() );
    assertEquals( "test-perspective-title", manager.getPluginPerspectives().get( 0 ).getTitle() );
    assertEquals( "test-content-url", manager.getPluginPerspectives().get( 0 ).getContentUrl() );

    manager.getPluginPerspectives().get( 0 ).setContentUrl( "different" );
    assertEquals( "different", manager.getPluginPerspectives().get( 0 ).getContentUrl() );

    manager.removePluginPerspective( testPerspective );
    assertEquals( 0, manager.getPluginPerspectives().size() );

    manager.addPluginPerspective( createTestPerspective( "test-perspective-id-1", "test-perspective-title-1" ) );
    manager.addPluginPerspective( createTestPerspective( "test-perspective-id-2", "test-perspective-title-2" ) );
    manager.addPluginPerspective( createTestPerspective( "test-perspective-id-3", "test-perspective-title-3" ) );
    manager.addPluginPerspective( createTestPerspective( "test-perspective-id-4", "test-perspective-title-4" ) );
    manager.addPluginPerspective( createTestPerspective( "test-perspective-id-5", "test-perspective-title-5" ) );
    assertEquals( 5, manager.getPluginPerspectives().size() );

    for ( int i = 0; i < 5; i++ ) {
      assertEquals( "test-perspective-id-" + ( i + 1 ), manager.getPluginPerspectives().get( i ).getId() );
      assertEquals( "test-perspective-title-" + ( i + 1 ), manager.getPluginPerspectives().get( i ).getTitle() );
      assertEquals( 500, manager.getPluginPerspectives().get( i ).getLayoutPriority() );
    }

    manager.clearPluginPerspectives();
    assertEquals( 0, manager.getPluginPerspectives().size() );
  }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.perspective.IPluginPerspectiveManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.