public class ProfileServiceImpl extends Object implements ProfileService, org.osgi.framework.SynchronousBundleListener
PERSONAL_IDENTIFIER_TAG_NAME
Constructor and Description |
---|
ProfileServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addAliasToProfile(String profileID,
String alias,
String clientID) |
void |
batchProfilesUpdate(BatchUpdate update)
Update all profiles in batch according to the specified
BatchUpdate |
void |
bundleChanged(org.osgi.framework.BundleEvent event) |
Persona |
createPersona(String personaId)
Creates a persona with the specified identifier and automatically creates an associated session with it.
|
void |
delete(String profileId,
boolean persona)
Removes the profile (or persona if the
persona parameter is set to true ) identified by the specified identifier. |
boolean |
deletePropertyType(String propertyId)
Deletes the property type identified by the specified identifier.
|
String |
exportProfilesPropertiesToCsv(Query query)
Creates a String containing comma-separated values (CSV) formatted version of profiles matching the specified query.
|
PartialList<Profile> |
findProfilesByPropertyValue(String propertyName,
String propertyValue,
int offset,
int size,
String sortBy)
Find profiles which have the specified property with the specified value, ordered according to the specified
sortBy String and paged: only
size of them are retrieved, starting with the offset -th one. |
PartialList<Session> |
findProfileSessions(String profileId)
Retrieves sessions associated with the profile identified by the specified identifier.
|
long |
getAllProfilesCount()
Retrieves the number of unique profiles.
|
Set<PropertyType> |
getExistingProperties(String tag,
String itemType)
Retrieves the existing property types for the specified type as defined by the Item subclass public field
ITEM_TYPE and with the specified tag. |
Set<PropertyType> |
getExistingProperties(String tag,
String itemType,
boolean systemTag)
Retrieves the existing property types for the specified type as defined by the Item subclass public
field
ITEM_TYPE and with the specified tag (system or regular)
TODO: move to a different class |
PartialList<Session> |
getPersonaSessions(String personaId,
int offset,
int size,
String sortBy)
Retrieves the sessions associated with the persona identified by the specified identifier, ordered according to the specified
sortBy String and and paged: only
size of them are retrieved, starting with the offset -th one. |
PartialList<Session> |
getProfileSessions(String profileId,
String query,
int offset,
int size,
String sortBy)
Retrieves the sessions associated with the profile identified by the specified identifier that match the specified query (if specified), ordered according to the specified
sortBy String and and paged: only size of them are retrieved, starting with the offset -th one. |
PropertyType |
getPropertyType(String id)
Retrieves the property type identified by the specified identifier.
|
Collection<PropertyType> |
getPropertyTypeByMapping(String propertyName)
TODO
|
Set<PropertyType> |
getPropertyTypeBySystemTag(String tag)
Retrieves all property types with the specified system tag
TODO: move to a different class
|
Set<PropertyType> |
getPropertyTypeByTag(String tag)
Retrieves all property types with the specified tag
TODO: move to a different class
|
String |
getPropertyTypeMapping(String fromPropertyTypeId)
TODO
|
Map<String,Collection<PropertyType>> |
getTargetPropertyTypes()
Retrieves all known property types.
|
Collection<PropertyType> |
getTargetPropertyTypes(String target)
Retrieves all the property types associated with the specified target.
|
Profile |
load(String profileId)
Retrieves the profile identified by the specified identifier.
|
Persona |
loadPersona(String personaId)
Retrieves the persona identified by the specified identifier.
|
PersonaWithSessions |
loadPersonaWithSessions(String personaId)
Retrieves the persona identified by the specified identifier and all its associated sessions
|
Session |
loadSession(String sessionId,
Date dateHint)
Retrieves the session identified by the specified identifier.
|
boolean |
matchCondition(Condition condition,
Profile profile,
Session session)
Checks whether the specified profile and/or session satisfy the specified condition.
|
Profile |
mergeProfiles(Profile masterProfile,
List<Profile> profilesToMerge)
Merges the specified profiles into the provided so-called master profile, merging properties according to the
PropertyMergeStrategyType specified on their PropertyType . |
void |
postConstruct() |
void |
preDestroy() |
void |
refresh()
Forces a refresh of the profile service, to load data from persistence immediately instead of waiting for
scheduled tasks to execute.
|
void |
reloadPropertyTypes(boolean refresh) |
void |
removeProfileSessions(String profileId)
Removes all sessions of the specified profile
|
Profile |
save(Profile profile)
Saves the specified profile in the context server.
|
Profile |
saveOrMerge(Profile profile)
Merge the specified profile properties in an existing profile,or save new profile if it does not exist yet
|
Persona |
savePersona(Persona profile)
Persists the specified
Persona in the context server. |
PersonaWithSessions |
savePersonaWithSessions(PersonaWithSessions personaToSave)
Save a persona with its sessions.
|
Session |
saveSession(Session session)
Saves the specified session.
|
<T extends Profile> |
search(Query query,
Class<T> clazz)
Retrieves profiles or personas matching the specified query.
|
PartialList<Session> |
searchSessions(Query query)
Retrieves sessions matching the specified query.
|
void |
setBundleContext(org.osgi.framework.BundleContext bundleContext) |
void |
setDefinitionsService(DefinitionsService definitionsService) |
void |
setForceRefreshOnSave(boolean forceRefreshOnSave) |
void |
setPersistenceService(PersistenceService persistenceService) |
void |
setPropertiesRefreshInterval(long propertiesRefreshInterval) |
boolean |
setPropertyType(PropertyType property)
Persists the specified property type in the context server.
|
void |
setPropertyTypeTarget(URL predefinedPropertyTypeURL,
PropertyType propertyType)
This function will try to set the target on the property type if not set already, based on the file URL
|
void |
setPurgeProfileExistTime(Integer purgeProfileExistTime) |
void |
setPurgeProfileInactiveTime(Integer purgeProfileInactiveTime) |
void |
setPurgeProfileInterval(Integer purgeProfileInterval) |
void |
setPurgeSessionsAndEventsTime(Integer purgeSessionsAndEventsTime) |
void |
setSchedulerService(SchedulerService schedulerService) |
void |
setSegmentService(SegmentService segmentService) |
public void setBundleContext(org.osgi.framework.BundleContext bundleContext)
public void setPersistenceService(PersistenceService persistenceService)
public void setDefinitionsService(DefinitionsService definitionsService)
public void setSchedulerService(SchedulerService schedulerService)
public void setSegmentService(SegmentService segmentService)
public void setForceRefreshOnSave(boolean forceRefreshOnSave)
public void setPropertiesRefreshInterval(long propertiesRefreshInterval)
public void postConstruct()
public void preDestroy()
public void setPurgeProfileExistTime(Integer purgeProfileExistTime)
public void setPurgeProfileInactiveTime(Integer purgeProfileInactiveTime)
public void setPurgeSessionsAndEventsTime(Integer purgeSessionsAndEventsTime)
public void setPurgeProfileInterval(Integer purgeProfileInterval)
public void reloadPropertyTypes(boolean refresh)
public long getAllProfilesCount()
ProfileService
getAllProfilesCount
in interface ProfileService
public <T extends Profile> PartialList<T> search(Query query, Class<T> clazz)
ProfileService
search
in interface ProfileService
T
- the specific sub-type of Profile
to retrievequery
- a Query
specifying which elements to retrieveclazz
- the class of elements to retrievePartialList
of T
instances matching the specified querypublic PartialList<Session> searchSessions(Query query)
ProfileService
searchSessions
in interface ProfileService
query
- a Query
specifying which elements to retrievePartialList
of sessions matching the specified querypublic boolean setPropertyType(PropertyType property)
ProfileService
setPropertyType
in interface ProfileService
property
- the property type to persisttrue
if the property type was properly created, false
otherwise (for example, if the property type already existedpublic boolean deletePropertyType(String propertyId)
ProfileService
deletePropertyType
in interface ProfileService
propertyId
- the identifier of the property type to deletetrue
if the property type was properly deleted, false
otherwisepublic Set<PropertyType> getExistingProperties(String tag, String itemType)
ProfileService
ITEM_TYPE
and with the specified tag.
TODO: move to a different classgetExistingProperties
in interface ProfileService
tag
- the tag we're interested initemType
- the String representation of the item type we want to retrieve the count of, as defined by its class' ITEM_TYPE
fieldpublic Set<PropertyType> getExistingProperties(String tag, String itemType, boolean systemTag)
ProfileService
ITEM_TYPE
and with the specified tag (system or regular)
TODO: move to a different classgetExistingProperties
in interface ProfileService
tag
- the tag we're interested initemType
- the String representation of the item type we want to retrieve the count of, as defined by its class' ITEM_TYPE
fieldsystemTag
- whether the specified is a system tag or a regular onepublic String exportProfilesPropertiesToCsv(Query query)
ProfileService
exportProfilesPropertiesToCsv
in interface ProfileService
query
- the query specifying which profiles to exportpublic PartialList<Profile> findProfilesByPropertyValue(String propertyName, String propertyValue, int offset, int size, String sortBy)
ProfileService
sortBy
String and paged: only
size
of them are retrieved, starting with the offset
-th one.
TODO: replace with version using a query instead of separate parameters
TODO: remove as it's unused?findProfilesByPropertyValue
in interface ProfileService
propertyName
- the name of the property we're interested inpropertyValue
- the value of the property we want profiles to haveoffset
- zero or a positive integer specifying the position of the first profile in the total ordered collection of matching profilessize
- a positive integer specifying how many matching profiles should be retrieved or -1
if all of them should be retrievedsortBy
- an optional (null
if no sorting is required) String of comma (,
) separated property names on which ordering should be performed, ordering elements according to the property order in
the String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally
followed by a column (:
) and an order specifier: asc
or desc
.PartialList
of matching profilespublic Profile load(String profileId)
ProfileService
load
in interface ProfileService
profileId
- the identifier of the profile to retrievenull
if no such profile existspublic Profile save(Profile profile)
ProfileService
save
in interface ProfileService
profile
- the profile to be savedpublic void addAliasToProfile(String profileID, String alias, String clientID)
addAliasToProfile
in interface ProfileService
public Profile saveOrMerge(Profile profile)
ProfileService
saveOrMerge
in interface ProfileService
profile
- the profile to be savedpublic Persona savePersona(Persona profile)
ProfileService
Persona
in the context server.savePersona
in interface ProfileService
profile
- the persona to persistpublic void delete(String profileId, boolean persona)
ProfileService
persona
parameter is set to true
) identified by the specified identifier.delete
in interface ProfileService
profileId
- the identifier of the profile or persona to deletepersona
- true
if the specified identifier is supposed to refer to a persona, false
if it is supposed to refer to a profilepublic Profile mergeProfiles(Profile masterProfile, List<Profile> profilesToMerge)
ProfileService
PropertyMergeStrategyType
specified on their PropertyType
.mergeProfiles
in interface ProfileService
masterProfile
- the profile into which the specified profiles will be mergedprofilesToMerge
- the list of profiles to merge into the specified master profilepublic PartialList<Session> getProfileSessions(String profileId, String query, int offset, int size, String sortBy)
ProfileService
sortBy
String and and paged: only size
of them are retrieved, starting with the offset
-th one.
TODO: use a Query object instead of distinct parametergetProfileSessions
in interface ProfileService
profileId
- the identifier of the profile we want to retrieve sessions fromquery
- a String of text used for fulltext filtering which sessions we are interested in or null
(or an empty String) if we want to retrieve all sessionsoffset
- zero or a positive integer specifying the position of the first session in the total ordered collection of matching sessionssize
- a positive integer specifying how many matching sessions should be retrieved or -1
if all of them should be retrievedsortBy
- an optional (null
if no sorting is required) String of comma (,
) separated property names on which ordering should be performed, ordering elements according to the property order in the
String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally followed by
a column (:
) and an order specifier: asc
or desc
.PartialList
of matching sessionspublic String getPropertyTypeMapping(String fromPropertyTypeId)
ProfileService
getPropertyTypeMapping
in interface ProfileService
fromPropertyTypeId
- fromPropertyTypeIdpublic Session loadSession(String sessionId, Date dateHint)
ProfileService
loadSession
in interface ProfileService
sessionId
- the identifier of the session to be retrieveddateHint
- a Date helping in identifying where the item is locatedpublic Session saveSession(Session session)
ProfileService
saveSession
in interface ProfileService
session
- the session to be savedpublic PartialList<Session> findProfileSessions(String profileId)
ProfileService
findProfileSessions
in interface ProfileService
profileId
- the profile id for which we want to retrieve the sessionsPartialList
of the profile's sessionspublic void removeProfileSessions(String profileId)
ProfileService
removeProfileSessions
in interface ProfileService
profileId
- identifier of the profile that we want to remove it's sessionspublic boolean matchCondition(Condition condition, Profile profile, Session session)
ProfileService
matchCondition
in interface ProfileService
condition
- the condition we're testing against which might or might not have profile- or session-specific sub-conditionsprofile
- the profile we're testingsession
- the session we're testingtrue
if the profile and/or sessions match the specified condition, false
otherwisepublic void batchProfilesUpdate(BatchUpdate update)
ProfileService
BatchUpdate
batchProfilesUpdate
in interface ProfileService
update
- the batch update specificationpublic Persona loadPersona(String personaId)
ProfileService
loadPersona
in interface ProfileService
personaId
- the identifier of the persona to retrievenull
if no such persona exists.public PersonaWithSessions loadPersonaWithSessions(String personaId)
ProfileService
loadPersonaWithSessions
in interface ProfileService
personaId
- the identifier of the persona to retrievePersonaWithSessions
instance with the persona identified by the specified identifier and all its associated sessionspublic Persona createPersona(String personaId)
ProfileService
createPersona
in interface ProfileService
personaId
- the identifier to use for the new personapublic Collection<PropertyType> getTargetPropertyTypes(String target)
ProfileService
getTargetPropertyTypes
in interface ProfileService
target
- the target for which we want to retrieve the associated property typespublic Map<String,Collection<PropertyType>> getTargetPropertyTypes()
ProfileService
getTargetPropertyTypes
in interface ProfileService
PropertyType
spublic Set<PropertyType> getPropertyTypeByTag(String tag)
ProfileService
getPropertyTypeByTag
in interface ProfileService
tag
- the tag name marking property types we want to retrievepublic Set<PropertyType> getPropertyTypeBySystemTag(String tag)
ProfileService
getPropertyTypeBySystemTag
in interface ProfileService
tag
- the system tag name marking property types we want to retrievepublic Collection<PropertyType> getPropertyTypeByMapping(String propertyName)
ProfileService
getPropertyTypeByMapping
in interface ProfileService
propertyName
- the property namepublic PropertyType getPropertyType(String id)
ProfileService
getPropertyType
in interface ProfileService
id
- the identifier of the property type to retrievenull
if no such property type existspublic PartialList<Session> getPersonaSessions(String personaId, int offset, int size, String sortBy)
ProfileService
sortBy
String and and paged: only
size
of them are retrieved, starting with the offset
-th one.getPersonaSessions
in interface ProfileService
personaId
- the persona idoffset
- zero or a positive integer specifying the position of the first session in the total ordered collection of matching sessionssize
- a positive integer specifying how many matching sessions should be retrieved or -1
if all of them should be retrievedsortBy
- an optional (null
if no sorting is required) String of comma (,
) separated property names on which ordering should be performed, ordering elements according to the property order in the
String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally followed by
a column (:
) and an order specifier: asc
or desc
.PartialList
of sessions for the persona identified by the specified identifierpublic PersonaWithSessions savePersonaWithSessions(PersonaWithSessions personaToSave)
ProfileService
savePersonaWithSessions
in interface ProfileService
personaToSave
- the persona object containing all the persona information and sessionspublic void setPropertyTypeTarget(URL predefinedPropertyTypeURL, PropertyType propertyType)
ProfileService
setPropertyTypeTarget
in interface ProfileService
predefinedPropertyTypeURL
- the URL to extract the target from if the target is not yet. By default it will
use the 5's part after a "/" characterpropertyType
- the property type to registerpublic void bundleChanged(org.osgi.framework.BundleEvent event)
bundleChanged
in interface org.osgi.framework.BundleListener
public void refresh()
ProfileService
refresh
in interface ProfileService
Copyright © 2014–2022 Apache Software Foundation. All rights reserved.