Examples of DashboardStructure


Examples of pt.webdetails.cdf.dd.structure.DashboardStructure

      }
    }

    try {

      final DashboardStructure dashboardStructure = new DashboardStructure();
      Object result = null;

      if ( OPERATION_LOAD.equalsIgnoreCase( operation ) ) {
        String file = getRequestParameters().getStringParameter( "file", null );
        JsonUtils.buildJsonResult( getResponse().getOutputStream(), true, dashboardStructure.load( file ) );
        return;
      } else if ( OPERATION_DELETE.equalsIgnoreCase( operation ) ) {
        dashboardStructure.delete( toHashMap( getRequestParameters() ) );

      } else if ( OPERATION_SAVE.equalsIgnoreCase( operation ) ) {
        result = dashboardStructure.save( path, cdfStructure );
      } else if ( OPERATION_SAVE_AS.equalsIgnoreCase( operation ) ) {
        boolean isPreview = ( path.indexOf( "_tmp.cdfde" ) > -1 || path.indexOf( "_tmp.wcdf" ) > -1 );
        dashboardStructure.saveAs( path, title, description, cdfStructure, isPreview );

      } else if ( OPERATION_NEW_FILE.equalsIgnoreCase( operation ) ) {
        dashboardStructure.newfile( toHashMap( getRequestParameters() ) );

      } else if ( OPERATION_SAVE_SETTINGS.equalsIgnoreCase( operation ) ) {
        // check if user is attempting to save settings over a new (non yet saved) dashboard/widget/template
        String file = getRequestParameters().getStringParameter( "file", null );
        if ( StringUtils.isEmpty( file ) || UNSAVED_FILE_PATH.equals( file ) ) {
          String msg = Messages.getString( "CdfTemplates.ERROR_003_SAVE_DASHBOARD_FIRST" );
          logger.warn( msg );
          JsonUtils.buildJsonResult( getResponse().getOutputStream(), false, msg );
          return;
        }
        dashboardStructure.savesettings( toHashMap( getRequestParameters() ) );

      } else {
        logger.error( "Unknown operation: " + operation );
      }
View Full Code Here

Examples of pt.webdetails.cdf.dd.structure.DashboardStructure

        return JsonUtils.getJsonResult( false, msg );
      }
    }

    try {
      final DashboardStructure dashboardStructure = new DashboardStructure();
      Object result = null;
      HashMap<String, Object> params = new HashMap<String, Object>( request.getParameterMap() );
      params.put( MethodParams.FILE, file );
      params.put( MethodParams.WIDGET, String.valueOf( widget ) );
      if ( !author.isEmpty() ) {
        params.put( MethodParams.AUTHOR, author );
      }
      if ( !style.isEmpty() ) {
        params.put( MethodParams.STYLE, style );
      }
      if ( !widgetName.isEmpty() ) {
        params.put( MethodParams.WIDGET_NAME, widgetName );
      }
      if ( !rendererType.isEmpty() ) {
        params.put( MethodParams.RENDERER_TYPE, rendererType );
      }
      if ( !title.isEmpty() ) {
        params.put( MethodParams.TITLE, title );
      }
      if ( !description.isEmpty() ) {
        params.put( MethodParams.DESCRIPTION, description );
      }
      String[] widgetParameters = widgetParams.toArray( new String[ 0 ] );
      if ( widgetParameters.length > 0 ) {
        params.put( MethodParams.WIDGET_PARAMETERS, widgetParameters );
      }

      String wcdfdeFile = file.replace( ".wcdf", ".cdfde" );

      if ( OPERATION_LOAD.equalsIgnoreCase( operation ) ) {
        return dashboardStructure.load( wcdfdeFile );
      } else if ( OPERATION_DELETE.equalsIgnoreCase( operation ) ) {
        dashboardStructure.delete( params );
      } else if ( OPERATION_SAVE.equalsIgnoreCase( operation ) ) {
        result = dashboardStructure.save( file, cdfStructure );
      } else if ( OPERATION_SAVE_AS.equalsIgnoreCase( operation ) ) {
        if ( StringUtils.isEmpty( title ) ) {
          title = FilenameUtils.getBaseName( file );
        }
        result = dashboardStructure.saveAs( file, title, description, cdfStructure, isPreview );
      } else if ( OPERATION_NEW_FILE.equalsIgnoreCase( operation ) ) {
        dashboardStructure.newfile( params );
      } else if ( OPERATION_SAVE_SETTINGS.equalsIgnoreCase( operation ) ) {

        // check if user is attempting to save settings over a new (non yet saved) dashboard/widget/template
        if( StringUtils.isEmpty( file ) || file.equals( UNSAVED_FILE_PATH ) ) {
          logger.warn( getMessage( "CdfTemplates.ERROR_003_SAVE_DASHBOARD_FIRST" ) );
          return JsonUtils.getJsonResult( false, getMessage( "CdfTemplates.ERROR_003_SAVE_DASHBOARD_FIRST" ) );
        }
        dashboardStructure.savesettings( params );
      } else {
        logger.error( "Unknown operation: " + operation );
      }
      return JsonUtils.getJsonResult( true, result );
    } catch ( Exception e ) {
View Full Code Here

Examples of pt.webdetails.cdf.dd.structure.DashboardStructure

        return JsonUtils.getJsonResult( false, msg );
      }
    }

    try {
      final DashboardStructure dashboardStructure = new DashboardStructure();
      Object result = null;


      if ( OPERATION_SAVE.equalsIgnoreCase( operation ) ) {
        result = dashboardStructure.save( file, cdfStructure );
      } else if ( OPERATION_SAVE_AS.equalsIgnoreCase( operation ) ) {
        result = dashboardStructure.saveAs( file, title, description, cdfStructure, isPreview );
      } else {
        logger.error( "Unknown operation: " + operation );
      }
      return JsonUtils.getJsonResult( true, result );
    } catch ( Exception e ) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.