* @return userProfile
* @exception Exception
*/
public UserProfile addUserProfile (IPerson person, UserProfile profile) throws Exception {
int userId = person.getID();
UserProfile newProfile = null;
// generate an id for this profile
Connection con = RDBMServices.getConnection();
try {
PreparedStatement pstmt = con.prepareStatement("INSERT INTO UP_USER_PROFILE " +
"(USER_ID,PROFILE_ID,PROFILE_FNAME,PROFILE_NAME,STRUCTURE_SS_ID,THEME_SS_ID," +
"DESCRIPTION, LAYOUT_ID) VALUES (?,?,?,?,?,?,?,?)");
int profileId = getNextKey();
pstmt.setInt(1, userId);
pstmt.setInt(2, profileId);
pstmt.setString(3, profile.getProfileFname());
pstmt.setString(4, profile.getProfileName());
pstmt.setInt(5, profile.getStructureStylesheetId());
pstmt.setInt(6, profile.getThemeStylesheetId());
pstmt.setString(7, profile.getProfileDescription());
pstmt.setInt(8, profile.getLayoutId());
String sQuery = "INSERT INTO UP_USER_PROFILE (USER_ID,PROFILE_ID,PROFILE_FNAME,PROFILE_NAME,STRUCTURE_SS_ID,THEME_SS_ID,DESCRIPTION, LAYOUT_ID) VALUES ("
+ userId + ",'" + profileId + ",'" + profile.getProfileFname() + "','" + profile.getProfileName() + "'," + profile.getStructureStylesheetId()
+ "," + profile.getThemeStylesheetId() + ",'" + profile.getProfileDescription() + "', "+profile.getLayoutId()+")";
if (log.isDebugEnabled())
log.debug("RDBMUserLayoutStore::addUserProfile(): " + sQuery);
try {
pstmt.executeUpdate();
newProfile = new UserProfile();
newProfile.setProfileId(profileId);
newProfile.setLayoutId(profile.getLayoutId());
newProfile.setLocaleManager(profile.getLocaleManager());
newProfile.setProfileDescription(profile.getProfileDescription());
newProfile.setProfileFname(profile.getProfileFname());
newProfile.setProfileName(profile.getProfileName());
newProfile.setStructureStylesheetId(profile.getStructureStylesheetId());
newProfile.setSystemProfile(false);
newProfile.setThemeStylesheetId(profile.getThemeStylesheetId());
} finally {
pstmt.close();
}
} finally {