Intellicus Enterprise Reporting and Business Insights 19.1

User Preferences

0 views May 1, 2020 0

GetUserPreferences

This Java API is used to get the default User Preferences set by the User.

Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Preferences/GetUserPreferences.java for sample code of this use case.

Steps:

  1. Initialize Report Client.
  2. Initialize Requestor UserInfo.
  3. Create a PersonalizationManager class object for UserPrefernces and Dashboard related settings.

    PersonalizationManager pm=new PersonalizationManager();

  1. Get the User Preferences in the instance of Preferences.
     
    Method: getUserPreferences

    public Preferences getUserPreferences (UserInfo userInfo) throws PersonalizationHandlerException

    This method returns Preferences for the given user.

    Parameters:

    • UserInfo: The Information about the user to be used for authorization. Also the user whose Preferences will be returned.

    Returns:

    Preferences for the user.

    Preferences userPref = null;

    userPref=  pm.getUserPreferences(requestorUserInfo);

  1. Get all the User Preferences

    //Returns the defaultConnection

    String defaultCon = userPref.getDefaultConnection();

     

    //Returns the user’s preferred default portal theme

    String  portalTheme = userPref.getDefaultPortalTheme();

     

    //Method returns default stylesheet of the user

    String defaultStylesheet = userPref.getDefaultStylesheet();

     

    //Method returns the user’s preferred deliver location

    String deliveryLocation = userPref.getDeliveryLocation();

     

    //Method returns the user’s preferred report format

    String defaultFormat = userPref.getFormat();

     

    //Method returns the user’s preferred language

    String prefLanguage = userPref.getPrefLanguage();

     

    //Method returns the number of recent reports to be shown

    int reportCount = userPref.getReportCount();

     

    //Method returns the Boolean value whether to show the inbox

    Boolean showInbox = userPref.getShowInbox();

     

    //This Method returns default template name used for all reports

    String templateName = userPref.getTemplateName();

     

    // Method returns the Boolean value whether to show the recent reports or not

    Boolean showRecentReports = userPref.getShowRecentReports();

     

    System.out.println(“Default Connection  :  “+defaultCon);

    System.out.println(“Default Portal Theme  :  “+portalTheme);

    System.out.println(“Default Stylesheet:”+defaultStylesheet);

    System.out.println(“Delivery Location  :  “+deliveryLocation);

    System.out.println(“Default Format  :  “+defaultFormat);

    System.out.println(“Default Preferred Language  : “+prefLanguage);

    System.out.println(“Report Count  :  “+reportCount);

    System.out.println(“Show Inbox  :  “+showInbox);

    System.out.println(“Template Name  :  “+templateName);

    System.out.println(“Show Recent Reports  :  “+showRecentReports);

setUserPreferences

This Java API is used to set the default User Preferences by the User.

Refer to <Intellicus_Install_Path>/SampleCodes/Java APIs/User Preferences/SetUserPreferences.java for sample code of this use case.

Steps:

  1. Initialize Report Client.
  2. Initialize Requestor UserInfo.
  3. Create a PersonalizationManager class object for UserPrefernces and Dashboard related settings.

    PersonalizationManager pm=new PersonalizationManager();

  1. Get the User Preferences in the instance of Preferences.

    Preferences pref = new Preferences();

    pref=  pmanager.getUserPreferences(requestorUserInfo);

  1. Set the new value for User Preferences.

    int reportCount = 12;

    String templateName = “Beach”;

    String email = “hostUser@hostOrg.com”;

    String defConnection = “MyConnection”;

     

    pref.setReportCount(reportCount);

    pref.setTemplateName(templateName);

    pref.setShowRecentReports(true);

    pref.setDefaultConnection(defConnection);

    pref.setDefaultPortalTheme(“Default”);

    pref.setEmail(email);

    pref.setFormat(InteraConstants.ReportFormats.PDF);

    pref.setPrefLanguage(“EN_US”);

  1. Update these User Preferences
     
    Method: updateUserPreferences

    public Preferences updateUserPreferences(Preferences userPref, UserInfo userInfo)

    throws PersonalizationHandlerException

    This method updates the user preferences to the repository.

    Parameters:

    • UserPref: The user preferences prefernces details
    • UserInfo: userInfo object for authorization.

    Returns:

    Preferences

    //Method used to update the user preferences to the repository

    pmanager.updateUserPreferences(pref, requestorUserInfo);

Leave A Comment
*
*