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
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 Summary
FieldsFields inherited from class org.apache.unomi.api.Item
itemId, itemType, systemMetadata, version
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Retrieves the duration.Retrieves the last event date.Get the events ids which causes the session creationGet the events types which causes the session creationRetrieves the associated Profile.Retrieves the identifier of the associated Profile.Retrieves a Map of all property name - value pairs.getProperty
(String name) Retrieves the property identified by the specified name.getScope()
Retrieves the Item's scope.int
getSize()
Retrieves the size.Retrieves a Map of system property name - value pairs.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
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 Details
-
ITEM_TYPE
The Session ITEM_TYPE.
-
-
Constructor Details
-
Session
public Session()Instantiates a new Session. -
Session
Instantiates a new Session.- Parameters:
itemId
- the identifier for this Sessionprofile
- the associatedProfile
timeStamp
- the time stampscope
- the scope
-
-
Method Details
-
getProfileId
Retrieves the identifier of the associated Profile.- Returns:
- the identifier of the associated Profile
-
getProfile
Retrieves the associated Profile.- Returns:
- the associated profile
-
setProfile
Sets the associated Profile.- Parameters:
profile
- the associated Profile
-
setProperty
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
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
Retrieves a Map of all property name - value pairs.- Returns:
- a Map of all property name - value pairs
-
setProperties
Sets the property name - value pairs.- Parameters:
properties
- a Map containing the property name - value pairs
-
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
Specifies the system property name - value pairs.- Parameters:
systemProperties
- a Map of system property name - value pairs
-
getTimeStamp
Retrieves the session creation timestamp.- Specified by:
getTimeStamp
in interfaceTimestampedItem
- Returns:
- the session creation timestamp
-
getLastEventDate
Retrieves the last event date.- Returns:
- the last event date
-
setLastEventDate
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
Description copied from class:Item
Retrieves the Item's scope. -
setScope
-
getOriginEventTypes
Get the events types which causes the session creation- Returns:
- List of event types
-
setOriginEventTypes
Set the events types which causes the session creation- Parameters:
originEventTypes
- List of event types
-
getOriginEventIds
Get the events ids which causes the session creation- Returns:
- event ids
-
setOriginEventIds
Set the events ids which causes the session creation- Parameters:
originEventIds
- List of event ids
-