Examples of IUserSettingService


Examples of org.pentaho.platform.api.usersettings.IUserSettingService

  @Consumes( { WILDCARD } )
  @Produces( "text/plain" )
  @Facet ( name = "Unsupported" )
  public Response setTheme( String theme ) {
    getPentahoSession().setAttribute( "pentaho-user-theme", theme );
    IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, getPentahoSession() );
    settingsService.setUserSetting( "pentaho-user-theme", theme );
    return getActiveTheme();
  }
View Full Code Here

Examples of org.pentaho.platform.api.usersettings.IUserSettingService

  @GET
  @Path( "/active" )
  @Produces( "text/plain" )
  @Facet ( name = "Unsupported" )
  public Response getActiveTheme() {
    IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, getPentahoSession() );
    return Response.ok(
      StringUtils.defaultIfEmpty( (String) getPentahoSession().getAttribute( "pentaho-user-theme" ), settingsService
        .getUserSetting( "pentaho-user-theme", PentahoSystem.getSystemSetting( "default-theme", "onyx" ) )
          .getSettingValue() ) ).type( MediaType.TEXT_PLAIN ).build();
  }
View Full Code Here

Examples of org.pentaho.platform.api.usersettings.IUserSettingService

  @Path( "/list" )
  @Produces( { APPLICATION_JSON, APPLICATION_XML } )
  @Facet ( name = "Unsupported" )
  public ArrayList<Setting> getUserSettings() {
    try {
      IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, getPentahoSession() );
      ArrayList<IUserSetting> userSettings = (ArrayList<IUserSetting>) settingsService.getUserSettings();

      ArrayList<Setting> settings = new ArrayList<Setting>();
      for ( IUserSetting userSetting : userSettings ) {
        settings.add( new Setting( userSetting.getSettingName(), userSetting.getSettingValue() ) );
      }
View Full Code Here

Examples of org.pentaho.platform.api.usersettings.IUserSettingService

   */
  @GET
  @Path( "{setting : .+}" )
  @Facet ( name = "Unsupported" )
  public Response getUserSetting( @PathParam( "setting" ) String setting ) {
    IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, getPentahoSession() );
    IUserSetting userSetting = settingsService.getUserSetting( setting, null );
    return Response.ok( userSetting != null ? userSetting.getSettingValue() : null ).build();
  }
View Full Code Here

Examples of org.pentaho.platform.api.usersettings.IUserSettingService

   */
  @POST
  @Path( "{setting : .+}" )
  @Facet ( name = "Unsupported" )
  public Response setUserSetting( @PathParam( "setting" ) String setting, String settingValue ) {
    IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, getPentahoSession() );
    settingsService.setUserSetting( setting, settingValue );
    return Response.ok( settingValue ).build();
  }
View Full Code Here

Examples of org.pentaho.platform.api.usersettings.IUserSettingService

      String moduleName = req.getParameter( "context" );
      OutputStream out = resp.getOutputStream();
      resp.setContentType( "text/javascript" ); //$NON-NLS-1$
      resp.setHeader( "Cache-Control", "no-cache" ); //$NON-NLS-1$

      IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, getPentahoSession( req ) );

      String activeTheme = (String) getPentahoSession( req ).getAttribute( "pentaho-user-theme" );

      String ua = req.getHeader( "User-Agent" );
      // check if we're coming from a mobile device, if so, lock to system default (crystal)
      if ( !StringUtils.isEmpty( ua ) && ua.matches( ".*(?i)(iPad|iPod|iPhone|Android).*" ) ) {
        activeTheme = PentahoSystem.getSystemSetting( "default-theme", "crystal" );
      }
      if ( activeTheme == null ) {
        try {
          activeTheme = settingsService.getUserSetting( "pentaho-user-theme", null ).getSettingValue();
        } catch ( Exception ignored ) { // the user settings service is not valid in the agile-bi deployment of the
                                        // server
        }
        if ( activeTheme == null ) {
          activeTheme = PentahoSystem.getSystemSetting( "default-theme", "crystal" );
View Full Code Here

Examples of org.pentaho.platform.api.usersettings.IUserSettingService

    // write out the style sheet and the HTML document

    out.write( "<html>\n<head>".getBytes() ); //$NON-NLS-1$

    final IPentahoSession session = PentahoSessionHolder.getSession();
    IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, session );
    String activeThemeName;
    if ( session == null || settingsService == null ) {
      activeThemeName = PentahoSystem.getSystemSetting( "default-activeThemeName", "onyx" );
    } else {
      activeThemeName = StringUtils.defaultIfEmpty( (String) session.getAttribute( "pentaho-user-activeThemeName" ), settingsService
        .getUserSetting( "pentaho-user-activeThemeName", PentahoSystem.getSystemSetting( "default-activeThemeName", "onyx" ) )
          .getSettingValue() );
    }

    IThemeManager themeManager = PentahoSystem.get( IThemeManager.class, null );
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.