Class Profile
- All Implemented Interfaces:
Serializable
,SystemPropertiesItem
- Direct Known Subclasses:
Persona
,ProfileToImport
Contrary to other unomi Item
s, profiles are not part of a scope since we want to be able to track the associated user across applications. For this reason, data
collected for a given profile in a specific scope is still available to any scoped item that accesses the profile information.
It is interesting to note that there is not necessarily a one to one mapping between users and profiles as users can be captured across applications and different observation contexts. As identifying information might not be available in all contexts in which data is collected, resolving profiles to a single physical user can become complex because physical users are not observed directly. Rather, their portrait is progressively patched together and made clearer as unomi captures more and more traces of their actions. Unomi will merge related profiles as soon as collected data permits positive association between distinct profiles, usually as a result of the user performing some identifying action in a context where the user hadn’t already been positively identified.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns all the consents, including the revokes ones.Deprecated.since 2.0.0 merge mechanism is now based on profile aliases, and this property is not used anymoregetNestedProperty
(String name) Retrieves the value of the nested property identified by the specified name.Retrieves a Map of all property name - value pairs for this profile.getProperty
(String name) Retrieves the property identified by the specified name.getScope()
Retrieves the Item's scope.Retrieves the scores associated to this profile.Retrieves the identifiers of the segments this profile is a member of.Retrieves a Map of system property name - value pairs for this profile.boolean
Returns true if this profile is an anonymous profile.boolean
setConsent
(Consent consent) Set a consent into the profile.void
setMergedWith
(String mergedWith) Deprecated.since 2.0.0 merge mechanism is now based on profile aliases, and this property is not used anymorevoid
setProperties
(Map<String, Object> properties) Sets the property name - value pairs for this profile.void
setProperty
(String name, Object value) Sets the property identified by the specified name to the specified value.void
TODO: should be removed from the APIvoid
setSegments
(Set<String> segments) Sets the identifiers of the segments this profile is a member of.void
setSystemProperties
(Map<String, Object> systemProperties) Specifies the system property name - value pairs for this profile.setSystemProperty
(String key, Object value) Sets a system property, overwriting an existing one if it existed.toString()
Methods inherited from class org.apache.unomi.api.Item
equals, getItemId, getItemType, getItemType, getSystemMetadata, getVersion, hashCode, setItemId, setItemType, setScope, setSystemMetadata, setVersion
-
Field Details
-
ITEM_TYPE
The Profile ITEM_TYPE
-
-
Constructor Details
-
Profile
public Profile()Instantiates a new Profile. -
Profile
Instantiates a new Profile with the specified identifier.- Parameters:
profileId
- the profile identifier
-
-
Method Details
-
setProperty
Sets the property identified by the specified name to the specified value. If a property with that name already exists, replaces its value, otherwise adds the new property with the specified name and value.- Parameters:
name
- the name of the property to setvalue
- the value of the property
-
getProperty
Retrieves the property identified by the specified name.- Parameters:
name
- the name of the property to retrieve- Returns:
- the value of the specified property or
null
if no such property exists
-
getNestedProperty
Retrieves the value of the nested property identified by the specified name.- Parameters:
name
- the name of the property to be retrieved, splited in the nested properties with "."- Returns:
- the value of the property identified by the specified name
-
getProperties
Retrieves a Map of all property name - value pairs for this profile.- Returns:
- a Map of all property name - value pairs for this profile
-
setProperties
Sets the property name - value pairs for this profile.- Parameters:
properties
- a Map containing the property name - value pairs for this profile
-
getSystemProperties
Retrieves a Map of system property name - value pairs for this profile. System properties can be used by implementations to store non-user visible properties needed for internal purposes.- Specified by:
getSystemProperties
in interfaceSystemPropertiesItem
- Returns:
- a Map of system property name - value pairs for this profile
-
setSystemProperties
Specifies the system property name - value pairs for this profile.- Parameters:
systemProperties
- a Map of system property name - value pairs for this profile
-
setSystemProperty
Sets a system property, overwriting an existing one if it existed. This call will also created the system properties hash map if it didn't exist.- Parameters:
key
- the key for the system property hash mapvalue
- the value for the system property hash map- Returns:
- the previous value object if it existing.
-
getScope
Retrieves the Item's scope. Note that Profiles are always in the shared system scope (Metadata.SYSTEM_SCOPE
). -
getSegments
Retrieves the identifiers of the segments this profile is a member of.- Returns:
- the identifiers of the segments this profile is a member of
-
setSegments
Sets the identifiers of the segments this profile is a member of. TODO: should be removed from the API- Parameters:
segments
- the segments
-
getMergedWith
Deprecated.since 2.0.0 merge mechanism is now based on profile aliases, and this property is not used anymore -
setMergedWith
Deprecated.since 2.0.0 merge mechanism is now based on profile aliases, and this property is not used anymore -
getScores
Retrieves the scores associated to this profile.- Returns:
- the scores associated to this profile as a Map of
Scoring
identifier - score pairs
-
setScores
TODO: should be removed from the API- Parameters:
scores
- new value for scores
-
getConsents
Returns all the consents, including the revokes ones.- Returns:
- a map that contains as a key the scope + "/" + consent type ID (or just the consent type ID if no scope was set on the consent), and the consent itself as a value
-
isAnonymousProfile
public boolean isAnonymousProfile()Returns true if this profile is an anonymous profile.- Returns:
- true of the profile has been marked as an anonymous profile, false otherwise.
-
setConsent
Set a consent into the profile.- Parameters:
consent
- if the consent is REVOKED, it will try to remove a consent with the same type id if it exists for the profile.- Returns:
- true if the operation was successful (inserted exception in the case of a revoked consent, in which case it is successful if there was a consent to revoke).
-
toString
-