Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IContentInfo


    StringBuffer buffer = null;
    String url = null;
    String path = FileResource.idToPath( pathId );
    String extension = path.substring( path.lastIndexOf( '.' ) + 1 );
    IPluginManager pluginManager = PentahoSystem.get( IPluginManager.class, PentahoSessionHolder.getSession() );
    IContentInfo info = pluginManager.getContentTypeInfo( extension );
    for ( IPluginOperation operation : info.getOperations() ) {
      if ( operation.getId().equalsIgnoreCase( "RUN" ) ) { //$NON-NLS-1$
        perspective = operation.getPerspective();
        break;
      }
    }
View Full Code Here


  @Produces ( { APPLICATION_XML, APPLICATION_JSON } )
  @Facet ( name = "Unsupported" )
  public Response getExecutableTypes() {
    ArrayList<ExecutableFileTypeDto> executableTypes = new ArrayList<ExecutableFileTypeDto>();
    for ( String contentType : pluginManager.getContentTypes() ) {
      IContentInfo contentInfo = pluginManager.getContentTypeInfo( contentType );
      ExecutableFileTypeDto executableFileType = new ExecutableFileTypeDto();
      executableFileType.setDescription( contentInfo.getDescription() );
      executableFileType.setExtension( contentInfo.getExtension() );
      executableFileType.setTitle( contentInfo.getTitle() );
      executableFileType.setCanSchedule( hasOperationId( contentInfo.getOperations(), "SCHEDULE_NEW" ) );
      executableFileType.setCanEdit( hasOperationId( contentInfo.getOperations(), "EDIT" ) );
      executableTypes.add( executableFileType );
    }

    final GenericEntity<List<ExecutableFileTypeDto>> entity =
        new GenericEntity<List<ExecutableFileTypeDto>>( executableTypes ) {
View Full Code Here

  @Produces( { APPLICATION_XML, APPLICATION_JSON } )
  @Facet ( name = "Unsupported" )
  public Response getExecutableTypes() {
    ArrayList<ExecutableFileTypeDto> executableTypes = new ArrayList<ExecutableFileTypeDto>();
    for ( String contentType : pluginManager.getContentTypes() ) {
      IContentInfo contentInfo = pluginManager.getContentTypeInfo( contentType );
      ExecutableFileTypeDto executableFileType = new ExecutableFileTypeDto();
      executableFileType.setDescription( contentInfo.getDescription() );
      executableFileType.setExtension( contentInfo.getExtension() );
      executableFileType.setTitle( contentInfo.getTitle() );
      executableFileType.setCanSchedule( hasOperationId( contentInfo.getOperations(), "SCHEDULE_NEW" ) );
      executableFileType.setCanEdit( hasOperationId( contentInfo.getOperations(), "EDIT" ) );
      executableTypes.add( executableFileType );
    }

    final GenericEntity<List<ExecutableFileTypeDto>> entity =
      new GenericEntity<List<ExecutableFileTypeDto>>( executableTypes ) {
View Full Code Here

    IPluginManager pluginManager = PentahoSystem.get( IPluginManager.class, UserConsoleService.getPentahoSession() ); //$NON-NLS-1$
    if ( pluginManager != null ) {
      // load content types from IPluginSettings
      int i = 0;
      for ( String contentType : pluginManager.getContentTypes() ) {
        IContentInfo info = pluginManager.getContentTypeInfo( contentType );
        if ( info != null ) {
          settings.add( new Setting( "plugin-content-type-" + i, "." + contentType ) ); //$NON-NLS-1$ //$NON-NLS-2$
          settings.add( new Setting( "plugin-content-type-icon-" + i, info.getIconUrl() ) ); //$NON-NLS-1$
          int j = 0;
          for ( IPluginOperation operation : info.getOperations() ) {
            settings.add( new Setting( "plugin-content-type-" + i + "-command-" + j, operation.getId() ) ); //$NON-NLS-1$
            settings.add( new Setting(
                "plugin-content-type-" + i + "-command-perspective-" + j, operation.getPerspective() ) ); //$NON-NLS-1$
            j++;
          }
View Full Code Here

    StandaloneSession session = new StandaloneSession();
    StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();
    factory.init( "test-res/solution/system/pentahoObjects.spring.xml", null );

    IContentInfo obj = factory.get( IContentInfo.class, session );
    assertEquals( "Test Session", obj.getTitle() );

    IContentInfo obj_again = factory.get( IContentInfo.class, session );
    assertSame( obj_again, obj );

    session = new StandaloneSession();
    IContentInfo obj_newer = factory.get( IContentInfo.class, session );
    assertNotSame( obj, obj_newer );
  }
View Full Code Here

    List<IContentInfo> contentTypes = plugin.getContentInfos();

    Object contentType = CollectionUtils.find( contentTypes, new Predicate() {
      public boolean evaluate( Object object ) {
        IContentInfo type = (IContentInfo) object;
        return type.getTitle().equals( "Good Test Type" );
      }
    } );
    assertNotNull( "\"Good Test Type\" should have been loaded", contentType );
    assertNotNull( "\"Good Test Type\" extension definition is incorrect", ( (IContentInfo) contentType )
        .getExtension().equals( "good-content-type" ) );

    IContentInfo contentInfo = (IContentInfo) contentType;
    IPluginOperation operation = contentInfo.getOperations().listIterator().next();
    assertEquals( "Missing perspective", "custom-perspective", operation.getPerspective() );

    assertEquals( "\"Test Type Missing type\" should not have been loaded", 0, CollectionUtils.countMatches(
        contentTypes, new Predicate() {
          public boolean evaluate( Object object ) {
            IContentInfo type = (IContentInfo) object;
            return type.getTitle().equals( "Test Type Missing type" );
          }
        } ) );

    assertEquals( "\"test-type-missing-title\" should not have been loaded", 0, CollectionUtils.countMatches(
        contentTypes, new Predicate() {
          public boolean evaluate( Object object ) {
            IContentInfo type = (IContentInfo) object;
            return type.getExtension().equals( "test-type-missing-title" );
          }
        } ) );
  }
View Full Code Here

    // of types defined by IContentInfo's. Is this really what we want? If a type has no content
    // generator configured, then it is invisible through this API.
    assertTrue( "test10type1 should be registered", types.contains( "test10type1-ext" ) );
    assertTrue( "test10type2 should be registered", types.contains( "test10type2-ext" ) );

    IContentInfo contentInfo = pluginManager.getContentTypeInfo( "test10type1-ext" );
    assertNotNull( "type should be registered for extension test10type1-ext", contentInfo );
    assertEquals( "test10type1-title", contentInfo.getTitle() );
    assertEquals( "test10type1-description", contentInfo.getDescription() );
    assertEquals( "test10type1-ext", contentInfo.getExtension() );
    assertEquals( "test10type1-url", contentInfo.getIconUrl() );

    List<IPluginOperation> ops = contentInfo.getOperations();
    assertNotNull( "Operations are null", ops );
    assertEquals( "Wrong number of ops", 2, ops.size() );

    assertEquals( "Operation name is wrong", "test10type1-oper1-id", ops.get( 0 ).getId() );
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IContentInfo

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.