Class Session

java.lang.Object
org.apache.unomi.api.Item
org.apache.unomi.api.Session
All Implemented Interfaces:
Serializable, SystemPropertiesItem, TimestampedItem
Direct Known Subclasses:
PersonaSession

public class Session extends Item implements TimestampedItem, SystemPropertiesItem
A time-bounded interaction between a user (via their associated Profile) and a unomi-enabled application. A session represents a sequence of operations the user performed during its duration. In the context of web applications, sessions are usually linked to HTTP sessions.
See Also:
  • Field Details

  • Constructor Details

    • Session

      public Session()
      Instantiates a new Session.
    • Session

      public Session(String itemId, Profile profile, Date timeStamp, String scope)
      Instantiates a new Session.
      Parameters:
      itemId - the identifier for this Session
      profile - the associated Profile
      timeStamp - the time stamp
      scope - the scope
  • Method Details

    • getProfileId

      public String getProfileId()
      Retrieves the identifier of the associated Profile.
      Returns:
      the identifier of the associated Profile
    • getProfile

      public Profile getProfile()
      Retrieves the associated Profile.
      Returns:
      the associated profile
    • setProfile

      public void setProfile(Profile profile)
      Sets the associated Profile.
      Parameters:
      profile - the associated Profile
    • setProperty

      public void setProperty(String name, Object value)
      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 set
      value - the value of the property
    • getProperty

      public Object getProperty(String name)
      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
    • getProperties

      public Map<String,Object> getProperties()
      Retrieves a Map of all property name - value pairs.
      Returns:
      a Map of all property name - value pairs
    • setProperties

      public void setProperties(Map<String,Object> properties)
      Sets the property name - value pairs.
      Parameters:
      properties - a Map containing the property name - value pairs
    • getSystemProperties

      public Map<String,Object> getSystemProperties()
      Retrieves a Map of system property name - value pairs. System properties can be used by implementations to store non-user visible properties needed for internal purposes.
      Specified by:
      getSystemProperties in interface SystemPropertiesItem
      Returns:
      a Map of system property name - value pairs
    • setSystemProperties

      public void setSystemProperties(Map<String,Object> systemProperties)
      Specifies the system property name - value pairs.
      Parameters:
      systemProperties - a Map of system property name - value pairs
    • getTimeStamp

      public Date getTimeStamp()
      Retrieves the session creation timestamp.
      Specified by:
      getTimeStamp in interface TimestampedItem
      Returns:
      the session creation timestamp
    • getLastEventDate

      public Date getLastEventDate()
      Retrieves the last event date.
      Returns:
      the last event date
    • setLastEventDate

      public void setLastEventDate(Date lastEventDate)
      Sets the last event date.
      Parameters:
      lastEventDate - the last event date
    • getDuration

      public int getDuration()
      Retrieves the duration.
      Returns:
      the duration
    • getSize

      public int getSize()
      Retrieves the size.
      Returns:
      the size
    • setSize

      public void setSize(int size)
      Sets the size.
      Parameters:
      size - the size
    • getScope

      public String getScope()
      Description copied from class: Item
      Retrieves the Item's scope.
      Overrides:
      getScope in class Item
      Returns:
      the Item's scope name
    • setScope

      public void setScope(String scope)
      Overrides:
      setScope in class Item
    • getOriginEventTypes

      public List<String> getOriginEventTypes()
      Get the events types which causes the session creation
      Returns:
      List of event types
    • setOriginEventTypes

      public void setOriginEventTypes(List<String> originEventTypes)
      Set the events types which causes the session creation
      Parameters:
      originEventTypes - List of event types
    • getOriginEventIds

      public List<String> getOriginEventIds()
      Get the events ids which causes the session creation
      Returns:
      event ids
    • setOriginEventIds

      public void setOriginEventIds(List<String> originEventIds)
      Set the events ids which causes the session creation
      Parameters:
      originEventIds - List of event ids