com.atlassian.crowd.openid.server.manager.profile
Class ProfileManagerGeneric

java.lang.Object
  extended by com.atlassian.crowd.openid.server.manager.profile.ProfileManagerGeneric
All Implemented Interfaces:
ProfileManager

public class ProfileManagerGeneric
extends Object
implements ProfileManager


Constructor Summary
ProfileManagerGeneric()
           
 
Method Summary
 Profile addNewPopulatedProfile(User user, String profileName, Map attributes)
          Adds a new profile based on attribute name/value pairs.
 Profile addNewProfile(User user, SOAPPrincipal principal, Locale locale, String profileName)
          Creates and adds a new profile to a given user.
 void deleteProfile(User user, long profileID)
          Deletes a the given profile from a user.
 AttributeDAO getAttributeDAO()
           
 SOAPPrincipalHelper getPrincipalHelper()
           
 Profile getProfile(User user, long profileID)
          Retrieves the requested profile from a user.
 ProfileDAO getProfileDAO()
           
 UserDAO getUserDAO()
           
 void makeDefaultProfile(User user, long profileID)
          Changes the default profile of a user.
 void renameProfile(User user, long profileID, String newName)
          Rename an existing profile of a user.
 void setAttributeDAO(AttributeDAO attributeDAO)
           
 void setPrincipalHelper(SOAPPrincipalHelper principalHelper)
           
 void setProfileDAO(ProfileDAO profileDAO)
           
 void setSiteApprovalDAO(SiteApprovalDAO siteApprovalDAO)
           
 void setUserDAO(UserDAO userDAO)
           
 void updateProfile(User user, long profileID, Map attributes)
          Updates a user's profile given a map of attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileManagerGeneric

public ProfileManagerGeneric()
Method Detail

addNewProfile

public Profile addNewProfile(User user,
                             SOAPPrincipal principal,
                             Locale locale,
                             String profileName)
                      throws ProfileAlreadyExistsException
Creates and adds a new profile to a given user. Default profile data is obtained from the SOAPPrincipal/Locale. The following mapping is used: 1. fullname = FirstName + " " + LastName 2. nickname = Username 3. email = Email 4. country = Locale.getCountry() 5. language = Locale.getLanguage()

Specified by:
addNewProfile in interface ProfileManager
Parameters:
user - the user object to add the new profile to.
principal - the SOAPPrincipal which contains basic attribute data.
locale - the Locale of the user (to get country/language information).
profileName - the name of the new profile.
Returns:
new profile.
Throws:
ProfileAlreadyExistsException - if the user already has a profile with the given profile name.

addNewPopulatedProfile

public Profile addNewPopulatedProfile(User user,
                                      String profileName,
                                      Map attributes)
                               throws ProfileAlreadyExistsException
Adds a new profile based on attribute name/value pairs.

Specified by:
addNewPopulatedProfile in interface ProfileManager
Parameters:
user - user that owns the profile.
profileName - the name of the new profile.
attributes - Map
Returns:
newly created profile.
Throws:
ProfileAlreadyExistsException - if the user already has a profile with the given profile name.

updateProfile

public void updateProfile(User user,
                          long profileID,
                          Map attributes)
                   throws ProfileDoesNotExistException,
                          ProfileAccessViolationException
Updates a user's profile given a map of attributes. The user must own the profile referenced by the profileID. The map of attribtue name-values must be non-null. Any attribute names (keys) which are stored in the profile but not the attribute map, will be deleted. All other attribute names will be updated or added.

Specified by:
updateProfile in interface ProfileManager
Parameters:
user - user that owns the profile.
profileID - profile ID of the profile to update.
attributes - Map
Throws:
ProfileDoesNotExistException - if profile with requested profileID does not exist.
ProfileAccessViolationException - if the user does not own the profile with the requested profileID.

makeDefaultProfile

public void makeDefaultProfile(User user,
                               long profileID)
                        throws ProfileDoesNotExistException,
                               ProfileAccessViolationException
Changes the default profile of a user.

Specified by:
makeDefaultProfile in interface ProfileManager
Parameters:
user - user that owns the profile.
profileID - profile ID of the profile to set as default.
Throws:
ProfileDoesNotExistException - if profile with requested profileID does not exist.
ProfileAccessViolationException - if the user does not own the profile with the requested profileID.

deleteProfile

public void deleteProfile(User user,
                          long profileID)
                   throws ProfileDoesNotExistException,
                          ProfileAccessViolationException,
                          DefaultProfileDeleteException
Deletes a the given profile from a user. Note: a user is not allowed to delete their default profile.

Specified by:
deleteProfile in interface ProfileManager
Parameters:
user - user that owns the profile.
profileID - profile ID of the profile to update.
Throws:
ProfileDoesNotExistException - if profile with requested profileID does not exist.
ProfileAccessViolationException - if the user does not own the profile with the requested profileID.
DefaultProfileDeleteException - if the profile requested for deletion is the default profile of the user.

renameProfile

public void renameProfile(User user,
                          long profileID,
                          String newName)
                   throws ProfileDoesNotExistException,
                          ProfileAccessViolationException,
                          ProfileAlreadyExistsException
Rename an existing profile of a user. The new name must not clash with the other existing profile names the user has.

Specified by:
renameProfile in interface ProfileManager
Parameters:
user - user user that owns the profile.
profileID - profileID profile ID of the profile to rename.
newName - new name of the profile.
Throws:
ProfileDoesNotExistException - if profile with requested profileID does not exist.
ProfileAccessViolationException - if the user does not own the profile with the requested profileID.
ProfileAlreadyExistsException - if user already has a profile with the new name.

getProfile

public Profile getProfile(User user,
                          long profileID)
                   throws ProfileDoesNotExistException,
                          ProfileAccessViolationException
Retrieves the requested profile from a user.

Specified by:
getProfile in interface ProfileManager
Parameters:
user - user that owns the profile.
profileID - profile ID of the profile to retrieve.
Returns:
profile corresponding to profileID owned by user.
Throws:
ProfileAccessViolationException - profile with given profileID exists but is not owned by the user.
ProfileDoesNotExistException - profile with given profileID does not exist.

getProfileDAO

public ProfileDAO getProfileDAO()

setProfileDAO

public void setProfileDAO(ProfileDAO profileDAO)

getUserDAO

public UserDAO getUserDAO()

setUserDAO

public void setUserDAO(UserDAO userDAO)

getPrincipalHelper

public SOAPPrincipalHelper getPrincipalHelper()

setPrincipalHelper

public void setPrincipalHelper(SOAPPrincipalHelper principalHelper)

getAttributeDAO

public AttributeDAO getAttributeDAO()

setAttributeDAO

public void setAttributeDAO(AttributeDAO attributeDAO)

setSiteApprovalDAO

public void setSiteApprovalDAO(SiteApprovalDAO siteApprovalDAO)


Copyright © 2012 Atlassian. All Rights Reserved.