Mar 27, 2006 3:32:00 AM | how to Watch for deprecated methods in the G6 server API

Watch for deprecated methods in the G6 server API

We're doing a G6 upgrade at one of our customer sites and we noticed that one of our PEIs (that used to set a user preference) was dying due to our use of APIs that worked in 5.0.4 but no longer work in G6.

(Just for the record, I guess I have a different idea of the meaning of deprecated when it comes to APIs. I thought that if you deprecate an API it means "please don't use this as it might be removed in future versions of the API." For BEA AquaLogic, I guess it means "this method just doesn't work any more.")

Here's an example: AddPersonalSetting has been replaced by AddPreference.

public Redirect OnAfterLogin(Object userSession, ApplicationData applicationData)
{
IPTSession session = ((IPTSession)userSession);
session.GetMyPages().OpenPage(0 - userId)
.AddPersonalSetting("UserSettingName", "UserSettingValue");
}

Here's the new G6 way to do this:

public Redirect OnAfterLogin(Object userSession, ApplicationData applicationData)
{
IPTSession session = ((IPTSession)userSession);
session.GetSessionInfo()
.AddPreference("UserSettingName", "UserSettingValue", 0);
}

Written By: Christopher Bucchere