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 int
getDuration()
Retrieves the duration.Date
getLastEventDate()
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 creationProfile
getProfile()
Retrieves the associated Profile.String
getProfileId()
Retrieves the identifier of the associated Profile.Map<String,Object>
getProperties()
Retrieves a Map of all property name - value pairs.Object
getProperty(String name)
Retrieves the property identified by the specified name.String
getScope()
Retrieves the Item's scope.int
getSize()
Retrieves the size.Map<String,Object>
getSystemProperties()
Retrieves a Map of system property name - value pairs.Date
getTimeStamp()
Retrieves the session creation timestamp.void
setLastEventDate(Date lastEventDate)
Sets the last event date.void
setOriginEventIds(List<String> originEventIds)
Set the events ids which causes the session creationvoid
setOriginEventTypes(List<String> originEventTypes)
Set the events types which causes the session creationvoid
setProfile(Profile profile)
Sets the associated Profile.void
setProperties(Map<String,Object> properties)
Sets the property name - value pairs.void
setProperty(String name, Object value)
Sets the property identified by the specified name to the specified value.void
setScope(String scope)
void
setSize(int size)
Sets the size.void
setSystemProperties(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
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 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:
getTimeStamp
in 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
-
-