profile = context.getUserLayoutStore().getSystemProfileById(profileId.intValue());
} else {
profile = context.getUserLayoutStore().getUserProfileById(context.getPerson(), profileId.intValue());
}
} catch (Exception e) {
throw new PortalException(e);
}
if (profile == null) {
// failed to find the specified profile, return to the base state
context.setState(null);
}
}
}
} else if (action.equals("completeEdit")) {
if (runtimeData.getParameter("submitCancel") != null) {
// cancel button has been hit
context.setState(null);
} else if (runtimeData.getParameter("submitSave") != null) {
// save changes
profile.setProfileName(runtimeData.getParameter("profileName"));
profile.setProfileDescription(runtimeData.getParameter("profileDescription"));
// determine new theme stylesheet id
int newId = Integer.parseInt(runtimeData.getParameter("stylesheetID"));
if (newId != profile.getThemeStylesheetId()) {
profile.setThemeStylesheetId(newId);
// see if the mime type has changed, alert user
}
try {
if (profile.isSystemProfile()) {
// only administrative users should be able to do this
context.getUserLayoutStore().updateSystemProfile(profile);
} else {
context.getUserLayoutStore().updateUserProfile(context.getPerson(), profile);
}
} catch (Exception e) {
throw new PortalException(e);
}
context.setState(null);
}
}
}