Java API for Saving User Preferences
Overview
API to save user preferences in the database.
Example
API to save user preferences.
/** * method to set user/group preferences . * @param preferenceJSON: Updated JSON * @param userName: Name of the user for which preferences has to be set. * @param userId: The Id of the user on which preferences has to be set. * @param groupName: group name on which preferences has to be set. * @param userInfo: Object of type UserInfo containing information about logged in user. *@param updateType : updateType can be COMPLETE or PARTIAL. Default value is COMPLETE. */ SecurityManager sm = SecurityManager.getInstance(); String updateUserPreferences(String preferenceJSON, String userName, UserInfo userInfo); String updateUserPreferencesByUserId(String preferenceJSON, String userId, UserInfo userInfo); String updateUserPreferencesByGroupName(String preferenceJSON, String groupName, UserInfo userInfo); public String updateUserPreferencesByGroupName(String preferenceJSON, String groupName, UserInfo userInfo, String updateType);API to add a custom attribute in UserInfo.
/** * Method to add custom attribute. * @param attributeName * @param attributeValue * @param nameType * @param valueType */ public void addCustomAttribute(String attributeName, String attributeValue, String nameType, String valueType)API to parse UserInfo XML and set the internal properties of the UserInfo object.
/** * Method to parse the given userXML and populate this Object attributes * @param userXML String */ public void parseXML(String userXML)API to add a user to a group.
/** * Method to add a user into a group * @param groupId: String */public void addGroup(String groupId)API to assign a role to a UserGroup.
/** * Method to assign a role to a UserGroup. * @param role */ public void setRole(String role)API to parse roleXML and set internal properties of UserRole.
/** * Method to parse roleXML set Role properties. * @param roleXML */ public void parseXML(String roleXML)