Package org.apache.unomi.api
Class ContextResponse
java.lang.Object
org.apache.unomi.api.ContextResponse
- All Implemented Interfaces:
Serializable
A context server response resulting from the evaluation of a client's context request. Note that all returned values result of the evaluation of the data provided in the
associated ContextRequest and might therefore reflect results due to user impersonation via properties / segment overrides.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the map of consents for the current profile.Retrieves the results of the evaluation content filtering definitions and whether individual definitions match with the associated profile (potentially modified by overridden values).Get the result of the personalization resolutions done during the context request.Deprecated.personalizations results are more complex since 2.1.0 and they are now available under: getPersonalizationResults()int
Retrieves the profile identifier associated with the profile of the user on behalf of which the client performed the context request.Retrieves the profile properties that were requested by the client.Retrieve the current scores for the profile if they were requested in the request using the requireScores boolean.Retrieves the identifiers of the profile segments associated with the user if they were requested by the client.Retrieves the session identifier associated with the processed request.Retrieves the session properties that were requested by the client.Retrieves the tracked conditions, if any, associated with the source of the context request that resulted in this ContextResponse.boolean
Retrieves the current status of anonymous browsing, as set by the privacy servicevoid
setAnonymousBrowsing
(boolean anonymousBrowsing) Set the user anonymous browsing statusvoid
setConsents
(Map<String, Consent> consents) Sets the map of consents for the current profile.void
setFilteringResults
(Map<String, Boolean> filteringResults) Sets the filtering results.void
setPersonalizationResults
(Map<String, PersonalizationResult> personalizationResults) void
setPersonalizations
(Map<String, List<String>> personalizations) Deprecated.personalizations results are more complex since 2.1.0 and they are now available under: setPersonalizationResults()void
setProcessedEvents
(int processedEvents) void
setProfileId
(String profileId) Sets the profile id.void
setProfileProperties
(Map<String, Object> profileProperties) Sets the profile properties.void
setProfileScores
(Map<String, Integer> profileScores) Stores the scores for the current profile if requested using the requireScores boolean in the request.void
setProfileSegments
(Set<String> profileSegments) Sets the profile segments.void
setSessionId
(String sessionId) Sets the session id.void
setSessionProperties
(Map<String, Object> sessionProperties) Sets the session properties.void
setTrackedConditions
(Set<Condition> trackedConditions) Sets the tracked conditions.
-
Constructor Details
-
ContextResponse
public ContextResponse()
-
-
Method Details
-
getProfileId
Retrieves the profile identifier associated with the profile of the user on behalf of which the client performed the context request.- Returns:
- the profile identifier associated with the profile of the active user
-
setProfileId
Sets the profile id.- Parameters:
profileId
- the profile id
-
getSessionId
Retrieves the session identifier associated with the processed request.- Returns:
- the session identifier associated with the processed request
- See Also:
-
setSessionId
Sets the session id.- Parameters:
sessionId
- the session id
-
getProfileProperties
Retrieves the profile properties that were requested by the client.- Returns:
- the profile properties that were requested by the client
- See Also:
-
setProfileProperties
Sets the profile properties.- Parameters:
profileProperties
- the profile properties
-
getSessionProperties
Retrieves the session properties that were requested by the client.- Returns:
- the session properties that were requested by the client
- See Also:
-
setSessionProperties
Sets the session properties.- Parameters:
sessionProperties
- the session properties
-
getProfileSegments
Retrieves the identifiers of the profile segments associated with the user if they were requested by the client. Note that these segments are evaluated taking potential overrides as requested by the client or as a result of evaluating overridden properties.- Returns:
- the profile segments associated with the user accounting for potential overrides
-
setProfileSegments
Sets the profile segments.- Parameters:
profileSegments
- the profile segments
-
getProfileScores
Retrieve the current scores for the profile if they were requested in the request using the requireScores boolean.- Returns:
- a map that contains the score identifier as the key and the score value as the value
-
setProfileScores
Stores the scores for the current profile if requested using the requireScores boolean in the request.- Parameters:
profileScores
- a map that contains the score identifier as the key and the score value as the value
-
getFilteringResults
Retrieves the results of the evaluation content filtering definitions and whether individual definitions match with the associated profile (potentially modified by overridden values).- Returns:
- a Map associating the filter identifier as key to its evaluation result by the context server
-
setFilteringResults
Sets the filtering results.- Parameters:
filteringResults
- the filtering results
-
getProcessedEvents
public int getProcessedEvents() -
setProcessedEvents
public void setProcessedEvents(int processedEvents) -
getPersonalizations
Deprecated.personalizations results are more complex since 2.1.0 and they are now available under: getPersonalizationResults() -
setPersonalizations
Deprecated.personalizations results are more complex since 2.1.0 and they are now available under: setPersonalizationResults() -
getPersonalizationResults
Get the result of the personalization resolutions done during the context request.- Returns:
- a Map key/value pair (key:personalization id, value:the result that contains the matching content ids and additional information)
-
setPersonalizationResults
-
getTrackedConditions
Retrieves the tracked conditions, if any, associated with the source of the context request that resulted in this ContextResponse. Upon evaluating the incoming request, the context server will determine if there are any rules marked with the "trackedCondition" tag and which source condition matches the source of the incoming request and return these tracked conditions to the client that can use them to know that the context server can react to events matching the tracked condition and coming from that source. This is, in particular, used to implement form mapping (a solution that allows clients to update user profiles based on values provided when a form is submitted). TODO: trackedCondition should be a constant, possibly on the Tag class?- Returns:
- the tracked conditions
- See Also:
-
setTrackedConditions
Sets the tracked conditions.- Parameters:
trackedConditions
- the tracked conditions
-
isAnonymousBrowsing
public boolean isAnonymousBrowsing()Retrieves the current status of anonymous browsing, as set by the privacy service- Returns:
- anonymous browsing status
-
setAnonymousBrowsing
public void setAnonymousBrowsing(boolean anonymousBrowsing) Set the user anonymous browsing status- Parameters:
anonymousBrowsing
- new value for anonymousBrowsing
-
getConsents
Retrieves the map of consents for the current profile.- Returns:
- a Map where the key is the name of the consent identifier, and the value is a consent object that contains all the consent data such as whether the consent was granted or deny, the date of granting/denying the date at which the consent will be revoked automatically.
-
setConsents
Sets the map of consents for the current profile.- Parameters:
consents
- a Map where the key is the name of the consent identifier, and the value is a consent object that contains all the consent data such as whether the consent was granted or deny, the date of granting/denying the date at which the consent will be revoked automatically.
-