com.endeca.infront.navigation
Class UserState

java.lang.Object
  extended by com.endeca.infront.navigation.UserState

public class UserState
extends Object

An object that contains user segments and date state information. This state is used to control the experience that a particular user has when visiting a site.

Examples:


Constructor Summary
UserState()
           
 
Method Summary
 void addUserSegments(String userSegments)
          Convenience method to add a user segments to the currently active set of user segments.
 Date getDate()
           
 String getDateAsString()
           
 String getUserAgent()
           
 Set<String> getUserSegments()
           
 void setDate(Date date)
          Sets the date; this is useful for previewing what a site looks like on a particular date.
 void setDateAsString(String date)
          Convenience method to set the date from a String of the format "yyyy-MM-dd'T'HH:mm".
 void setUserAgent(String userAgent)
          Sets the user-agent; this is useful for previewing what a site looks like with a particular user-agent.
 void setUserSegments(Set<String> userSegments)
          Sets the set of user segments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserState

public UserState()
Method Detail

setUserSegments

public void setUserSegments(Set<String> userSegments)
Sets the set of user segments. May be null, in which case the current user segments are set to an empty Set.

Parameters:
userSegments - the new user segments
See Also:
addUserSegments(String)

getUserSegments

public Set<String> getUserSegments()
Returns:
the currently active set of user segments. Will not be null, but may be empty.

addUserSegments

public void addUserSegments(String userSegments)
Convenience method to add a user segments to the currently active set of user segments.

Parameters:
userSegments - the new user segment

setDate

public void setDate(Date date)
Sets the date; this is useful for previewing what a site looks like on a particular date. May be null, in which case the current date is used.

Parameters:
date - the new date
See Also:
setDateAsString(String)

setDateAsString

public void setDateAsString(String date)
                     throws ParseException
Convenience method to set the date from a String of the format "yyyy-MM-dd'T'HH:mm".

Parameters:
date - the new date
Throws:
ParseException - if an error occurs while parsing the input String

getDate

public Date getDate()
Returns:
the date. May be null to indicate the current date.

getDateAsString

public String getDateAsString()
Returns:
the date in the format "yyyy-MM-dd'T'HH:mm". May also return null to indicate the current date.

setUserAgent

public void setUserAgent(String userAgent)
Sets the user-agent; this is useful for previewing what a site looks like with a particular user-agent. May be null.

Parameters:
userAgent - the new user-agent

getUserAgent

public String getUserAgent()
Returns:
the user-agent. May be null to indicate that no user-agent was specified.


Copyright © 2012, Oracle and/or its affiliates. All rights reserved.