Package org.apache.unomi.api
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 associatedProfile) 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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDuration()Retrieves the duration.DategetLastEventDate()Retrieves the last event date.List<String>getOriginEventIds()Get the events ids which causes the session creationList<String>getOriginEventTypes()Get the events types which causes the session creationProfilegetProfile()Retrieves the associated Profile.StringgetProfileId()Retrieves the identifier of the associated Profile.Map<String,Object>getProperties()Retrieves a Map of all property name - value pairs.ObjectgetProperty(String name)Retrieves the property identified by the specified name.StringgetScope()Retrieves the Item's scope.intgetSize()Retrieves the size.Map<String,Object>getSystemProperties()Retrieves a Map of system property name - value pairs.DategetTimeStamp()Retrieves the session creation timestamp.voidsetLastEventDate(Date lastEventDate)Sets the last event date.voidsetOriginEventIds(List<String> originEventIds)Set the events ids which causes the session creationvoidsetOriginEventTypes(List<String> originEventTypes)Set the events types which causes the session creationvoidsetProfile(Profile profile)Sets the associated Profile.voidsetProperties(Map<String,Object> properties)Sets the property name - value pairs.voidsetProperty(String name, Object value)Sets the property identified by the specified name to the specified value.voidsetScope(String scope)voidsetSize(int size)Sets the size.voidsetSystemProperties(Map<String,Object> systemProperties)Specifies the system property name - value pairs.-
Methods inherited from class org.apache.unomi.api.Item
equals, getItemId, getItemType, getItemType, getSystemMetadata, getVersion, hashCode, setItemId, setItemType, setSystemMetadata, setVersion
-
-
-
-
Field Detail
-
ITEM_TYPE
public static final String ITEM_TYPE
The Session ITEM_TYPE.
-
-
Method Detail
-
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 setvalue- 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
nullif 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:
getSystemPropertiesin interfaceSystemPropertiesItem- 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:
getTimeStampin interfaceTimestampedItem- 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
-
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
-
-