@Produces(value="application/json") @Consumes(value="application/json") @Path(value="/profiles") public class ProfileServiceEndPoint extends Object
Constructor and Description |
---|
ProfileServiceEndPoint() |
Modifier and Type | Method and Description |
---|---|
void |
addAliasToProfile(String profileId,
String aliasId,
String headerClientID) |
void |
batchProfilesUpdate(BatchUpdate update)
Update all profiles in batch according to the specified
BatchUpdate |
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 query parameter is set to true ) identified by the specified identifier. |
void |
deletePersona(String personaId,
boolean persona)
Removes the persona identified by the specified identifier.
|
boolean |
deleteProperty(String propertyId)
Deletes the property type identified by the specified identifier.
|
javax.ws.rs.core.Response |
exportProfiles(Query query)
Retrieves an export of profiles matching the specified query as a downloadable file using the comma-separated values (CSV) format.
|
PartialList<Session> |
findProfileSessions(String profileId) |
javax.ws.rs.core.Response |
formExportProfiles(String query)
A version of
getExportProfiles(String) suitable to be called from an HTML form. |
long |
getAllProfilesCount()
Retrieves the number of unique profiles.
|
Collection<PropertyType> |
getExistingProperties(String tag,
boolean isSystemTag,
String itemType,
String language,
javax.servlet.http.HttpServletResponse response)
Retrieves the existing property types for the specified type as defined by the Item subclass public field
ITEM_TYPE and with the specified tag or system tag. |
javax.ws.rs.core.Response |
getExportProfiles(String query)
Retrieves an export of profiles matching the specified query as a downloadable file using the comma-separated values (CSV) format.
|
PartialList<Persona> |
getPersonas(Query query)
Retrieves
Persona matching the specified query. |
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<Profile> |
getProfiles(Query query)
Retrieves profiles matching the specified query.
|
List<Metadata> |
getProfileSegments(String profileId)
Retrieves the list of segment metadata for the segments the specified profile is a member of.
|
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 propertyId,
String language)
Retrieves the property type associated with the specified property ID.
|
Collection<PropertyType> |
getPropertyTypeBySystemTag(String tags,
String language)
Retrieves all property types with the specified tags.
|
Collection<PropertyType> |
getPropertyTypeByTag(String tags,
String language)
Retrieves all property types with the specified tags.
|
String |
getPropertyTypeMapping(String fromPropertyTypeId)
TODO
|
Map<String,Collection<PropertyType>> |
getPropertyTypes(String language)
Retrieves all known property types.
|
Collection<PropertyType> |
getPropertyTypesByTarget(String target,
String language)
Retrieves all the property types associated with the specified target.
|
PartialList<Event> |
getSessionEvents(String sessionId,
String[] eventTypes,
String query,
int offset,
int size,
String sortBy)
|
PartialList<ProfileAlias> |
listAliasesByProfileId(String profileId,
int offset,
int size,
String sortBy) |
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)
Retrieves the session identified by the specified identifier.
|
boolean |
matchCondition(Condition condition,
Profile profile,
Session session) |
void |
removeAliasFromProfile(String profileId,
String aliasId,
String headerClientID) |
Profile |
save(Profile profile)
Saves the specified profile in the context server, sending a
profileUpdated event. |
Persona |
savePersona(Persona persona)
Persists the specified
Persona in the context server. |
PersonaWithSessions |
savePersonaWithSessions(PersonaWithSessions personaWithSessions)
Save the posted persona with its sessions
|
Session |
saveSession(Session session)
Saves the specified session.
|
PartialList<Session> |
searchSession(Query query)
Retrieves sessions matching the specified query.
|
void |
setEventService(EventService eventService) |
void |
setLocalizationHelper(LocalizationHelper localizationHelper) |
void |
setProfileService(ProfileService profileService) |
boolean |
setPropertyType(PropertyType property)
Persists the specified property type in the context server.
|
boolean |
setPropertyTypes(List<PropertyType> properties)
Persists the specified properties type in the context server.
|
void |
setSegmentService(SegmentService segmentService) |
public void setProfileService(ProfileService profileService)
public void setEventService(EventService eventService)
public void setSegmentService(SegmentService segmentService)
public void setLocalizationHelper(LocalizationHelper localizationHelper)
@GET @Path(value="/count") public long getAllProfilesCount()
@POST @Path(value="/search") public PartialList<Profile> getProfiles(Query query)
query
- a Query
specifying which elements to retrievePartialList
of profiles instances matching the specified query@GET @Path(value="/export") @Produces(value="text/csv") public javax.ws.rs.core.Response getExportProfiles(@QueryParam(value="query") String query)
query
- a String JSON representation of the query the profiles to export should match@GET @Path(value="/export") @Produces(value="text/csv") @Consumes(value="application/x-www-form-urlencoded") public javax.ws.rs.core.Response formExportProfiles(@FormParam(value="query") String query)
getExportProfiles(String)
suitable to be called from an HTML form.query
- a form-encoded representation of the query the profiles to export should match@POST @Path(value="/export") @Produces(value="text/csv") public javax.ws.rs.core.Response exportProfiles(Query query)
query
- a String JSON representation of the query the profiles to export should match@POST @Path(value="/batchProfilesUpdate") public void batchProfilesUpdate(BatchUpdate update)
BatchUpdate
update
- the batch update specification@GET @Path(value="/{profileId}") public Profile load(@PathParam(value="profileId") String profileId)
profileId
- the identifier of the profile to retrievenull
if no such profile exists@POST @Path(value="/") public Profile save(Profile profile)
profileUpdated
event.profile
- the profile to be saved@DELETE @Path(value="/{profileId}") public void delete(@PathParam(value="profileId") String profileId, @QueryParam(value="persona") @DefaultValue(value="false") boolean persona)
persona
query parameter is set to true
) identified by the specified identifier.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 profile@GET @Path(value="/{profileId}/sessions") public PartialList<Session> getProfileSessions(@PathParam(value="profileId") String profileId, @QueryParam(value="q") String query, @QueryParam(value="offset") @DefaultValue(value="0") int offset, @QueryParam(value="size") @DefaultValue(value="50") int size, @QueryParam(value="sort") String sortBy)
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 parameter?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 sessions@GET @Path(value="/{profileId}/segments") public List<Metadata> getProfileSegments(@PathParam(value="profileId") String profileId)
profileId
- the identifier of the profile for which we want to retrieve the segment metadata@GET @Path(value="/properties/mappings/{fromPropertyTypeId}") public String getPropertyTypeMapping(@PathParam(value="fromPropertyTypeId") String fromPropertyTypeId)
fromPropertyTypeId
- fromPropertyTypeId@POST @Path(value="/personas/search") public PartialList<Persona> getPersonas(Query query)
Persona
matching the specified query.query
- a Query
specifying which elements to retrievePartialList
of Persona instances matching the specified query@GET @Path(value="/personas/{personaId}") public Persona loadPersona(@PathParam(value="personaId") String personaId)
Persona
identified by the specified identifier.personaId
- the identifier of the persona to retrievenull
if no such persona exists@GET @Path(value="/personasWithSessions/{personaId}") public PersonaWithSessions loadPersonaWithSessions(@PathParam(value="personaId") String personaId)
personaId
- the identifier of the persona to retrievePersonaWithSessions
instance with the persona identified by the specified identifier and all its associated sessions@POST @Path(value="/personasWithSessions") public PersonaWithSessions savePersonaWithSessions(PersonaWithSessions personaWithSessions)
personaWithSessions
- the persona to save with its sessions.PersonaWithSessions
instance with the persona identified by the specified identifier and all its associated sessions@POST @Path(value="/personas") public Persona savePersona(Persona persona)
Persona
in the context server.persona
- the persona to persist@DELETE @Path(value="/personas/{personaId}") public void deletePersona(@PathParam(value="personaId") String personaId, @QueryParam(value="persona") @DefaultValue(value="true") boolean persona)
personaId
- the identifier of the persona to deletepersona
- true
if the specified identifier is supposed to refer to a persona, false
if it is supposed to refer to a profile@PUT @Path(value="/personas/{personaId}") @Consumes(value="application/x-www-form-urlencoded") public Persona createPersona(@PathParam(value="personaId") String personaId)
personaId
- the identifier to use for the new persona@GET @Path(value="/personas/{personaId}/sessions") public PartialList<Session> getPersonaSessions(@PathParam(value="personaId") String personaId, @QueryParam(value="offset") @DefaultValue(value="0") int offset, @QueryParam(value="size") @DefaultValue(value="50") int size, @QueryParam(value="sort") String sortBy)
sortBy
String and and paged: only
size
of them are retrieved, starting with the offset
-th one.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 identifier@GET @Path(value="/sessions/{sessionId}") public Session loadSession(@PathParam(value="sessionId") String sessionId) throws ParseException
sessionId
- the identifier of the session to be retrievedParseException
- if the date hint cannot be parsed as a proper Date
object@POST @Path(value="/sessions/{sessionId}") public Session saveSession(Session session)
session
- the session to be saved@GET @Path(value="/sessions/{sessionId}/events") public PartialList<Event> getSessionEvents(@PathParam(value="sessionId") String sessionId, @QueryParam(value="eventTypes") String[] eventTypes, @QueryParam(value="q") String query, @QueryParam(value="offset") @DefaultValue(value="0") int offset, @QueryParam(value="size") @DefaultValue(value="50") int size, @QueryParam(value="sort") String sortBy)
Event
s for the Session
identified by the provided session identifier, matching any of the provided event types,
ordered according to the specified sortBy
String and paged: only size
of them are retrieved, starting with the offset
-th one.
If a query
is provided, a full text search is performed on the matching events to further filter them.sessionId
- the identifier of the user session we're consideringeventTypes
- an array of event type names; the events to retrieve should at least match one of thesequery
- a String to perform full text filtering on events matching the other conditionsoffset
- zero or a positive integer specifying the position of the first event in the total ordered collection of matching eventssize
- a positive integer specifying how many matching events 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 eventspublic PartialList<Session> findProfileSessions(String profileId)
@GET @Path(value="/existingProperties") public Collection<PropertyType> getExistingProperties(@QueryParam(value="tag") String tag, @QueryParam(value="isSystemTag") boolean isSystemTag, @QueryParam(value="itemType") String itemType, @HeaderParam(value="Accept-Language") String language, @Context javax.servlet.http.HttpServletResponse response) throws IOException
ITEM_TYPE
and with the specified tag or system tag.
TODO: move to a different classtag
- the tag we're interested inisSystemTag
- if we should look in system tags instead of tagsitemType
- the String representation of the item type we want to retrieve the count of, as defined by its class' ITEM_TYPE
fieldlanguage
- the value of the Accept-Language
header to specify in which locale the properties description should be returned TODO unusedresponse
- the http response objectIOException
- if there was an error sending the response@GET @Path(value="/properties") public Map<String,Collection<PropertyType>> getPropertyTypes(@HeaderParam(value="Accept-Language") String language)
language
- the value of the Accept-Language
header to specify in which locale the properties description should be returned TODO unusedPropertyType
s@GET @Path(value="/properties/{propertyId}") public PropertyType getPropertyType(@PathParam(value="propertyId") String propertyId, @HeaderParam(value="Accept-Language") String language)
propertyId
- the property ID for which we want to retrieve the associated property typelanguage
- the value of the Accept-Language
header to specify in which locale the properties description should be returned TODO unused@GET @Path(value="/properties/targets/{target}") public Collection<PropertyType> getPropertyTypesByTarget(@PathParam(value="target") String target, @HeaderParam(value="Accept-Language") String language)
target
- the target for which we want to retrieve the associated property typeslanguage
- the value of the Accept-Language
header to specify in which locale the properties description should be returned TODO unused@GET @Path(value="/properties/tags/{tags}") public Collection<PropertyType> getPropertyTypeByTag(@PathParam(value="tags") String tags, @HeaderParam(value="Accept-Language") String language)
tags
- a comma-separated list of tag identifierslanguage
- the value of the Accept-Language
header to specify in which locale the properties description should be returned TODO unused@GET @Path(value="/properties/systemTags/{tags}") public Collection<PropertyType> getPropertyTypeBySystemTag(@PathParam(value="tags") String tags, @HeaderParam(value="Accept-Language") String language)
tags
- a comma-separated list of tag identifierslanguage
- the value of the Accept-Language
header to specify in which locale the properties description should be returned TODO unused@POST @Path(value="/properties") public boolean setPropertyType(PropertyType property)
property
- the property type to persisttrue
if the property type was properly created, false
otherwise (for example, if the property type already existed@POST @Path(value="/properties/bulk") public boolean setPropertyTypes(List<PropertyType> properties)
properties
- the properties type to persisttrue
if the property type was properly created, false
otherwise (for example, if the property type already existed@DELETE @Path(value="/properties/{propertyId}") public boolean deleteProperty(@PathParam(value="propertyId") String propertyId)
propertyId
- the identifier of the property type to deletetrue
if the property type was properly deleted, false
otherwise@POST @Path(value="/search/sessions") public PartialList<Session> searchSession(Query query)
query
- a Query
specifying which elements to retrievePartialList
of sessions matching the specified query@POST @Path(value="/{profileId}/aliases/{aliasId}") public void addAliasToProfile(@PathParam(value="profileId") String profileId, @PathParam(value="aliasId") String aliasId, @HeaderParam(value="X-Unomi-ClientId") String headerClientID)
@DELETE @Path(value="/{profileId}/aliases/{aliasId}") public void removeAliasFromProfile(@PathParam(value="profileId") String profileId, @PathParam(value="aliasId") String aliasId, @HeaderParam(value="X-Unomi-ClientId") String headerClientID)
@GET @Path(value="/{profileId}/aliases") public PartialList<ProfileAlias> listAliasesByProfileId(@PathParam(value="profileId") String profileId, @QueryParam(value="offset") @DefaultValue(value="0") int offset, @QueryParam(value="size") @DefaultValue(value="50") int size, @QueryParam(value="sort") String sortBy)
Copyright © 2014–2023 Apache Software Foundation. All rights reserved.