Package org.jasig.portal

Examples of org.jasig.portal.UserProfile


      } else if (action.equals("managePreferences")) {
          if (profileId != null) {
              // find the profile mapping
            try {
              if (systemProfile) {
                  UserProfile newProfile = ulsdb.getSystemProfileById(profileId.intValue());
                  if(newProfile!=null && (!(editedProfile.isSystemProfile() && editedProfile.getProfileId()==newProfile.getProfileId()))) {
                      // new profile has been selected
                      editedProfile=newProfile;
                      instantiateManagePreferencesState(editedProfile);
                  }
              } else {
                  UserProfile newProfile = ulsdb.getUserProfileById(upm.getPerson(), profileId.intValue());
                  if(newProfile!=null && (editedProfile.isSystemProfile() || (editedProfile.getProfileId()!=newProfile.getProfileId()))) {
                      // new profile has been selected
                      editedProfile=newProfile;
                      instantiateManagePreferencesState(editedProfile);
                  }
              }
View Full Code Here


   * @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 {
View Full Code Here

                } else {
                    String msg = "The system user profile has no theme stylesheet Id.";
                    throw new IllegalStateException(msg);
                }
            }
            UserProfile userProfile = new UserProfile(profileId, temp2, temp3,temp4, layoutId, structSsId, themeSsId);
            userProfile.setLocaleManager(new LocaleManager(person));
            return userProfile;
          }
          else {
            throw new Exception("Unable to find User Profile for user " + userId + " and profile " + profileId);
          }
View Full Code Here

                } else {
                    String msg = "The system user profile has no theme stylesheet Id.";
                    throw new IllegalStateException(msg);
                }
            }
            UserProfile userProfile = new UserProfile(profileId, profileFname, profileName, profileDesc, layoutId, structSsId, themeSsId);
            userProfile.setLocaleManager(new LocaleManager(person));
            return userProfile;
          }
          else {
          /* Try to copy the template profile. */
          log.debug("Copying template profile " + profileFname + " to user " + person.getID());
          rs.close();
          pstmt.close();
          pstmt = con.prepareStatement("SELECT USER_DFLT_USR_ID FROM UP_USER WHERE USER_ID=?");
          pstmt.setInt(1, person.getID());
          rs = pstmt.executeQuery();
          if(rs.next()) {
            int defaultProfileUser = rs.getInt(1);
            IPerson defaultProfilePerson = new PersonImpl();
            defaultProfilePerson.setID(defaultProfileUser);
            if(defaultProfilePerson.getID() != person.getID()) {
              UserProfile templateProfile = getUserProfileByFname(defaultProfilePerson,profileFname);
              if(templateProfile != null) {
                  final UserProfile newUserProfile = new UserProfile(templateProfile);
                  newUserProfile.setLayoutId(0);
                return addUserProfile(person,newUserProfile);
              } else {
                        throw new Exception("Unable to find template profile for " + userId + " and profile " + profileFname);
              }
            } else {
View Full Code Here

            int themeSsId = rs.getInt(8);
            if (rs.wasNull()) {
              themeSsId = 0;
            }

            UserProfile upl = new UserProfile(rs.getInt(2), rs.getString(3), rs.getString(4), rs.getString(5),
                layoutId, structSsId, themeSsId);
            pv.put(new Integer(upl.getProfileId()), upl);
          }
        } finally {
          rs.close();
        }
      } finally {
View Full Code Here

  public UserProfile getSystemProfile (String userAgent) throws Exception {
    String profileFname = getSystemBrowserMapping(userAgent);
    if (profileFname == null)
      return  null;
    UserProfile up = this.getUserProfileByFname(this.getSystemUser(), profileFname);
    up.setSystemProfile(true);
    return  up;
  }
View Full Code Here

    up.setSystemProfile(true);
    return  up;
  }

  public UserProfile getSystemProfileById (int profileId) throws Exception {
    UserProfile up = this.getUserProfileById(this.getSystemUser(), profileId);
    up.setSystemProfile(true);
    return  up;
  }
View Full Code Here

    up.setSystemProfile(true);
    return  up;
  }

  public UserProfile getSystemProfileByFname (String profileFname) throws Exception {
      UserProfile up = this.getUserProfileByFname(this.getSystemUser(), profileFname);
      up.setSystemProfile(true);
      return  up;
    }
View Full Code Here

    }

  public Hashtable getSystemProfileList () throws Exception {
    Hashtable pl = this.getUserProfileList(this.getSystemUser());
    for (Enumeration e = pl.elements(); e.hasMoreElements();) {
      UserProfile up = (UserProfile)e.nextElement();
      up.setSystemProfile(true);
    }
    return  pl;
  }
View Full Code Here

        }
    }

  public UserPreferences getUserPreferences (IPerson person, String profileFname) throws Exception {
    UserPreferences up = null;
    UserProfile profile = this.getUserProfileByFname(person, profileFname);
    if (profile != null) {
      up = getUserPreferences(person, profile);
    }
    return  (up);
  }
View Full Code Here

TOP

Related Classes of org.jasig.portal.UserProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.