try
{
DynaActionForm dynaForm = (DynaActionForm)form;
HttpSession session = request.getSession();
UserObject userobject =(UserObject) session.getAttribute("userobject");
UserPrefererences userPrefererences = userobject.getUserPref();
String typeOfSave = "save";
int individualID = 0;
String[] leftportlet = (String[])request.getParameterValues("portletsLeft");
String[] rightportlet = (String[])request.getParameterValues("portletsRight");
Vector vec = new Vector();
if (rightportlet != null)
{
for (int i = 0; i < rightportlet.length; i++)
{
PreferenceVO pvo3 = new PreferenceVO();
pvo3.setModuleId(4);
pvo3.setPreferenceName(rightportlet[i]);
pvo3.setPreferenceValue("YES");
vec.addElement(pvo3);
}
}
if (leftportlet != null)
{
for (int i = 0; i < leftportlet.length; i++)
{
PreferenceVO pvo4 = new PreferenceVO();
pvo4.setModuleId(4);
pvo4.setPreferenceName(leftportlet[i]);
pvo4.setPreferenceValue("NO");
vec.addElement(pvo4);
}
}
UserObject userObject = (UserObject)session.getAttribute("userobject");
// might as well null pointer now before we do any real harm
individualID = userObject.getIndividualID();
if (request.getParameter("buttonpress") != null)
{
typeOfSave = request.getParameter("buttonpress");
PreferenceVO pvo1 = new PreferenceVO();
PreferenceVO pvo2 = new PreferenceVO();
pvo1.setModuleId(4);
pvo1.setPreferenceName("homesettingrefreshmin");
String minutes = (String) (dynaForm.get("minutes"));
pvo1.setPreferenceValue(minutes);
pvo2.setModuleId(4);
pvo2.setPreferenceName("homesettingrefreshsec");
String seconds = (String) (dynaForm.get("seconds"));
pvo2.setPreferenceValue(seconds);
vec.addElement(pvo1);
vec.addElement(pvo2);
PreferenceHome prefHome = (PreferenceHome)CVUtility.getHomeObject("com.centraview.preference.PreferenceHome", "Preference");
Preference prefRemote = prefHome.create();
prefRemote.setDataSource(dataSource);
prefRemote.updateUserPreference(individualID, vec);
updatePrefs(prefRemote.getUserPreferences(individualID),
userObject.getUserPref());
if(minutes != null && !minutes.equals("") && !minutes.equals("null")
&& seconds != null && !seconds.equals("") && !seconds.equals("null"))
{
userPrefererences.setHomeRefreshMin(minutes);