Package pt.webdetails.cpf.persistence

Examples of pt.webdetails.cpf.persistence.IPersistenceEngine


    }
  };

  protected ViewsEngine() {
    // initialize orientDb and initialize org.pentaho.cdf.views.View
    IPersistenceEngine pe = null;
    try {
      pe = getPersistenceEngine();
      if ( pe != null && !pe.classExists( View.class.getName() ) ) {
        pe.initializeClass( View.class.getName() );
      }
    } catch ( Exception e ) {
      // Intended general exception catch - do not want any PersistenceEngine initialization exception
      // to bubble up
      logger.error( "Error while initializing Views Engine. CDF will work but no views will be available", e );
View Full Code Here


  }

  public String saveView( String view, String user ) {
    View viewObj = new View();

    IPersistenceEngine pe = null;
    try {
      pe = getPersistenceEngine();
    } catch ( Exception e ) {
      logger.error( "Exception while getting persistence engine. View Will not be saved", e );
    }

    try {
      JSONObject json = new JSONObject( view );
      viewObj.fromJSON( json );
      viewObj.setUser( user );
      pe.store( viewObj );
    } catch ( JSONException e ) {
      logger.error( e );
      return RESULT_ERROR;
    }
    return RESULT_OK;
View Full Code Here

  }

  @Test
  //Even with PersistenceEngine throwing an exception, it should be able to finish initialization
  public void testInitializationException() {
    IPersistenceEngine ipe = Mockito.mock( IPersistenceEngine.class );
    Mockito.when( ipe.classExists( "org.pentaho.cdf.views.View" ) )
            .thenThrow( new ODatabaseException( "Exception" ) );
    new ViewsEngineForTest( ipe, null );
  }
View Full Code Here

TOP

Related Classes of pt.webdetails.cpf.persistence.IPersistenceEngine

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.