com.bemoko.live.platform.content.domain
Class Profile

java.lang.Object
  extended by com.bemoko.live.platform.content.domain.Profile

@Entity
public class Profile
extends Object


Constructor Summary
Profile()
          Create an empty new profile.
Profile(String uid)
          Create a new profile with a given UID.
 
Method Summary
 void addGlobalIdentity(String domain, String containerUid)
          Add a new global identity to the profile TODO: This addGlobalIdentity should return the global identity if creates
 void addIdentityKey(IdentityKey identityKey)
          Add an identity key to this profile
 ProfileAttributeSet get(String attributeName)
          Get the profile attribute set.
 List<String> getAttributeNames()
          Alphabetically sorted attribute names as a convenience for template rendering.
 Map<String,ProfileAttributeSet> getAttributes()
           
 Date getCreated()
           
 Set<GlobalIdentity> getGlobalIdentities()
           
 Set<GlobalIdentity> getGlobalIdentities(String domain)
          Get the global identities for a given domain
 GlobalIdentity getGlobalIdentity(String domain)
          Note that currently if there are multiple global identities for a given domain for a given profile then this API will return an arbitrary one of these.
 String getGlobalUid(String domain)
          Get the global identity for a given domain.
 Set<IdentityKey> getIdentityKeys()
          Get the identity keys associated with this user
 Date getLastAccessed()
          Get the date/time when this profile was last accessed
 ProfileAttributeSet getOrCreate(String attributeName)
          Get or create a profile attribute
 int getQuality()
          Get the quality of the user, 0 means that the profile was created on the fly, but never reused.
 String getUid()
          Get the user id for this profile
 IdentityKey getValidIdentityKey()
           
 void remove(String attributeName)
           
 boolean removeGlobalIdentities(String domain)
          Remove all the global identities for a given domain
 boolean removeGlobalIdentity(String domain, String containerUid)
          Remove the associated global identity from the profile
 void setCreated(Date created)
           
 void setGlobalIdentities(Set<GlobalIdentity> globalIdentities)
           
 void setGlobalIdentity(String domain, String containerUid)
          Set the single global identity for a given domain (replacing all existing global identities for that domain)
 void setIdentityKeys(Set<IdentityKey> identityKeys)
           
 void setLastAccessed(Date lastAccessed)
           
 void setProfile(Map<String,ProfileAttributeSet> profile)
           
 void setQuality(int quality)
           
 void setUid(String uid)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Profile

public Profile()
Create an empty new profile. This is normally only called for construction when loading from a persistent store and where all the properties will be subsequently set


Profile

public Profile(String uid)
Create a new profile with a given UID.

Parameters:
uid -
Method Detail

addGlobalIdentity

public void addGlobalIdentity(String domain,
                              String containerUid)
Add a new global identity to the profile TODO: This addGlobalIdentity should return the global identity if creates

Parameters:
domain -
containerUid -

addIdentityKey

public void addIdentityKey(IdentityKey identityKey)
Add an identity key to this profile

Parameters:
identityKey -

get

public ProfileAttributeSet get(String attributeName)
Get the profile attribute set. All calls to profile attributes should be through this method. The profile attribute set can be used to store users preferences, favourites and any other information associated with the user

Parameters:
attributeName -
Returns:
attribute value

getAttributes

public Map<String,ProfileAttributeSet> getAttributes()

getAttributeNames

public List<String> getAttributeNames()
Alphabetically sorted attribute names as a convenience for template rendering.


getCreated

public Date getCreated()

getGlobalIdentities

public Set<GlobalIdentity> getGlobalIdentities()

getGlobalIdentities

public Set<GlobalIdentity> getGlobalIdentities(String domain)
Get the global identities for a given domain

Returns:
global identities associated with this profile

getGlobalIdentity

public GlobalIdentity getGlobalIdentity(String domain)
Note that currently if there are multiple global identities for a given domain for a given profile then this API will return an arbitrary one of these. In the future bemokoLive will provide a mechanism to mark one as the preferred.

Parameters:
domain -
Returns:
global identity for a given domain

getGlobalUid

public String getGlobalUid(String domain)
Get the global identity for a given domain.

Returns:
global UID for a given domain associated with this profile

getIdentityKeys

public Set<IdentityKey> getIdentityKeys()
Get the identity keys associated with this user

Returns:
identity keys

getLastAccessed

public Date getLastAccessed()
Get the date/time when this profile was last accessed

Returns:
date that this profile was last accessed

getOrCreate

public ProfileAttributeSet getOrCreate(String attributeName)
Get or create a profile attribute

Parameters:
attributeName -
Returns:
profile attribute site for a the given attribute name

getQuality

public int getQuality()
Get the quality of the user, 0 means that the profile was created on the fly, but never reused. 1 means that it is a repeat visitor. Higher numbers will be allocated to indicated that the profile is associated with a repeat user of the system

Returns:
quality of the profile

getUid

public String getUid()
Get the user id for this profile

Returns:
UID for the profile

getValidIdentityKey

public IdentityKey getValidIdentityKey()

removeGlobalIdentities

public boolean removeGlobalIdentities(String domain)
Remove all the global identities for a given domain

Parameters:
domain -
Returns:
true if some global identities were removed

removeGlobalIdentity

public boolean removeGlobalIdentity(String domain,
                                    String containerUid)
Remove the associated global identity from the profile

Parameters:
domain -
containerUid -
Returns:
true if some global identities were removed

setCreated

public void setCreated(Date created)

setGlobalIdentities

public void setGlobalIdentities(Set<GlobalIdentity> globalIdentities)

setGlobalIdentity

public void setGlobalIdentity(String domain,
                              String containerUid)
Set the single global identity for a given domain (replacing all existing global identities for that domain)

Parameters:
domain -
containerUid -

setIdentityKeys

public void setIdentityKeys(Set<IdentityKey> identityKeys)

setLastAccessed

public void setLastAccessed(Date lastAccessed)

setProfile

public void setProfile(Map<String,ProfileAttributeSet> profile)

setQuality

public void setQuality(int quality)

setUid

public void setUid(String uid)

toString

public String toString()
Overrides:
toString in class Object

remove

public void remove(String attributeName)