Class ContextResponse

  • All Implemented Interfaces:
    Serializable

    public class ContextResponse
    extends Object
    implements 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:
    ContextRequest, Serialized Form
    • Constructor Detail

      • ContextResponse

        public ContextResponse()
    • Method Detail

      • getProfileId

        public String 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

        public void setProfileId​(String profileId)
        Sets the profile id.
        Parameters:
        profileId - the profile id
      • getSessionId

        public String getSessionId()
        Retrieves the session identifier associated with the processed request.
        Returns:
        the session identifier associated with the processed request
        See Also:
        Session
      • setSessionId

        public void setSessionId​(String sessionId)
        Sets the session id.
        Parameters:
        sessionId - the session id
      • setProfileProperties

        public void setProfileProperties​(Map<String,​Object> profileProperties)
        Sets the profile properties.
        Parameters:
        profileProperties - the profile properties
      • setSessionProperties

        public void setSessionProperties​(Map<String,​Object> sessionProperties)
        Sets the session properties.
        Parameters:
        sessionProperties - the session properties
      • getProfileSegments

        public Set<String> 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

        public void setProfileSegments​(Set<String> profileSegments)
        Sets the profile segments.
        Parameters:
        profileSegments - the profile segments
      • getProfileScores

        public Map<String,​Integer> 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

        public void setProfileScores​(Map<String,​Integer> profileScores)
        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

        public Map<String,​Boolean> 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

        public void setFilteringResults​(Map<String,​Boolean> filteringResults)
        Sets the filtering results.
        Parameters:
        filteringResults - the filtering results
      • getProcessedEvents

        public int getProcessedEvents()
      • setProcessedEvents

        public void setProcessedEvents​(int processedEvents)
      • getPersonalizations

        @Deprecated
        public Map<String,​List<String>> getPersonalizations()
        Deprecated.
        personalizations results are more complex since 2.1.0 and they are now available under: getPersonalizationResults()
      • setPersonalizations

        @Deprecated
        public void setPersonalizations​(Map<String,​List<String>> personalizations)
        Deprecated.
        personalizations results are more complex since 2.1.0 and they are now available under: setPersonalizationResults()
      • getPersonalizationResults

        public Map<String,​PersonalizationResult> 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)
      • getTrackedConditions

        public Set<Condition> 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:
        ContextRequest.getSource(), RulesService.getTrackedConditions(Item)
      • setTrackedConditions

        public void setTrackedConditions​(Set<Condition> trackedConditions)
        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

        public Map<String,​Consent> 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

        public void setConsents​(Map<String,​Consent> consents)
        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.