persona
}
/**
- * Retrieves the tracked conditions, if any, associated with the source of the context request that resulted in this ContextResponse. Upon evaluating the incoming request,
- * the context server will determine if there are any rules marked with the "trackedCondition" tag and which source condition matches the source of the incoming request and
- * return these tracked conditions to the client that can use them to know that the context server can react to events matching the tracked condition and coming from that
- * source. This is, in particular, used to implement form mapping (a solution that allows clients to update user profiles based on values provided when a form is submitted).
+ * Tracked conditions associated with the request source.
+ *
+ * Rules tagged with {@code trackedCondition} whose source condition matches the incoming
+ * request source are returned so clients can emit matching events (for example form mapping).
*
- * TODO: trackedCondition should be a constant, possibly on the Tag class?
*
* @return the tracked conditions
* @see ContextRequest#getSource()
@@ -271,43 +275,43 @@ public void setTrackedConditions(Set trackedConditions) {
}
/**
- * Retrieves the current status of anonymous browsing, as set by the privacy service
- * @return anonymous browsing status
+ * Whether anonymous browsing is enabled, as set by the privacy service.
+ *
+ * @return {@code true} if anonymous browsing is active
*/
public boolean isAnonymousBrowsing() {
return anonymousBrowsing;
}
/**
- * Set the user anonymous browsing status
- * @param anonymousBrowsing new value for anonymousBrowsing
+ * Sets the anonymous browsing status.
+ *
+ * @param anonymousBrowsing {@code true} to enable anonymous browsing
*/
public void setAnonymousBrowsing(boolean anonymousBrowsing) {
this.anonymousBrowsing = anonymousBrowsing;
}
/**
- * Retrieves the map of consents for the current profile.
- * @return a Map where the key is the name of the consent identifier, and the value is a consent object that
- * contains all the consent data such as whether the consent was granted or deny, the date of granting/denying
- * the date at which the consent will be revoked automatically.
+ * Consent map for the current profile, keyed by consent identifier.
+ *
+ * @return map of consent identifier to consent details
*/
public Map getConsents() {
return consents;
}
/**
- * Sets the map of consents for the current profile.
- * @param consents a Map where the key is the name of the consent identifier, and the value is a consent object that
- * contains all the consent data such as whether the consent was granted or deny, the date of granting/denying
- * the date at which the consent will be revoked automatically.
+ * Sets the consent map for the current profile.
+ *
+ * @param consents map of consent identifier to consent details
*/
public void setConsents(Map consents) {
this.consents = consents;
}
/**
- * Returns the request tracing data.
+ * Request tracing tree for this context evaluation.
*
* @return the request tracing data
*/
diff --git a/api/src/main/java/org/apache/unomi/api/CustomItem.java b/api/src/main/java/org/apache/unomi/api/CustomItem.java
index fab0917e4..1bd6b0b8f 100644
--- a/api/src/main/java/org/apache/unomi/api/CustomItem.java
+++ b/api/src/main/java/org/apache/unomi/api/CustomItem.java
@@ -21,7 +21,9 @@
import java.util.Map;
/**
- * A generic extension of Item for context server extensions, properties are stored in a Map.
+ * Generic {@link Item} extension for plugin-defined entity types.
+ * Properties live in a flexible map instead of typed fields, which lets
+ * extensions store custom payloads without adding new Java classes.
*/
public class CustomItem extends Item {
/**
@@ -34,13 +36,13 @@ public class CustomItem extends Item {
private Map properties = new HashMap();
/**
- * Instantiates a new Custom item.
+ * Default constructor.
*/
public CustomItem() {
}
/**
- * Instantiates a new Custom item.
+ * Creates a custom item with the given identifier and item type.
*
* @param itemId the item id
* @param itemType the item type
@@ -51,9 +53,9 @@ public CustomItem(String itemId, String itemType) {
}
/**
- * Retrieves this CustomItem's properties.
+ * Property map for this custom item.
*
- * @return a Map of the item's properties associating the property name as key to its value.
+ * @return a map of property names to values
*/
public Map getProperties() {
return properties;
diff --git a/api/src/main/java/org/apache/unomi/api/Event.java b/api/src/main/java/org/apache/unomi/api/Event.java
index e6a87285c..988e11cda 100644
--- a/api/src/main/java/org/apache/unomi/api/Event.java
+++ b/api/src/main/java/org/apache/unomi/api/Event.java
@@ -72,13 +72,13 @@ public class Event extends Item implements TimestampedItem {
private transient Map attributes;
/**
- * Instantiates a new Event.
+ * Default constructor.
*/
public Event() {
}
/**
- * Instantiates a new Event.
+ * Creates an event with the given identifier and context fields.
*
* @param itemId the event item id identifier
* @param eventType the event type identifier
@@ -95,7 +95,7 @@ public Event(String itemId, String eventType, Session session, Profile profile,
}
/**
- * Instantiates a new Event.
+ * Creates an event with a generated identifier and the given context fields.
*
* @param eventType the event type identifier
* @param session the session associated with the event
@@ -110,7 +110,7 @@ public Event(String eventType, Session session, Profile profile, String scope, I
}
/**
- * Instantiates a new Event.
+ * Creates an event with a generated identifier, optional properties, and persistence flag.
*
* @param eventType the event type identifier
* @param session the session associated with the event
@@ -127,7 +127,7 @@ public Event(String eventType, Session session, Profile profile, String scope, I
}
/**
- * Instantiates a new Event.
+ * Creates an event with the given identifier, properties, and persistence flag.
*
* @param itemId the event item id identifier
* @param eventType the event type identifier
@@ -172,7 +172,7 @@ private void initEvent(String eventType, Session session, Profile profile, Strin
}
/**
- * Retrieves the session identifier if available.
+ * Session identifier linked to this event, if known.
*
* @return the session identifier or {@code null} if unavailable
*/
@@ -181,7 +181,8 @@ public String getSessionId() {
}
/**
- * Set the session id
+ * Sets the session identifier.
+ *
* @param sessionId the session id
*/
public void setSessionId(String sessionId) {
@@ -189,7 +190,7 @@ public void setSessionId(String sessionId) {
}
/**
- * Retrieves the profile identifier of the Profile associated with this event
+ * Profile identifier associated with this event.
*
* @return the profile id
*/
@@ -207,7 +208,7 @@ public void setProfileId(String profileId) {
}
/**
- * Retrieves the event type.
+ * Event type identifier (verb of the event sentence).
*
* @return the event type
*/
@@ -216,7 +217,8 @@ public String getEventType() {
}
/**
- * Sets the event type
+ * Sets the event type.
+ *
* @param eventType the event type
*/
public void setEventType(String eventType) {
@@ -224,7 +226,7 @@ public void setEventType(String eventType) {
}
/**
- * Retrieves the event time stamp
+ * Timestamp when this event occurred.
*
* @return the event time stamp
*/
@@ -233,14 +235,16 @@ public Date getTimeStamp() {
}
/**
- * @param timeStamp set the time stamp
+ * Sets the event timestamp.
+ *
+ * @param timeStamp the event timestamp
*/
public void setTimeStamp(Date timeStamp) {
this.timeStamp = timeStamp;
}
/**
- * Retrieves the profile.
+ * Profile associated with this event (transient, not serialized).
*
* @return the profile
*/
@@ -259,7 +263,7 @@ public void setProfile(Profile profile) {
}
/**
- * Retrieves the session.
+ * Session associated with this event (transient, not serialized).
*
* @return the session
*/
@@ -297,7 +301,7 @@ public void setPersistent(boolean persistent) {
}
/**
- * Retrieves the attributes. Attributes are not serializable, and can be used to provide additional contextual objects such as HTTP request or response objects, etc...
+ * Non-serializable contextual attributes (for example HTTP request or response objects).
*
* @return the attributes
*/
@@ -307,7 +311,8 @@ public Map getAttributes() {
}
/**
- * Sets the map of attribues
+ * Sets the non-serializable attribute map.
+ *
* @param attributes the attributes map
*/
public void setAttributes(Map attributes) {
@@ -328,7 +333,7 @@ public void setProperty(String name, Object value) {
}
/**
- * Retrieves the value of the property identified by the specified name.
+ * Value of the named event property.
*
* @param name the name of the property to be retrieved
* @return the value of the property identified by the specified name
@@ -338,10 +343,10 @@ public Object getProperty(String name) {
}
/**
- * Retrieves the value of the nested property identified by the specified name.
+ * Value of a nested property, using dot-separated path segments.
*
- * @param name the name of the property to be retrieved, splited in the nested properties with "."
- * @return the value of the property identified by the specified name
+ * @param name the property path, split on {@code "."} for nested access
+ * @return the nested value, or {@code null} if any segment is missing
*/
public Object getNestedProperty(String name) {
if (!name.contains(".")) {
@@ -362,7 +367,7 @@ public Object getNestedProperty(String name) {
}
/**
- * Retrieves the properties.
+ * All event properties.
*
* @return the properties
*/
@@ -380,23 +385,25 @@ public void setProperties(Map properties) {
}
/**
- * Retrieves the flattened properties
- * @return the flattened properties.
+ * Flattened property map used for indexing and search.
+ *
+ * @return the flattened properties
*/
public Map getFlattenedProperties() {
return flattenedProperties;
}
/**
- * Set the flattened properties for current event
- * @param flattenedProperties the properties
+ * Sets the flattened properties map used for indexing and search.
+ *
+ * @param flattenedProperties the flattened properties
*/
public void setFlattenedProperties(Map flattenedProperties) {
this.flattenedProperties = flattenedProperties;
}
/**
- * Retrieves the source.
+ * Source item of this event (subject of the event sentence).
*
* @return the source
*/
@@ -414,7 +421,7 @@ public void setSource(Item source) {
}
/**
- * Retrieves the target.
+ * Target item of this event (object of the event sentence), if any.
*
* @return the target
*/
@@ -432,7 +439,7 @@ public void setTarget(Item target) {
}
/**
- * Retrieves the action post executors for this event, if extra actions need to be executed after all Rule-triggered actions have been processed
+ * Post-executors to run after all rule-triggered actions complete.
*
* @return the action post executors
*/
diff --git a/api/src/main/java/org/apache/unomi/api/EventInfo.java b/api/src/main/java/org/apache/unomi/api/EventInfo.java
index 543d6d940..f9d6410a5 100644
--- a/api/src/main/java/org/apache/unomi/api/EventInfo.java
+++ b/api/src/main/java/org/apache/unomi/api/EventInfo.java
@@ -18,28 +18,53 @@
package org.apache.unomi.api;
/**
- * Basic event information
+ * One event type entry in {@link ServerInfo#getEventTypes()}.
+ * Pairs the event type name with how many matching events exist on the server,
+ * giving operators and clients a quick view of which event types are active.
*/
public class EventInfo {
private String name;
private Long occurences;
+ /**
+ * Creates an empty event info record.
+ */
public EventInfo() {
}
+ /**
+ * Event type name.
+ *
+ * @return event type name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the event type name.
+ *
+ * @param name event type name
+ */
public void setName(String name) {
this.name = name;
}
+ /**
+ * Number of occurrences for this event type.
+ *
+ * @return occurrence count
+ */
public Long getOccurences() {
return occurences;
}
+ /**
+ * Sets the occurrence count for this event type.
+ *
+ * @param occurences occurrence count
+ */
public void setOccurences(Long occurences) {
this.occurences = occurences;
}
diff --git a/api/src/main/java/org/apache/unomi/api/EventProperty.java b/api/src/main/java/org/apache/unomi/api/EventProperty.java
index d727e1498..aa43d71dc 100644
--- a/api/src/main/java/org/apache/unomi/api/EventProperty.java
+++ b/api/src/main/java/org/apache/unomi/api/EventProperty.java
@@ -19,9 +19,9 @@
import java.io.Serializable;
/**
- * An event property.
- *
- * @author Sergiy Shyrkov
+ * Named property attached to an {@link Event}.
+ * Events carry many properties; this type represents one key/value pair
+ * stored with the event for segmentation, personalization, and reporting.
*/
public class EventProperty implements Serializable {
@@ -32,26 +32,26 @@ public class EventProperty implements Serializable {
private String valueType = "string";
/**
- * Initializes an instance of this class.
+ * Default constructor.
*/
public EventProperty() {
super();
}
/**
- * Initializes an instance of an event property with the string value type.
+ * Creates an event property with the default string value type.
*
- * @param id the event property id
+ * @param id the property identifier
*/
public EventProperty(String id) {
this(id, null);
}
/**
- * Initializes an instance of this class.
+ * Creates an event property with the given identifier and value type.
*
- * @param id the event property id
- * @param type the type of the value for this property
+ * @param id the property identifier
+ * @param type the value type for this property
*/
public EventProperty(String id, String type) {
this();
@@ -62,27 +62,27 @@ public EventProperty(String id, String type) {
}
/**
- * Retrieves the identifier for this EventProperty.
+ * Property identifier.
*
- * @return the identifier for this EventProperty
+ * @return the property id
*/
public String getId() {
return id;
}
/**
- * Sets the identifier.
+ * Sets the property identifier.
*
- * @param id the id
+ * @param id the property id
*/
public void setId(String id) {
this.id = id;
}
/**
- * Retrieves the type.
+ * Value type for this property (for example {@code string} or {@code integer}).
*
- * @return the value type
+ * @return the value type id
*/
public String getValueType() {
return valueType;
@@ -91,7 +91,7 @@ public String getValueType() {
/**
* Sets the value type.
*
- * @param type the type
+ * @param type the value type id
*/
public void setValueType(String type) {
this.valueType = type;
diff --git a/api/src/main/java/org/apache/unomi/api/EventSource.java b/api/src/main/java/org/apache/unomi/api/EventSource.java
index 90128cf6c..df64dd14e 100644
--- a/api/src/main/java/org/apache/unomi/api/EventSource.java
+++ b/api/src/main/java/org/apache/unomi/api/EventSource.java
@@ -18,7 +18,10 @@
package org.apache.unomi.api;
/**
- * TODO: REMOVE
+ * Origin of an {@link Event} in the visitor journey.
+ * Captures scope, item id, path, and type for the page or asset that produced
+ * the event. Client trackers populate this object when posting to the events
+ * collector so rules and analytics can attribute actions to a source context.
*/
public class EventSource {
private String scope;
@@ -26,37 +29,80 @@ public class EventSource {
private String path;
private String type;
+ /**
+ * Creates an empty event source.
+ */
public EventSource() {
}
+ /**
+ * Scope of the page or asset that originated the event.
+ *
+ * @return scope name
+ */
public String getScope() {
return scope;
}
+ /**
+ * Sets the source scope.
+ *
+ * @param scope scope name
+ */
public void setScope(String scope) {
this.scope = scope;
}
+ /**
+ * Identifier of the originating page or asset within the scope.
+ *
+ * @return source item id
+ */
public String getId() {
return id;
}
+ /**
+ * Sets the source item id.
+ *
+ * @param id source item id
+ */
public void setId(String id) {
this.id = id;
}
+ /**
+ * URL or logical path of the page where the event was triggered.
+ *
+ * @return source path
+ */
public String getPath() {
return path;
}
+ /**
+ * Sets the source path.
+ *
+ * @param path source path
+ */
public void setPath(String path) {
this.path = path;
}
+ /**
+ * Type label for the source object (for example page, form, or product).
+ *
+ * @return source type
+ */
public String getType() {
return type;
}
+ /**
+ * Sets the source type label.
+ *
+ * @param type source type
+ */
public void setType(String type) {
this.type = type;
}
diff --git a/api/src/main/java/org/apache/unomi/api/EventTarget.java b/api/src/main/java/org/apache/unomi/api/EventTarget.java
index f1bc1addc..2a5c68d31 100644
--- a/api/src/main/java/org/apache/unomi/api/EventTarget.java
+++ b/api/src/main/java/org/apache/unomi/api/EventTarget.java
@@ -21,7 +21,10 @@
import java.util.Map;
/**
- * TODO: REMOVE
+ * Subject of an {@link Event} — what the visitor interacted with.
+ * Stores the target item id and type plus optional properties (for example the
+ * product or content element clicked). Together with {@link EventSource} it
+ * gives rules enough context to personalize, segment, and report on behavior.
*/
public class EventTarget implements Serializable {
private static final long serialVersionUID = 6370790894348364803L;
@@ -29,34 +32,73 @@ public class EventTarget implements Serializable {
private String type;
private Map properties;
+ /**
+ * Default constructor.
+ */
public EventTarget() {
}
+ /**
+ * Creates an event target with the given identifier and type.
+ *
+ * @param id the unique identifier of the event target
+ * @param type the type associated with this event target
+ */
public EventTarget(String id, String type) {
this.id = id;
this.type = type;
}
+ /**
+ * Unique identifier of this event target.
+ *
+ * @return the event target id
+ */
public String getId() {
return id;
}
+ /**
+ * Sets the unique identifier of this event target.
+ *
+ * @param id the event target id
+ */
public void setId(String id) {
this.id = id;
}
+ /**
+ * Type label for this event target.
+ *
+ * @return the event target type
+ */
public String getType() {
return type;
}
+ /**
+ * Sets the type label for this event target.
+ *
+ * @param type the event target type
+ */
public void setType(String type) {
this.type = type;
}
+ /**
+ * Arbitrary properties associated with this event target.
+ *
+ * @return the property map
+ */
public Map getProperties() {
return properties;
}
+ /**
+ * Sets the arbitrary properties for this event target.
+ *
+ * @param properties the property map
+ */
public void setProperties(Map properties) {
this.properties = properties;
}
diff --git a/api/src/main/java/org/apache/unomi/api/EventsCollectorRequest.java b/api/src/main/java/org/apache/unomi/api/EventsCollectorRequest.java
index 759a71ca8..49ff69965 100644
--- a/api/src/main/java/org/apache/unomi/api/EventsCollectorRequest.java
+++ b/api/src/main/java/org/apache/unomi/api/EventsCollectorRequest.java
@@ -20,7 +20,10 @@
import java.util.List;
/**
- * A request for events to be processed.
+ * JSON body accepted by the events collector REST endpoint.
+ * Bundles one or more {@link Event} instances plus optional {@code sessionId}
+ * and {@code profileId} hints so Unomi can attach incoming events to the
+ * correct session and profile before rules run and persistence writes occur.
*/
public class EventsCollectorRequest {
@@ -36,60 +39,64 @@ public class EventsCollectorRequest {
private String publicApiKey;
/**
- * Retrieves the events to be processed.
+ * Events submitted for collection and rule evaluation.
*
- * @return the events to be processed
+ * @return the event list
*/
public List getEvents() {
return events;
}
+ /**
+ * Sets the events to collect and process.
+ *
+ * @param events the events to submit
+ */
public void setEvents(List events) {
this.events = events;
}
/**
- * Retrieve the sessionId passed along with the request. All events will be processed with this sessionId as a
- * default
+ * Default session id applied to all events in this request when an event does not specify its own.
*
- * @return the identifier for the session
+ * @return the session id, or {@code null} if none was provided
*/
public String getSessionId() {
return sessionId;
}
/**
- * Sets the sessionId in the request. This is the preferred method of passing along a session identifier with the
- * request, as passing it along in the URL can lead to potential security vulnerabilities.
+ * Sets the default session id for events in this request.
+ * Prefer this over passing the session id in the URL to avoid leaking identifiers in logs or referrers.
*
- * @param sessionId an unique identifier for the session
+ * @param sessionId the session id
*/
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
/**
- * Retrieve the profileId passed along with the request. All events will be processed with this profileId as a
- * default
+ * Default profile id applied to all events in this request when an event does not specify its own.
*
- * @return the identifier for the profile
+ * @return the profile id, or {@code null} if none was provided
*/
public String getProfileId() {
return profileId;
}
/**
- * Sets the profileId in the request.
+ * Sets the default profile id for events in this request.
*
- * @param profileId an unique identifier for the profile
+ * @param profileId the profile id
*/
public void setProfileId(String profileId) {
this.profileId = profileId;
}
/**
- * Gets the public API key used for tenant authentication.
- * @return the public API key
+ * Public API key used for tenant authentication.
+ *
+ * @return the public API key, or {@code null} if none was provided
*/
public String getPublicApiKey() {
return publicApiKey;
@@ -97,7 +104,8 @@ public String getPublicApiKey() {
/**
* Sets the public API key used for tenant authentication.
- * @param publicApiKey the public API key to set
+ *
+ * @param publicApiKey the public API key
*/
public void setPublicApiKey(String publicApiKey) {
this.publicApiKey = publicApiKey;
diff --git a/api/src/main/java/org/apache/unomi/api/ExecutionContext.java b/api/src/main/java/org/apache/unomi/api/ExecutionContext.java
index 39b13f383..93679f099 100644
--- a/api/src/main/java/org/apache/unomi/api/ExecutionContext.java
+++ b/api/src/main/java/org/apache/unomi/api/ExecutionContext.java
@@ -21,17 +21,28 @@
import java.util.Stack;
/**
- * Represents the execution context for operations in Unomi, including security and tenant information.
+ * Security and tenant context for an in-flight operation.
+ * Carries the active tenant id, roles, permissions, and helpers to check
+ * access or temporarily switch tenant scope. Services read this object to
+ * enforce multi-tenant isolation and authorization.
*/
public class ExecutionContext {
+ /** Identifier of the system tenant, used for cross-tenant administration. */
public static final String SYSTEM_TENANT = "system";
-
+
private String tenantId;
private Set roles = new HashSet<>();
private Set permissions = new HashSet<>();
private Stack tenantStack = new Stack<>();
private boolean isSystem = false;
-
+
+ /**
+ * Creates a context for the given tenant, roles, and permissions.
+ *
+ * @param tenantId tenant id
+ * @param roles roles assigned in this context, or {@code null}
+ * @param permissions explicit permissions granted in this context, or {@code null}
+ */
public ExecutionContext(String tenantId, Set roles, Set permissions) {
this.tenantId = tenantId;
if (tenantId != null && tenantId.equals(SYSTEM_TENANT)) {
@@ -44,57 +55,112 @@ public ExecutionContext(String tenantId, Set roles, Set permissi
this.permissions.addAll(permissions);
}
}
-
+
+ /**
+ * Returns a context for the system tenant.
+ *
+ * @return system execution context
+ */
public static ExecutionContext systemContext() {
ExecutionContext context = new ExecutionContext(SYSTEM_TENANT, null, null);
context.isSystem = true;
return context;
}
-
+
+ /**
+ * Active tenant id.
+ *
+ * @return tenant id
+ */
public String getTenantId() {
return tenantId;
}
-
+
+ /**
+ * Roles assigned to this context.
+ *
+ * @return copy of the role set
+ */
public Set getRoles() {
return new HashSet<>(roles);
}
-
+
+ /**
+ * Permissions granted to this context.
+ *
+ * @return copy of the permission set
+ */
public Set getPermissions() {
return new HashSet<>(permissions);
}
-
+
+ /**
+ * Whether this context represents the system tenant.
+ *
+ * @return {@code true} for the system tenant
+ */
public boolean isSystem() {
return isSystem;
}
-
+
+ /**
+ * Switches to a new tenant, saving the previous tenant on an internal stack.
+ *
+ * @param tenantId new tenant id
+ */
public void setTenant(String tenantId) {
tenantStack.push(this.tenantId);
this.tenantId = tenantId;
this.isSystem = SYSTEM_TENANT.equals(tenantId);
}
+ /**
+ * Restores the tenant saved by the most recent {@link #setTenant(String)} call.
+ */
public void restorePreviousTenant() {
if (!tenantStack.isEmpty()) {
this.tenantId = tenantStack.pop();
this.isSystem = SYSTEM_TENANT.equals(this.tenantId);
}
}
-
+
+ /**
+ * Checks that this context may perform the given operation.
+ * System contexts always pass. Otherwise the operation name must be present
+ * in the granted permissions.
+ *
+ * @param operation operation name to validate
+ * @throws SecurityException if the permission is missing
+ */
public void validateAccess(String operation) {
if (isSystem) {
return;
}
-
+
if (!hasPermission(operation)) {
throw new SecurityException("Access denied: Missing permission for operation " + operation + " for tenant " + tenantId + " and roles " + roles);
}
}
-
+
+ /**
+ * Whether this context has the given permission.
+ * System contexts always return {@code true}.
+ *
+ * @param permission permission name
+ * @return {@code true} if the permission is granted
+ */
public boolean hasPermission(String permission) {
return isSystem || permissions.contains(permission);
}
-
+
+ /**
+ * Whether this context has the given role.
+ * System contexts always return {@code true}.
+ *
+ * @param role role name
+ * @return {@code true} if the role is granted
+ */
public boolean hasRole(String role) {
return isSystem || roles.contains(role);
}
-}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/api/src/main/java/org/apache/unomi/api/GeoPoint.java b/api/src/main/java/org/apache/unomi/api/GeoPoint.java
index b3d0d02a6..77a1ebe97 100644
--- a/api/src/main/java/org/apache/unomi/api/GeoPoint.java
+++ b/api/src/main/java/org/apache/unomi/api/GeoPoint.java
@@ -20,7 +20,9 @@
import java.util.Map;
/**
- * GeoPoint represents a point in geographical coordinate system using latitude and longitude.
+ * A geographic location expressed as latitude and longitude.
+ * Used on profiles, events, and queries when rules or segments need to
+ * match users or actions by location.
*/
public class GeoPoint {
@@ -35,7 +37,7 @@ public class GeoPoint {
private Double lon;
/**
- * Instantiates a new GeoPoint
+ * Creates a geo point at the given coordinates.
*
* @param lat latitude of the geo point
* @param lon longitude of the geo point
@@ -46,7 +48,7 @@ public GeoPoint(Double lat, Double lon) {
}
/**
- * Retrieves latitude of the geo point
+ * Latitude of this geo point.
*
* @return geo point latitude
*/
@@ -55,7 +57,7 @@ public Double getLat() {
}
/**
- * Retrieves longitude of the geo point
+ * Longitude of this geo point.
*
* @return geo point longitude
*/
@@ -98,11 +100,11 @@ public double distanceTo(final GeoPoint other) {
}
/**
- * Instantiates geo point from map of coordinates
+ * Parses a geo point from a coordinate map with {@code lat} and {@code lon} keys.
*
- * @param map Map containing coordinates with keys "lat" and "lon"
- * @return New geo point or null if map is not a valid geo point
- * @throws IllegalArgumentException Thrown if the input is not valid
+ * @param map map containing coordinates with keys {@code lat} and {@code lon}
+ * @return a new geo point
+ * @throws IllegalArgumentException if the map is null, empty, or missing required keys
*/
public static GeoPoint fromMap(Map map) {
if (map == null || map.isEmpty() || !map.containsKey("lat") || !map.containsKey("lon")) {
@@ -112,11 +114,11 @@ public static GeoPoint fromMap(Map map) {
}
/**
- * Instantiates geo point from string representation
+ * Parses a geo point from a {@code "lat, lon"} string.
*
- * @param input String geo point representation in the following format: "lat, lon"
- * @return New geo point or null if string is not a valid geo point
- * @throws IllegalArgumentException Thrown if the input is not valid
+ * @param input string geo point representation in the format {@code "lat, lon"}
+ * @return a new geo point, or {@code null} if the input is blank
+ * @throws IllegalArgumentException if the input cannot be parsed
*/
public static GeoPoint fromString(final String input) {
if (input == null || input.trim().length() == 0) {
diff --git a/api/src/main/java/org/apache/unomi/api/Item.java b/api/src/main/java/org/apache/unomi/api/Item.java
index ec796de52..b8e63d4f2 100644
--- a/api/src/main/java/org/apache/unomi/api/Item.java
+++ b/api/src/main/java/org/apache/unomi/api/Item.java
@@ -50,6 +50,13 @@ public abstract class Item implements Serializable, YamlConvertible {
private static final Map itemTypeCache = new ConcurrentHashMap<>();
+ /**
+ * Resolves the item type string from a class's {@code ITEM_TYPE} constant.
+ * Results are cached per class.
+ *
+ * @param clazz item class
+ * @return item type, or {@code null} if {@code ITEM_TYPE} is missing or inaccessible
+ */
public static String getItemType(Class clazz) {
String itemType = itemTypeCache.get(clazz);
if (itemType != null) {
@@ -67,10 +74,29 @@ public static String getItemType(Class clazz) {
return null;
}
+ /**
+ * Unique id used when this item is persisted or referenced.
+ * Must be unique among items of the same {@link #itemType}.
+ */
protected String itemId;
+ /**
+ * Persistence type string for this item.
+ * Subclasses must define a public {@code ITEM_TYPE} constant with this value.
+ */
protected String itemType;
+ /**
+ * Scope that groups related items (often one analyzed site).
+ * Used by clients to filter data returned from the context server.
+ */
protected String scope;
+ /**
+ * Optimistic-locking version, incremented when the item is updated.
+ */
protected Long version;
+ /**
+ * Server-managed metadata keyed by string.
+ * Stores values that are not part of the item's core properties.
+ */
protected Map systemMetadata = new HashMap<>();
private String tenantId;
@@ -82,6 +108,11 @@ public static String getItemType(Class clazz) {
private String sourceInstanceId;
private Date lastSyncDate;
+ /**
+ * Initializes {@link #itemType} from the subclass {@code ITEM_TYPE} constant
+ * and sets default audit metadata ({@link #creationDate}, {@link #version}).
+ * Logs an error when {@code ITEM_TYPE} is missing on the concrete class.
+ */
public Item() {
this.itemType = getItemType(this.getClass());
if (itemType == null) {
@@ -90,6 +121,11 @@ public Item() {
initializeAuditMetadata();
}
+ /**
+ * Creates an item with the given id.
+ *
+ * @param itemId item id
+ */
public Item(String itemId) {
this();
this.itemId = itemId;
@@ -102,50 +138,56 @@ private void initializeAuditMetadata() {
}
/**
- * Retrieves the Item's identifier used to uniquely identify this Item when persisted or when referred to. An Item's identifier must be unique among Items with the same type.
+ * Unique id among items of the same type.
+ * No particular format is required as long as the id is unique for this item type.
*
- * @return a String representation of the identifier, no particular format is prescribed as long as it is guaranteed unique for this particular Item.
+ * @return item id
*/
public String getItemId() {
return itemId;
}
+ /**
+ * Sets the item id.
+ *
+ * @param itemId item id
+ */
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
- * Retrieves the Item's type used to assert metadata and structure common to Items of this type, notably for persistence purposes. The Item's type must
- * match the value defined by the implementation's {@code ITEM_TYPE} public constant.
+ * Item type used for persistence and metadata.
+ * Must match the implementing class {@code ITEM_TYPE} constant.
*
- * @return a String representation of this Item's type, must equal the {@code ITEM_TYPE} value
+ * @return item type
*/
public String getItemType() {
return itemType;
}
/**
- * Sets the Item's type.
+ * Sets the item type.
*
- * @param itemType the Item's type
+ * @param itemType item type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
}
/**
- * Retrieves the Item's scope.
+ * Scope that groups related items.
*
- * @return the Item's scope name
+ * @return scope name
*/
public String getScope() {
return scope;
}
/**
- * Sets the Item's scope.
+ * Sets the scope.
*
- * @param scope the Item's scope
+ * @param scope scope name
*/
public void setScope(String scope) {
this.scope = scope;
@@ -166,152 +208,176 @@ public int hashCode() {
return itemId != null ? itemId.hashCode() : 0;
}
+ /**
+ * Optimistic-locking version.
+ *
+ * @return item version
+ */
public Long getVersion() {
return version;
}
+ /**
+ * Sets the item version.
+ *
+ * @param version item version
+ */
public void setVersion(Long version) {
this.version = version;
}
/**
- * Returns the system metadata for the given key.
+ * Returns system metadata for the given key.
*
- * @param key the key
- * @return the system metadata for the given key
+ * @param key metadata key
+ * @return metadata value
*/
public Object getSystemMetadata(String key) {
return systemMetadata.get(key);
}
/**
- * Sets the system metadata for the given key.
+ * Sets system metadata for the given key.
*
- * @param key the key
- * @param value the value
+ * @param key metadata key
+ * @param value metadata value
*/
public void setSystemMetadata(String key, Object value) {
systemMetadata.put(key, value);
}
+ /**
+ * Tenant that owns this item.
+ *
+ * @return tenant id
+ */
public String getTenantId() {
return tenantId;
}
/**
- * Sets the tenant ID.
+ * Sets the tenant id.
*
- * @param tenantId the tenant ID
+ * @param tenantId tenant id
*/
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
- // Audit metadata getters and setters
+ /**
+ * User or system that created this item.
+ *
+ * @return creator id
+ */
public String getCreatedBy() {
return createdBy;
}
/**
- * Sets the created by.
+ * Sets the creator id.
*
- * @param createdBy the created by
+ * @param createdBy creator id
*/
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
+ /**
+ * User or system that last modified this item.
+ *
+ * @return last modifier id
+ */
public String getLastModifiedBy() {
return lastModifiedBy;
}
/**
- * Sets the last modified by.
+ * Sets the last modifier id.
*
- * @param lastModifiedBy the last modified by
+ * @param lastModifiedBy last modifier id
*/
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
/**
- * Returns the date when this item was created.
+ * When this item was created.
*
- * @return the date when this item was created
+ * @return creation date
*/
public Date getCreationDate() {
return creationDate;
}
/**
- * Sets the date when this item was created.
+ * Sets the creation date.
*
- * @param creationDate the creation date
+ * @param creationDate creation date
*/
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
/**
- * Returns the date when this item was last modified.
+ * When this item was last modified.
*
- * @return the date when this item was last modified
+ * @return last modification date
*/
public Date getLastModificationDate() {
return lastModificationDate;
}
/**
- * Sets the date when this item was last modified.
+ * Sets the last modification date.
*
- * @param lastModificationDate the last modification date
+ * @param lastModificationDate last modification date
*/
public void setLastModificationDate(Date lastModificationDate) {
this.lastModificationDate = lastModificationDate;
}
/**
- * Returns the source instance ID.
+ * Cluster node that originated this item.
*
- * @return the source instance ID
+ * @return source instance id
*/
public String getSourceInstanceId() {
return sourceInstanceId;
}
/**
- * Sets the source instance ID.
+ * Sets the source instance id.
*
- * @param sourceInstanceId the source instance ID
+ * @param sourceInstanceId source instance id
*/
public void setSourceInstanceId(String sourceInstanceId) {
this.sourceInstanceId = sourceInstanceId;
}
/**
- * Returns the last synchronization date.
+ * When this item was last synchronized from another node.
*
- * @return the last synchronization date
+ * @return last sync date
*/
public Date getLastSyncDate() {
return lastSyncDate;
}
/**
- * Sets the last synchronization date.
+ * Sets the last sync date.
*
- * @param lastSyncDate the last synchronization date
+ * @param lastSyncDate last sync date
*/
public void setLastSyncDate(Date lastSyncDate) {
this.lastSyncDate = lastSyncDate;
}
/**
- * Converts this item to a Map structure for YAML output.
- * Implements YamlConvertible interface with circular reference detection.
+ * Converts this item to a map for YAML output.
*
- * @param visited set of already visited objects to prevent infinite recursion (may be null)
- * @return a Map representation of this item
+ * @param visited objects already visited while converting (may be {@code null})
+ * @param maxDepth remaining recursion depth
+ * @return map representation of this item
*/
@Override
public Map toYaml(Set visited, int maxDepth) {
diff --git a/api/src/main/java/org/apache/unomi/api/Metadata.java b/api/src/main/java/org/apache/unomi/api/Metadata.java
index 4f650589f..ec643e2d8 100644
--- a/api/src/main/java/org/apache/unomi/api/Metadata.java
+++ b/api/src/main/java/org/apache/unomi/api/Metadata.java
@@ -29,7 +29,9 @@
import static org.apache.unomi.api.utils.YamlUtils.circularRef;
/**
- * A class providing information about context server entities.
+ * Common descriptive fields shared by Unomi configuration items.
+ * Includes id, name, description, scope, tags, and related attributes that
+ * appear on segments, rules, property types, and other managed entities.
*
* @see MetadataItem
*/
@@ -53,27 +55,27 @@ public class Metadata implements Comparable, Serializable, YamlConvert
private boolean readOnly = false;
/**
- * Instantiates a new Metadata.
+ * Default constructor.
*/
public Metadata() {
}
/**
- * Instantiates a new Metadata with the specified identifier.
+ * Creates metadata with the given identifier.
*
- * @param id the identifier for this Metadata
+ * @param id the metadata identifier
*/
public Metadata(String id) {
this.id = id;
}
/**
- * Instantiates a new Metadata with the provided information.
+ * Creates metadata with scope, identifier, name, and description.
*
- * @param scope the scope for this Metadata
- * @param id the identifier of the associated {@link Item}
- * @param name the name
- * @param description the description
+ * @param scope the item scope
+ * @param id the item identifier
+ * @param name the display name
+ * @param description the human-readable description
*/
public Metadata(String scope, String id, String name, String description) {
this.scope = scope;
@@ -83,25 +85,25 @@ public Metadata(String scope, String id, String name, String description) {
}
/**
- * Retrieves the identifier for the entity associated with this Metadata
+ * Identifier of the item described by this metadata.
*
- * @return the identifier
+ * @return the item id
*/
public String getId() {
return id;
}
/**
- * Sets the id.
+ * Sets the item identifier.
*
- * @param id the id
+ * @param id the item id
*/
public void setId(String id) {
this.id = id;
}
/**
- * Retrieves the name.
+ * Display name shown in administrative UIs.
*
* @return the name
*/
@@ -110,7 +112,7 @@ public String getName() {
}
/**
- * Sets the name.
+ * Sets the display name.
*
* @param name the name
*/
@@ -119,7 +121,7 @@ public void setName(String name) {
}
/**
- * Retrieves the description.
+ * Human-readable description of the item.
*
* @return the description
*/
@@ -137,9 +139,9 @@ public void setDescription(String description) {
}
/**
- * Retrieves the scope for the entity associated with this Metadata
+ * Scope that owns this item.
*
- * @return the scope for the entity associated with this Metadata
+ * @return the scope id
* @see Item Item for a deeper discussion of scopes
*/
public String getScope() {
@@ -147,36 +149,36 @@ public String getScope() {
}
/**
- * Sets the scope.
+ * Sets the item scope.
*
- * @param scope the scope
+ * @param scope the scope id
*/
public void setScope(String scope) {
this.scope = scope;
}
/**
- * Retrieves a set of {@link String} tag names associated with this Metadata
+ * User-defined tags for organizing and filtering items.
*
- * @return a set of {@link String} tag names associated with this Metadata
+ * @return the tag names
*/
public Set getTags() {
return tags;
}
/**
- * Sets the tags.
+ * Sets the user-defined tags.
*
- * @param tags the tag ids
+ * @param tags the tag names
*/
public void setTags(Set tags) {
this.tags = tags;
}
/**
- * Retrieves a set of {@link String} system tag names associated with this Metadata
+ * System tags applied by the platform (not editable in UIs).
*
- * @return a set of {@link String} system tag names associated with this Metadata
+ * @return the system tag names
*/
public Set getSystemTags() {
return systemTags;
@@ -185,32 +187,32 @@ public Set getSystemTags() {
/**
* Sets the system tags.
*
- * @param systemTags the system tag ids
+ * @param systemTags the system tag names
*/
public void setSystemTags(Set systemTags) {
this.systemTags = systemTags;
}
/**
- * Whether the associated entity is considered active by the context server, in particular to check if rules need to be created / triggered
+ * Whether the associated item is active and eligible for rule evaluation.
*
- * @return {@code true} if the associated entity is enabled, {@code false} otherwise
+ * @return {@code true} if enabled, {@code false} otherwise
*/
public boolean isEnabled() {
return enabled;
}
/**
- * Specifies whether the associated entity should be active or not.
+ * Sets whether the associated item is active.
*
- * @param enabled {@code true} if the associated entity is enabled, {@code false} otherwise
+ * @param enabled {@code true} to enable the item, {@code false} to disable it
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
/**
- * Whether the associated entity is waiting on additional plugins to become available to be able to properly perform its function.
+ * Whether required OSGi plugins are missing and the item cannot run yet.
*
* @return {@code true} if plugins are missing, {@code false} otherwise
*/
@@ -219,7 +221,7 @@ public boolean isMissingPlugins() {
}
/**
- * Specifies whether the associated entity is waiting on additional plugins to become available.
+ * Sets whether required plugins are missing.
*
* @param missingPlugins {@code true} if plugins are missing, {@code false} otherwise
*/
@@ -228,41 +230,47 @@ public void setMissingPlugins(boolean missingPlugins) {
}
/**
- * Whether the associated entity is considered for internal purposes only and should therefore be hidden to accessing UIs.
+ * Whether the item should be hidden from administrative UIs.
*
- * @return {@code true} if the associated entity needs to be hidden, {@code false} otherwise
+ * @return {@code true} if hidden, {@code false} otherwise
*/
public boolean isHidden() {
return hidden;
}
/**
- * Specifies whether the associated entity is hidden.
+ * Sets whether the item is hidden from UIs.
*
- * @param hidden {@code true} if the associated entity needs to be hidden, {@code false} otherwise
+ * @param hidden {@code true} to hide the item, {@code false} to show it
*/
public void setHidden(boolean hidden) {
this.hidden = hidden;
}
/**
- * Whether the associated entity can be accessed but not modified.
+ * Whether the item can be read but not modified.
*
- * @return {@code true} if the associated entity can be accessed but not modified, {@code false} otherwise
+ * @return {@code true} if read-only, {@code false} otherwise
*/
public boolean isReadOnly() {
return readOnly;
}
/**
- * Specifies whether the associated entity should be only accessed and not modified.
+ * Sets whether the item is read-only.
*
- * @param readOnly {@code true} if the associated entity can be accessed but not modified, {@code false} otherwise
+ * @param readOnly {@code true} for read-only access, {@code false} to allow updates
*/
public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}
+ /**
+ * Compares metadata by item identifier.
+ *
+ * @param o the other metadata
+ * @return a negative, zero, or positive value depending on id ordering
+ */
public int compareTo(Metadata o) {
return getId().compareTo(o.getId());
}
diff --git a/api/src/main/java/org/apache/unomi/api/MetadataItem.java b/api/src/main/java/org/apache/unomi/api/MetadataItem.java
index 68cf3b324..53ffc91ad 100644
--- a/api/src/main/java/org/apache/unomi/api/MetadataItem.java
+++ b/api/src/main/java/org/apache/unomi/api/MetadataItem.java
@@ -28,30 +28,46 @@
import static org.apache.unomi.api.utils.YamlUtils.toYamlValue;
/**
- * A superclass for all {@link Item}s that bear {@link Metadata}.
+ * Base {@link Item} for entities that carry {@link Metadata}.
+ * Most user-facing definitions (segments, rules, property types, etc.)
+ * extend this class so they share the same identification and tagging model.
*/
public abstract class MetadataItem extends Item {
private static final long serialVersionUID = -2459510107927663510L;
+ /** The associated {@link Metadata} object for this item. */
protected Metadata metadata;
+ /**
+ * Default constructor.
+ */
public MetadataItem() {
}
+ /**
+ * Creates an item with the given metadata and sets the item id from it.
+ *
+ * @param metadata the item metadata
+ */
public MetadataItem(Metadata metadata) {
super(metadata != null ? metadata.getId() : null);
this.metadata = metadata;
}
/**
- * Retrieves the associated Metadata.
+ * Descriptive metadata for this item.
*
- * @return the associated Metadata
+ * @return the metadata
*/
@XmlElement(name = "metadata")
public Metadata getMetadata() {
return metadata;
}
+ /**
+ * Sets the metadata and updates the item id when metadata is non-null.
+ *
+ * @param metadata the metadata to assign
+ */
public void setMetadata(Metadata metadata) {
if (metadata != null) {
this.itemId = metadata.getId();
@@ -59,6 +75,12 @@ public void setMetadata(Metadata metadata) {
this.metadata = metadata;
}
+ /**
+ * Returns the scope for this item, taken from {@link Metadata} when present.
+ * Falls back to the item-level scope field otherwise.
+ *
+ * @return the scope id, or {@code null} if none is set
+ */
@XmlTransient
public String getScope() {
if (metadata != null) {
diff --git a/api/src/main/java/org/apache/unomi/api/Parameter.java b/api/src/main/java/org/apache/unomi/api/Parameter.java
index 10cd6083d..c34ad37fc 100644
--- a/api/src/main/java/org/apache/unomi/api/Parameter.java
+++ b/api/src/main/java/org/apache/unomi/api/Parameter.java
@@ -28,8 +28,11 @@
import static org.apache.unomi.api.utils.YamlUtils.toYamlValue;
/**
- * A representation of a condition parameter, to be used in the segment building UI to either select parameters from a
- * choicelist or to enter a specific value.
+ * Parameter definition for a {@link org.apache.unomi.api.conditions.ConditionType}.
+ * Describes how the segment builder UI should collect a value: free text, choice
+ * list, or nested structure. Saved on condition types and validated by
+ * {@link org.apache.unomi.api.services.ConditionValidationService} when rules
+ * or segments are stored.
*/
public class Parameter implements Serializable, YamlConvertible {
@@ -44,35 +47,75 @@ public class Parameter implements Serializable, YamlConvertible {
private Object defaultValue;
private ConditionValidation validation;
+ /**
+ * Default constructor.
+ */
public Parameter() {
}
+ /**
+ * Creates a parameter with id, type, and multivalued flag.
+ *
+ * @param id the parameter identifier
+ * @param type the parameter data type (for example {@code string} or {@code integer})
+ * @param multivalued whether multiple values are allowed
+ */
public Parameter(String id, String type, boolean multivalued) {
this.id = id;
this.type = type;
this.multivalued = multivalued;
}
+ /**
+ * Parameter identifier.
+ *
+ * @return the parameter id
+ */
public String getId() {
return id;
}
+ /**
+ * Sets the parameter identifier.
+ *
+ * @param id the parameter id
+ */
public void setId(String id) {
this.id = id;
}
+ /**
+ * Parameter data type (for example {@code string}, {@code integer}, or {@code boolean}).
+ *
+ * @return the type id
+ */
public String getType() {
return type;
}
+ /**
+ * Sets the parameter data type.
+ *
+ * @param type the type id
+ */
public void setType(String type) {
this.type = type;
}
+ /**
+ * Whether this parameter accepts multiple values.
+ *
+ * @return {@code true} if multivalued, {@code false} otherwise
+ */
public boolean isMultivalued() {
return multivalued;
}
+ /**
+ * Sets whether this parameter accepts multiple values.
+ *
+ * @param multivalued {@code true} to allow multiple values
+ */
public void setMultivalued(boolean multivalued) {
this.multivalued = multivalued;
}
@@ -86,18 +129,38 @@ public void setChoiceListInitializerFilter(String choiceListInitializerFilter) {
// Avoid errors when deploying old definitions
}
+ /**
+ * Default value used when a condition does not supply this parameter.
+ *
+ * @return the default value, or {@code null} if none is configured
+ */
public Object getDefaultValue() {
return defaultValue;
}
+ /**
+ * Sets the default value for this parameter.
+ *
+ * @param defaultValue the default value
+ */
public void setDefaultValue(Object defaultValue) {
this.defaultValue = defaultValue;
}
+ /**
+ * Validation rules applied when this parameter is used in a condition.
+ *
+ * @return the validation rules, or {@code null} if none are configured
+ */
public ConditionValidation getValidation() {
return validation;
}
+ /**
+ * Sets validation rules for this parameter.
+ *
+ * @param validation the validation rules
+ */
public void setValidation(ConditionValidation validation) {
this.validation = validation;
}
diff --git a/api/src/main/java/org/apache/unomi/api/PartialList.java b/api/src/main/java/org/apache/unomi/api/PartialList.java
index 568cf334e..f6fe43a44 100644
--- a/api/src/main/java/org/apache/unomi/api/PartialList.java
+++ b/api/src/main/java/org/apache/unomi/api/PartialList.java
@@ -23,10 +23,11 @@
import java.util.List;
/**
- * A list of elements representing a limited view of a larger list, starting from a given element (offset from the first) and showing only a given number of elements, instead of
- * showing all of them. This is useful to retrieve "pages" of large element collections.
+ * Window into a larger result set for paginated queries.
+ * Carries the current page, offset, total hit count, and optional scroll
+ * continuation tokens for deep result sets.
*
- * @param the generic type of contained elements
+ * @param the element type
*/
public class PartialList implements Serializable {
@@ -45,12 +46,14 @@ public class PartialList implements Serializable {
* relation we can understand if we are in the case of an accurate hit or not.
*/
public enum Relation {
+ /** Total size equals the reported value exactly. */
EQUAL,
+ /** Total size is at least the reported value (approximate lower bound). */
GREATER_THAN_OR_EQUAL_TO
}
/**
- * Instantiates a new PartialList.
+ * Default constructor with an empty list and zero counts.
*/
public PartialList() {
list = new ArrayList<>();
@@ -61,13 +64,13 @@ public PartialList() {
}
/**
- * Instantiates a new PartialList.
+ * Creates a partial list view over a full result set.
*
- * @param list the limited view into the bigger List this PartialList is representing
- * @param offset the offset of the first element in the view
- * @param pageSize the number of elements this PartialList contains
- * @param totalSize the total size of elements in the original List
- * @param totalSizeRelation the relation to the total size (equals or greater than)
+ * @param list the page of elements
+ * @param offset index of the first element in the full set
+ * @param pageSize number of elements in this page
+ * @param totalSize total elements in the full set
+ * @param totalSizeRelation whether {@code totalSize} is exact or a lower bound
*/
public PartialList(List list, long offset, long pageSize, long totalSize, Relation totalSizeRelation) {
this.list = list;
@@ -78,66 +81,81 @@ public PartialList(List list, long offset, long pageSize, long totalSize, Rel
}
/**
- * Retrieves the limited list view.
+ * Elements in the current page.
*
- * @return a List of the {@code size} elements starting from the {@code offset}-th one from the original, larger list
+ * @return the page contents
*/
public List getList() {
return list;
}
/**
- * Sets the view list.
+ * Sets the page contents.
*
- * @param list the view list into the bigger List this PartialList is representing
+ * @param list the elements for this page
*/
public void setList(List list) {
this.list = list;
}
/**
- * Retrieves the offset of the first element of the view.
+ * Index of the first element in the full result set.
*
- * @return the offset of the first element of the view
+ * @return the offset
*/
public long getOffset() {
return offset;
}
+ /**
+ * Sets the offset of the first element in the full result set.
+ *
+ * @param offset the starting index
+ */
public void setOffset(long offset) {
this.offset = offset;
}
/**
- * Retrieves the number of elements this PartialList contains.
+ * Maximum number of elements requested for this page.
*
- * @return the number of elements this PartialList contains
+ * @return the page size
*/
public long getPageSize() {
return pageSize;
}
+ /**
+ * Sets the page size.
+ *
+ * @param pageSize the maximum number of elements per page
+ */
public void setPageSize(long pageSize) {
this.pageSize = pageSize;
}
/**
- * Retrieves the total size of elements in the original List.
+ * Total number of matching elements in the full result set.
*
- * @return the total size of elements in the original List
+ * @return the total size
*/
public long getTotalSize() {
return totalSize;
}
+ /**
+ * Sets the total number of matching elements.
+ *
+ * @param totalSize the total size
+ */
public void setTotalSize(long totalSize) {
this.totalSize = totalSize;
}
/**
- * Retrieves the size of this PartialList. Should equal {@link #getPageSize()}.
+ * Number of elements in the current page (should match {@link #getPageSize()}).
*
- * @return the size of this PartialList
+ * @return the number of elements in {@link #getList()}
*/
@XmlTransient
public int size() {
@@ -145,10 +163,10 @@ public int size() {
}
/**
- * Retrieves the element at the specified index
+ * Element at the given index within the current page.
*
- * @param index the index of the element to retrieve
- * @return the element at the specified index
+ * @param index the zero-based index in the page list
+ * @return the element at that index
*/
@XmlTransient
public T get(int index) {
@@ -156,38 +174,55 @@ public T get(int index) {
}
/**
- * Retrieve the scroll identifier to make it possible to continue a scrolling list query
- * @return a string containing the scroll identifier, to be sent back in an subsequent request
+ * Scroll token returned by the search backend for the next page of a scroll query.
+ *
+ * @return the scroll identifier, or {@code null} if scrolling is not in use
*/
public String getScrollIdentifier() {
return scrollIdentifier;
}
+ /**
+ * Sets the scroll token for continuing a scroll query.
+ *
+ * @param scrollIdentifier the scroll identifier
+ */
public void setScrollIdentifier(String scrollIdentifier) {
this.scrollIdentifier = scrollIdentifier;
}
/**
- * Retrieve the value of the scroll time validity to make it possible to continue a scrolling list query
- * @return a string containing a time value for the scroll validity, to be sent back in a subsequent request
+ * How long the scroll context remains valid (for example {@code 10m}).
+ *
+ * @return the scroll time validity, or {@code null} if not set
*/
public String getScrollTimeValidity() {
return scrollTimeValidity;
}
+ /**
+ * Sets how long the scroll context remains valid.
+ *
+ * @param scrollTimeValidity the validity period (for example {@code 10m})
+ */
public void setScrollTimeValidity(String scrollTimeValidity) {
this.scrollTimeValidity = scrollTimeValidity;
}
/**
- * Retrieve the relation to the total site, wether it is equal to or greater than the value stored in the
- * totalSize property.
- * @return a Relation enum value that describes the type of total size we have in this object.
+ * Whether {@link #getTotalSize()} is exact or only a lower bound.
+ *
+ * @return the total-size relation
*/
public Relation getTotalSizeRelation() {
return totalSizeRelation;
}
+ /**
+ * Sets whether the reported total size is exact or a lower bound.
+ *
+ * @param totalSizeRelation the total-size relation
+ */
public void setTotalSizeRelation(Relation totalSizeRelation) {
this.totalSizeRelation = totalSizeRelation;
}
diff --git a/api/src/main/java/org/apache/unomi/api/Patch.java b/api/src/main/java/org/apache/unomi/api/Patch.java
index b7fb457b4..1290452cf 100644
--- a/api/src/main/java/org/apache/unomi/api/Patch.java
+++ b/api/src/main/java/org/apache/unomi/api/Patch.java
@@ -29,9 +29,20 @@
import java.util.Map;
import java.util.TreeMap;
+/**
+ * Declarative update packaged as an {@link Item} and applied by {@link org.apache.unomi.api.services.PatchService}.
+ * {@link #PATCHABLE_TYPES} lists supported definition types (segments, rules, etc.).
+ * The {@link #operation} is {@code override} (replace item), {@code patch} (JSON Patch payload),
+ * or {@code remove} (delete target; no payload required).
+ */
public class Patch extends Item {
private static final long serialVersionUID = 4171966405850833985L;
+ /**
+ * A map containing the types of items that are capable of being patched.
+ * The keys represent item type names, and the values are {@link Class}
+ * objects corresponding to those patchable item types.
+ */
public final static Map> PATCHABLE_TYPES;
static {
@@ -47,6 +58,9 @@ public class Patch extends Item {
PATCHABLE_TYPES.put("scoring", Scoring.class);
}
+ /**
+ * The constant string used to identify this class as a "patch" item type.
+ */
public static final String ITEM_TYPE = "patch";
private String patchedItemId;
@@ -61,36 +75,55 @@ public class Patch extends Item {
/**
* Get the id of the item that will be concerned by this patch
+ *
* @return item id
*/
public String getPatchedItemId() {
return patchedItemId;
}
+ /**
+ * Sets the ID of the item that will be concerned by this patch.
+ *
+ * @param patchedItemId the id of the item
+ */
public void setPatchedItemId(String patchedItemId) {
this.patchedItemId = patchedItemId;
}
/**
* Get the item type of the item that will be concerned by this patch
+ *
* @return item type
*/
public String getPatchedItemType() {
return patchedItemType;
}
+ /**
+ * Sets the item type of the item that will be concerned by this patch.
+ *
+ * @param patchedItemType the item type
+ */
public void setPatchedItemType(String patchedItemType) {
this.patchedItemType = patchedItemType;
}
/**
* Get the type of patch operation : override, patch or remove
+ *
* @return operation
*/
public String getOperation() {
return operation;
}
+ /**
+ * Sets the type of patch operation to perform. This can typically be
+ * 'override', 'patch', or 'remove'.
+ *
+ * @param operation the patch operation type
+ */
public void setOperation(String operation) {
this.operation = operation;
}
@@ -100,24 +133,40 @@ public void setOperation(String operation) {
* For override operation, the data is the full item
* For patch, the data is a JsonPatch object
* For remove, no data is needed
+ *
* @return data
*/
public Object getData() {
return data;
}
+ /**
+ * Sets the data payload for the patch.
+ * For override operations, this should contain the full
+ * item representation.
+ * For patch operations, this should contain a JsonPatch object.
+ * For remove operations, no data is required.
+ *
+ * @param data the patch data
+ */
public void setData(Object data) {
this.data = data;
}
/**
* Get the date of the last patch application
+ *
* @return last application date
*/
public Date getLastApplication() {
return lastApplication;
}
+ /**
+ * Sets the date when the patch was last applied.
+ *
+ * @param lastApplication the date of the last application
+ */
public void setLastApplication(Date lastApplication) {
this.lastApplication = lastApplication;
}
diff --git a/api/src/main/java/org/apache/unomi/api/Persona.java b/api/src/main/java/org/apache/unomi/api/Persona.java
index 284ecb250..1b20cbc4c 100644
--- a/api/src/main/java/org/apache/unomi/api/Persona.java
+++ b/api/src/main/java/org/apache/unomi/api/Persona.java
@@ -23,13 +23,27 @@
*/
public class Persona extends Profile {
+ /**
+ * The fixed item type identifier used when representing a persona object.
+ */
public static final String ITEM_TYPE = "persona";
private static final long serialVersionUID = -1239061113528609426L;
+ /**
+ * Constructs a new, default {@link Persona} instance.
+ * This constructor initializes the persona without an explicit ID,
+ * allowing the item ID to potentially be set subsequently.
+ */
public Persona() {
super();
}
+ /**
+ * Constructs a new {@link Persona} instance with the
+ * specified unique identifier.
+ *
+ * @param personaId The unique ID to assign to this persona.
+ */
public Persona(String personaId) {
super(personaId);
}
diff --git a/api/src/main/java/org/apache/unomi/api/PersonaSession.java b/api/src/main/java/org/apache/unomi/api/PersonaSession.java
index 0c9373dc8..a1f29244f 100644
--- a/api/src/main/java/org/apache/unomi/api/PersonaSession.java
+++ b/api/src/main/java/org/apache/unomi/api/PersonaSession.java
@@ -20,15 +20,38 @@
import java.util.Date;
/**
- * A Persona session.
+ * A browsing session attached to a {@link Persona}.
+ * Personas are test or synthetic profiles; their sessions let marketers
+ * preview personalized content as if they were a visitor in that category.
*/
public class PersonaSession extends Session {
+ /**
+ * The constant string identifier used as the item type for
+ * {@link PersonaSession} instances.
+ */
public static final String ITEM_TYPE = "personaSession";
private static final long serialVersionUID = -1499107289607498852L;
+ /**
+ * Constructs an empty {@link PersonaSession} instance.
+ * This session must be fully configured and saved using persistence
+ * services to represent a valid persona session record.
+ */
public PersonaSession() {
}
+ /**
+ * Constructs a {@link PersonaSession} associated with a given profile,
+ * item ID, and timestamp.
+ * The resulting session is initialized with a system scope metadata.
+ *
+ * @param itemId the unique identifier for the persona session item.
+ * @param profile the {@link Profile} object representing the
+ * context of the session.
+ *
+ * @param timeStamp the date and time when this session was
+ * created or recorded.
+ */
public PersonaSession(String itemId, Profile profile, Date timeStamp) {
super(itemId, profile, timeStamp, Metadata.SYSTEM_SCOPE);
}
diff --git a/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java b/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java
index 0a507e9b1..0c6142c89 100644
--- a/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java
+++ b/api/src/main/java/org/apache/unomi/api/PersonaWithSessions.java
@@ -22,37 +22,73 @@
import java.util.List;
/**
- * A convenience object gathering a {@link Persona} and its associated {@link PersonaSession}s.
+ * Bundles a {@link Persona} with its related {@link PersonaSession} list.
+ * REST and tooling use this wrapper when returning a persona together with
+ * the sessions needed to simulate or inspect that persona.
*/
public class PersonaWithSessions implements Serializable {
private Persona persona;
private List sessions;
+ /**
+ * Default constructor.
+ */
public PersonaWithSessions() {
}
+ /**
+ * Creates a persona bundled with its sessions.
+ *
+ * @param persona the persona
+ * @param sessions related persona sessions
+ */
public PersonaWithSessions(Persona persona, List sessions) {
this.persona = persona;
this.sessions = sessions;
}
+ /**
+ * The persona being simulated or inspected.
+ *
+ * @return the persona
+ */
public Persona getPersona() {
return persona;
}
+ /**
+ * Sets the persona.
+ *
+ * @param persona the persona
+ */
public void setPersona(Persona persona) {
this.persona = persona;
}
+ /**
+ * Sessions linked to the persona.
+ *
+ * @return the persona sessions
+ */
public List getSessions() {
return sessions;
}
+ /**
+ * Sets the persona sessions.
+ *
+ * @param sessions the session list
+ */
public void setSessions(List sessions) {
this.sessions = sessions;
}
+ /**
+ * Most recent session, taken as the first element of {@link #getSessions()}.
+ *
+ * @return the latest session, or {@code null} if none exist
+ */
@XmlTransient
public PersonaSession getLastSession() {
return sessions.size()>0?sessions.get(0):null;
diff --git a/api/src/main/java/org/apache/unomi/api/PersonalizationResult.java b/api/src/main/java/org/apache/unomi/api/PersonalizationResult.java
index 15c6ab5a5..0dab6d134 100644
--- a/api/src/main/java/org/apache/unomi/api/PersonalizationResult.java
+++ b/api/src/main/java/org/apache/unomi/api/PersonalizationResult.java
@@ -25,46 +25,79 @@
import java.util.Map;
/**
- * A class to contain the result of a personalization, containing the list of content IDs as well as a changeType to
- * indicate if a profile and/or a session was modified.
+ * Outcome of a personalization request.
+ * Returns matching content ids, optional extra metadata (such as control
+ * group flags), and internal change codes when the resolved experience
+ * updated the profile or session.
*/
public class PersonalizationResult implements Serializable {
+ /**
+ * Key used in {@link #getAdditionalResultInfos()} to indicate if the
+ * personalization result was generated while running in a control group.
+ */
public final static String ADDITIONAL_RESULT_INFO_IN_CONTROL_GROUP = "inControlGroup";
+ /** Matching content identifiers for the resolved personalization. */
List contentIds;
+ /** Extra key/value metadata returned to the client (for example control group flags). */
Map additionalResultInfos = new HashMap<>();
+ /** Internal change flags when resolution updated the profile or session. */
int changeType = EventService.NO_CHANGE;
+ /**
+ * Constructs an empty PersonalizationResult with default values.
+ */
public PersonalizationResult() {
}
+ /**
+ * Constructs a PersonalizationResult initialized with a
+ * list of content IDs.
+ *
+ * @param contentIds the list of matching ids for current personalization
+ */
public PersonalizationResult(List contentIds) {
this.contentIds = contentIds;
}
/**
* List of matching ids for current personalization
+ *
* @return the list of matching ids
*/
public List getContentIds() {
return contentIds;
}
+ /**
+ * Sets the list of content IDs associated with this result.
+ * This overwrites any previously set content IDs.
+ *
+ * @param contentIds the new list of content IDs
+ */
public void setContentIds(List contentIds) {
this.contentIds = contentIds;
}
/**
* Useful open map to return additional result information to the client
+ *
* @return map of key/value pair for additional information, like: inControlGroup
*/
public Map getAdditionalResultInfos() {
return additionalResultInfos;
}
+ /**
+ * Sets the map containing additional result information. This map is useful
+ * for returning extra data to the client.
+ *
+ * @param additionalResultInfos a map of key/value pair for additional
+ * information, like: inControlGroup
+ */
public void setAdditionalResultInfos(Map additionalResultInfos) {
this.additionalResultInfos = additionalResultInfos;
}
@@ -83,6 +116,14 @@ public boolean isInControlGroup() {
(Boolean) additionalResultInfos.get(ADDITIONAL_RESULT_INFO_IN_CONTROL_GROUP);
}
+ /**
+ * Sets whether this personalization result belongs to a control group by
+ * storing the boolean value in the internal additional result info map.
+ *
+ * @param inControlGroup true if the current profile or session is in
+ * control group for the
+ * personalization, false otherwise
+ */
public void setInControlGroup(boolean inControlGroup) {
this.additionalResultInfos.put(ADDITIONAL_RESULT_INFO_IN_CONTROL_GROUP, inControlGroup);
}
@@ -98,6 +139,14 @@ public int getChangeType() {
return changeType;
}
+ /**
+ * Adds specified change flags to the current accumulated change type.
+ * This method uses bitwise OR operation to ensure that multiple changes
+ * are recorded without overwriting previous ones.
+ *
+ * @param changes The change code or flag(s) to add to the
+ * result's change type.
+ */
public void addChanges(int changes) {
this.changeType |= changes;
}
diff --git a/api/src/main/java/org/apache/unomi/api/PluginType.java b/api/src/main/java/org/apache/unomi/api/PluginType.java
index 1b75bff09..ee28d7bea 100644
--- a/api/src/main/java/org/apache/unomi/api/PluginType.java
+++ b/api/src/main/java/org/apache/unomi/api/PluginType.java
@@ -18,21 +18,24 @@
package org.apache.unomi.api;
/**
- * The interface for unomi plugins.
+ * Common contract for pluggable Unomi definition types loaded from OSGi.
+ * Implementations expose a stable id and an OSGi target filter so the runtime
+ * can locate executors and validators (for example {@link PropertyMergeStrategyType}
+ * and {@link ValueType}).
*/
public interface PluginType {
/**
- * Retrieves the plugin identifier, corresponding to the identifier of the OSGi bundle implementing the plugin.
+ * OSGi bundle id of the plugin that registered this type.
*
- * @return the plugin identifier, corresponding to the identifier of the OSGi bundle implementing the plugin
+ * @return the plugin bundle id
*/
long getPluginId();
/**
- * Associates this plugin with its associated OSGi bundle identifier.
+ * Associates this plugin type with its OSGi bundle.
*
- * @param pluginId the OSGi bundle identifier associated with this plugin
+ * @param pluginId the plugin bundle id
*/
void setPluginId(long pluginId);
diff --git a/api/src/main/java/org/apache/unomi/api/Profile.java b/api/src/main/java/org/apache/unomi/api/Profile.java
index 76d9d63c4..5a8ee35d3 100644
--- a/api/src/main/java/org/apache/unomi/api/Profile.java
+++ b/api/src/main/java/org/apache/unomi/api/Profile.java
@@ -64,13 +64,13 @@ public class Profile extends Item implements SystemPropertiesItem {
private Map consents = new LinkedHashMap<>();
/**
- * Instantiates a new Profile.
+ * Default constructor.
*/
public Profile() {
}
/**
- * Instantiates a new Profile with the specified identifier.
+ * Creates a profile with the given identifier.
*
* @param profileId the profile identifier
*/
@@ -90,20 +90,20 @@ public void setProperty(String name, Object value) {
}
/**
- * Retrieves the property identified by the specified name.
+ * Value of the named profile property.
*
- * @param name the name of the property to retrieve
- * @return the value of the specified property or {@code null} if no such property exists
+ * @param name the property name
+ * @return the property value, or {@code null} if unset
*/
public Object getProperty(String name) {
return properties.get(name);
}
/**
- * Retrieves the value of the nested property identified by the specified name.
+ * Value of a nested property, using dot-separated path segments.
*
- * @param name the name of the property to be retrieved, splited in the nested properties with "."
- * @return the value of the property identified by the specified name
+ * @param name the property path (for example {@code address.city})
+ * @return the nested value, or {@code null} if any segment is missing
*/
public Object getNestedProperty(String name) {
if (!name.contains(".")) {
@@ -124,9 +124,9 @@ public Object getNestedProperty(String name) {
}
/**
- * Retrieves a Map of all property name - value pairs for this profile.
+ * All user-visible profile properties.
*
- * @return a Map of all property name - value pairs for this profile
+ * @return the property map
*/
public Map getProperties() {
return properties;
@@ -142,10 +142,9 @@ public void setProperties(Map properties) {
}
/**
- * Retrieves a Map of system property name - value pairs for this profile. System properties can be used by implementations to store non-user visible properties needed for
- * internal purposes.
+ * Internal properties used by implementations and not shown in UIs.
*
- * @return a Map of system property name - value pairs for this profile
+ * @return the system property map
*/
public Map getSystemProperties() {
return systemProperties;
@@ -161,11 +160,11 @@ public void setSystemProperties(Map systemProperties) {
}
/**
- * Sets a system property, overwriting an existing one if it existed. This call will also created the system
- * properties hash map if it didn't exist.
- * @param key the key for the system property hash map
- * @param value the value for the system property hash map
- * @return the previous value object if it existing.
+ * Sets or replaces a system property, creating the map if needed.
+ *
+ * @param key the system property name
+ * @param value the system property value
+ * @return the previous value, or {@code null} if the key was not set
*/
public Object setSystemProperty(String key, Object value) {
if (this.systemProperties == null) {
@@ -185,9 +184,9 @@ public String getScope() {
}
/**
- * Retrieves the identifiers of the segments this profile is a member of.
+ * Segment ids this profile currently belongs to.
*
- * @return the identifiers of the segments this profile is a member of
+ * @return the segment ids
*/
public Set getSegments() {
return segments;
@@ -196,8 +195,6 @@ public Set getSegments() {
/**
* Sets the identifiers of the segments this profile is a member of.
*
- * TODO: should be removed from the API
- *
* @param segments the segments
*/
public void setSegments(Set segments) {
@@ -206,6 +203,7 @@ public void setSegments(Set segments) {
/**
* @deprecated since 2.0.0 merge mechanism is now based on profile aliases, and this property is not used anymore
+ * @return the profile id this profile was merged with, or {@code null}
*/
@Deprecated
public String getMergedWith() {
@@ -214,6 +212,7 @@ public String getMergedWith() {
/**
* @deprecated since 2.0.0 merge mechanism is now based on profile aliases, and this property is not used anymore
+ * @param mergedWith the profile id this profile was merged with
*/
@Deprecated
public void setMergedWith(String mergedWith) {
@@ -221,16 +220,17 @@ public void setMergedWith(String mergedWith) {
}
/**
- * Retrieves the scores associated to this profile.
+ * Scoring model values keyed by scoring id.
*
- * @return the scores associated to this profile as a Map of {@link Scoring} identifier - score pairs
+ * @return the score map
*/
public Map getScores() {
return scores;
}
/**
- * TODO: should be removed from the API
+ * Sets scoring model values keyed by scoring id.
+ *
* @param scores new value for scores
*/
public void setScores(Map scores) {
@@ -238,16 +238,18 @@ public void setScores(Map scores) {
}
/**
- * Returns all the consents, including the revokes ones.
- * @return a map that contains as a key the scope + "/" + consent type ID (or just the consent type ID if no scope was set on the consent), and the consent itself as a value
+ * All consents on this profile, including revoked entries.
+ *
+ * @return consent map keyed by scope/type path
*/
public Map getConsents() {
return consents;
}
/**
- * Returns true if this profile is an anonymous profile.
- * @return true of the profile has been marked as an anonymous profile, false otherwise.
+ * Whether this profile is marked anonymous via the system property {@code isAnonymousProfile}.
+ *
+ * @return {@code true} if anonymous, {@code false} otherwise
*/
@XmlTransient
public boolean isAnonymousProfile() {
@@ -256,11 +258,11 @@ public boolean isAnonymousProfile() {
}
/**
- * Set a consent into the profile.
- * @param consent if the consent is REVOKED, it will try to remove a consent with the same type id if it
- * exists for the profile.
- * @return true if the operation was successful (inserted exception in the case of a revoked consent, in which case
- * it is successful if there was a consent to revoke).
+ * Adds or removes a consent on this profile.
+ * Revoked consents remove the matching entry when present.
+ *
+ * @param consent the consent to store or revoke
+ * @return {@code true} if the operation changed stored consents
*/
@XmlTransient
public boolean setConsent(Consent consent) {
diff --git a/api/src/main/java/org/apache/unomi/api/ProfileAlias.java b/api/src/main/java/org/apache/unomi/api/ProfileAlias.java
index 1434b029d..cdfe734b1 100644
--- a/api/src/main/java/org/apache/unomi/api/ProfileAlias.java
+++ b/api/src/main/java/org/apache/unomi/api/ProfileAlias.java
@@ -19,8 +19,17 @@
import java.util.Date;
+/**
+ * Cross-application link between a client profile id and a canonical {@link Profile}.
+ * When the same visitor is known under different ids in separate scopes or apps,
+ * aliases let {@link org.apache.unomi.api.services.ProfileService} merge activity
+ * onto one persisted profile record.
+ */
public class ProfileAlias extends Item {
+ /**
+ * Item type identifier for profile aliases.
+ */
public static final String ITEM_TYPE = "profileAlias";
private String profileID;
@@ -31,37 +40,80 @@ public class ProfileAlias extends Item {
private Date modifiedTime;
+ /**
+ * Creates an empty profile alias.
+ */
public ProfileAlias() {
}
+ /**
+ * Canonical profile id linked by this alias.
+ *
+ * @return profile id
+ */
public String getProfileID() {
return profileID;
}
+ /**
+ * Sets the canonical profile id.
+ *
+ * @param profileID profile id
+ */
public void setProfileID(String profileID) {
this.profileID = profileID;
}
+ /**
+ * Client-specific profile identifier.
+ *
+ * @return client id, or {@code null} if unset
+ */
public String getClientID() {
return clientID;
}
+ /**
+ * Sets the client-specific profile identifier.
+ *
+ * @param clientID client id
+ */
public void setClientID(String clientID) {
this.clientID = clientID;
}
+ /**
+ * When this alias was created.
+ *
+ * @return creation time
+ */
public Date getCreationTime() {
return creationTime;
}
+ /**
+ * Sets the creation time.
+ *
+ * @param creationTime creation time
+ */
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
+ /**
+ * When this alias was last modified.
+ *
+ * @return last modification time, or {@code null} if unset
+ */
public Date getModifiedTime() {
return modifiedTime;
}
+ /**
+ * Sets the last modification time.
+ *
+ * @param modifiedTime last modification time
+ */
public void setModifiedTime(Date modifiedTime) {
this.modifiedTime = modifiedTime;
}
diff --git a/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyExecutor.java b/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyExecutor.java
index c7dcd0171..88400a945 100644
--- a/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyExecutor.java
+++ b/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyExecutor.java
@@ -20,7 +20,9 @@
import java.util.List;
/**
- * A strategy algorithm to merge profile properties such as "adding integers", "using oldest value", "using most recent value", "merging lists", etc...
+ * Algorithm that merges two values for the same profile property.
+ * Implementations define strategies such as keep latest, sum numbers, or
+ * union lists when events update the same field.
*/
public interface PropertyMergeStrategyExecutor {
/**
diff --git a/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyType.java b/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyType.java
index 8a2249ec1..adf6000c0 100644
--- a/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyType.java
+++ b/api/src/main/java/org/apache/unomi/api/PropertyMergeStrategyType.java
@@ -21,7 +21,9 @@
import java.io.Serializable;
/**
- * A unomi plugin that defines a new property merge strategy.
+ * Plugin declaration for a profile property merge strategy.
+ * Merge strategies decide how conflicting property values are combined when
+ * several updates apply to the same profile field (sum, latest value, etc.).
*/
public class PropertyMergeStrategyType implements PluginType, Serializable {
@@ -31,38 +33,59 @@ public class PropertyMergeStrategyType implements PluginType, Serializable {
private long pluginId;
/**
- * Retrieves the identifier for this PropertyMergeStrategyType.
+ * Merge strategy identifier.
*
- * @return the identifier for this PropertyMergeStrategyType
+ * @return the strategy id
*/
public String getId() {
return id;
}
+ /**
+ * Sets the merge strategy identifier.
+ *
+ * @param id the strategy id
+ */
public void setId(String id) {
this.id = id;
}
/**
- * Retrieves the OSGi filter used to identify the implementation associated with this PropertyMergeStrategyType. Filters take the following form:
- * {@code (propertyMergeStrategyExecutorId=<id>)} where {@code id} corresponds to the value of the {@code propertyMergeStrategyExecutorId} service property in the
- * Blueprint service definition for this PropertyMergeStrategyType.
+ * OSGi LDAP filter that locates the executor for this strategy.
+ * Format: {@code (propertyMergeStrategyExecutorId=)} where {@code id} matches the
+ * {@code propertyMergeStrategyExecutorId} service property in the Blueprint definition.
*
- * @return the filter string used to identify the implementation associated with this PropertyMergeStrategyType
+ * @return the OSGi filter string
*/
public String getFilter() {
return filter;
}
+ /**
+ * Sets the OSGi filter for locating the strategy executor.
+ *
+ * @param filter the OSGi filter string
+ */
public void setFilter(String filter) {
this.filter = filter;
}
+ /**
+ * Returns the OSGi bundle id of the plugin that registered this strategy.
+ * Used internally when resolving merge strategy implementations.
+ *
+ * @return the plugin bundle id
+ */
@XmlTransient
public long getPluginId() {
return pluginId;
}
+ /**
+ * Sets the OSGi bundle id of the plugin that registered this strategy.
+ *
+ * @param pluginId the plugin bundle id
+ */
public void setPluginId(long pluginId) {
this.pluginId = pluginId;
}
diff --git a/api/src/main/java/org/apache/unomi/api/PropertyType.java b/api/src/main/java/org/apache/unomi/api/PropertyType.java
index 090d7eec0..25b3117d8 100644
--- a/api/src/main/java/org/apache/unomi/api/PropertyType.java
+++ b/api/src/main/java/org/apache/unomi/api/PropertyType.java
@@ -26,12 +26,13 @@
import java.util.*;
/**
- * A user-defined profile or session property, specifying how possible values are constrained, if the value is multi-valued (a vector of values as opposed to a scalar value).
+ * Schema definition for a custom profile or session property.
+ * Declares value type, defaults, allowed ranges, merge strategy, and whether
+ * the property accepts multiple values.
*/
public class PropertyType extends MetadataItem {
/**
* The PropertyType ITEM_TYPE.
- *
* @see Item for a discussion of ITEM_TYPE
*/
public static final String ITEM_TYPE = "propertyType";
@@ -51,47 +52,42 @@ public class PropertyType extends MetadataItem {
private Set childPropertyTypes = new LinkedHashSet<>();
/**
- * Instantiates a new Property type.
+ * Default constructor.
*/
public PropertyType() {
}
/**
- * Instantiates a new Property type with the specified Metadata.
+ * Creates a property type with the given metadata.
*
- * @param metadata the metadata associated with the specified metadata
+ * @param metadata the property type metadata
*/
public PropertyType(Metadata metadata) {
super(metadata);
}
/**
- * Retrieves the target for this property type, indicating the type of elements this property type is defined for. For example, for property types attached to profiles, {@code
- * target} would be {@code "profiles"}.
- *
- * TODO: deprecated?
+ * Item type this property applies to (for example {@code profiles}).
*
- * @return the target for this property type
+ * @return the target item type
*/
public String getTarget() {
return target;
}
/**
- * Sets the target for this property type.
- *
- * TODO: deprecated?
+ * Sets the item type this property applies to.
*
- * @param target the target for this property type, indicating the type of elements this property type is defined for
+ * @param target the target item type
*/
public void setTarget(String target) {
this.target = target;
}
/**
- * Retrieves the identifier of the value type constraining values for properties using this PropertyType.
+ * Identifier of the {@link ValueType} that constrains property values.
*
- * @return the value type identifier associated with values defined by this PropertyType
+ * @return the value type id
* @see ValueType
*/
@XmlElement(name = "type")
@@ -102,16 +98,16 @@ public String getValueTypeId() {
/**
* Sets the value type identifier.
*
- * @param valueTypeId the value type identifier
+ * @param valueTypeId the value type id
*/
public void setValueTypeId(String valueTypeId) {
this.valueTypeId = valueTypeId;
}
/**
- * Retrieves the value type associated with values defined for properties using this PropertyType.
+ * Resolved value type definition for properties using this schema.
*
- * @return the value type associated with values defined for properties using this PropertyType
+ * @return the value type
*/
@XmlTransient
public ValueType getValueType() {
@@ -119,91 +115,88 @@ public ValueType getValueType() {
}
/**
- * Sets the value type.
+ * Sets the resolved value type definition.
*
- * @param valueType the value type associated with values defined for properties using this PropertyType
+ * @param valueType the value type
*/
public void setValueType(ValueType valueType) {
this.valueType = valueType;
}
/**
- * Retrieves the default value defined for property using this PropertyType.
+ * Default value applied when a property is created without an explicit value.
*
- * @return the default value defined for property using this PropertyType
+ * @return the default value
*/
public String getDefaultValue() {
return defaultValue;
}
/**
- * Sets the default value that properties using this PropertyType will use if no value is specified explicitly.
+ * Sets the default value for properties of this type.
*
- * @param defaultValue the default value that properties using this PropertyType will use if no value is specified explicitly
+ * @param defaultValue the default value
*/
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
/**
- * Retrieves the set of JCR properties from which properties of this type would be automatically initialized from.
+ * External property names used to auto-populate values for this type.
*
- * TODO: remove from API?
- *
- * @return the name of JCR properties properties of this type would be automatically initialized from
+ * @return the automatic mapping source names
*/
public Set getAutomaticMappingsFrom() {
return automaticMappingsFrom;
}
/**
- * Specifies the set of JCR properties from which properties of this type would be automatically initialized from.
- * TODO: remove from API?
+ * Sets the external property names used for automatic mapping.
*
- * @param automaticMappingsFrom the set of JCR properties from which properties of this type would be automatically initialized from
+ * @param automaticMappingsFrom the source property names
*/
public void setAutomaticMappingsFrom(Set automaticMappingsFrom) {
this.automaticMappingsFrom = automaticMappingsFrom;
}
/**
- * Retrieves the rank of this PropertyType for ordering purpose.
+ * Relative ordering weight when multiple property types are shown together.
*
- * @return the rank of this PropertyType for ordering purpose
+ * @return the rank
*/
public Double getRank() {
return rank;
}
/**
- * Specifies the rank of this PropertyType for ordering purpose.
+ * Sets the display ordering rank.
*
- * @param rank the rank of this PropertyType for ordering purpose
+ * @param rank the rank
*/
public void setRank(Double rank) {
this.rank = rank;
}
/**
- * Retrieves the identifier of the {@link PropertyMergeStrategyType} to be used in case profiles with properties using this PropertyType are being merged.
+ * Merge strategy id used when profiles with this property are merged.
*
- * @return the identifier of the {@link PropertyMergeStrategyType} to be used in case profiles with properties using this PropertyType are being merged
+ * @return the merge strategy id
*/
public String getMergeStrategy() {
return mergeStrategy;
}
/**
- * Sets the identifier of the {@link PropertyMergeStrategyType} to be used in case profiles with properties using this PropertyType are being merged
+ * Sets the merge strategy id for profile merges.
*
- * @param mergeStrategy the identifier of the {@link PropertyMergeStrategyType} to be used in case profiles with properties using this PropertyType are being merged
+ * @param mergeStrategy the merge strategy id
*/
public void setMergeStrategy(String mergeStrategy) {
this.mergeStrategy = mergeStrategy;
}
/**
- * Retrieves the date ranges.
+ * Allowed date ranges for values of this type.
*
* @return the date ranges
*/
@@ -212,7 +205,7 @@ public List getDateRanges() {
}
/**
- * Sets the date ranges.
+ * Sets the allowed date ranges.
*
* @param dateRanges the date ranges
*/
@@ -221,7 +214,7 @@ public void setDateRanges(List dateRanges) {
}
/**
- * Retrieves the numeric ranges.
+ * Allowed numeric ranges for values of this type.
*
* @return the numeric ranges
*/
@@ -230,7 +223,7 @@ public List getNumericRanges() {
}
/**
- * Sets the numeric ranges.
+ * Sets the allowed numeric ranges.
*
* @param numericRanges the numeric ranges
*/
@@ -239,18 +232,18 @@ public void setNumericRanges(List numericRanges) {
}
/**
- * Retrieves the ip ranges.
+ * Allowed IP ranges for values of this type.
*
- * @return the ip ranges
+ * @return the IP ranges
*/
public List getIpRanges() {
return ipRanges;
}
/**
- * Sets the ip ranges.
+ * Sets the allowed IP ranges.
*
- * @param ipRanges the ip ranges
+ * @param ipRanges the IP ranges
*/
public void setIpRanges(List ipRanges) {
this.ipRanges = ipRanges;
@@ -276,8 +269,7 @@ public void setMultivalued(Boolean multivalued) {
/**
* Whether properties with this type are marked as protected. Protected properties can be displayed but their value cannot be changed.
- *
- * TODO: rename to readOnly?
+ * The {@code protected} flag name may change to {@code readOnly} in a future release.
*
* @return {@code true} if properties of this type are protected, {@code false} otherwise
*/
@@ -294,10 +286,20 @@ public void setProtected(boolean protekted) {
this.protekted = protekted;
}
+ /**
+ * Nested property types that extend this schema.
+ *
+ * @return the child property types
+ */
public Set getChildPropertyTypes() {
return childPropertyTypes;
}
+ /**
+ * Sets the nested child property types.
+ *
+ * @param childPropertyTypes the child property types
+ */
public void setChildPropertyTypes(Set childPropertyTypes) {
this.childPropertyTypes = childPropertyTypes;
}
diff --git a/api/src/main/java/org/apache/unomi/api/Scope.java b/api/src/main/java/org/apache/unomi/api/Scope.java
index a8fa35137..110b0b9a0 100644
--- a/api/src/main/java/org/apache/unomi/api/Scope.java
+++ b/api/src/main/java/org/apache/unomi/api/Scope.java
@@ -18,7 +18,9 @@
package org.apache.unomi.api;
/**
- * Object representing a scope.
+ * Named isolation boundary for context data in Unomi.
+ * Profiles, sessions, events, and definitions belong to a scope (often a
+ * site or application) so data from one digital property does not mix with another.
*/
public class Scope extends MetadataItem {
@@ -30,7 +32,7 @@ public class Scope extends MetadataItem {
public static final String ITEM_TYPE = "scope";
/**
- * Instantiates a new Scope.
+ * Default constructor.
*/
public Scope() {
}
diff --git a/api/src/main/java/org/apache/unomi/api/ServerInfo.java b/api/src/main/java/org/apache/unomi/api/ServerInfo.java
index 7b80f9487..dd0a46d00 100644
--- a/api/src/main/java/org/apache/unomi/api/ServerInfo.java
+++ b/api/src/main/java/org/apache/unomi/api/ServerInfo.java
@@ -23,7 +23,10 @@
import java.util.Map;
/**
- * Basic information about a Unomi server
+ * Capability and build information exposed by a running Unomi node.
+ * Populated at startup and returned by health and cluster APIs so clients,
+ * operators, and other nodes can read version, build metadata, supported
+ * {@link EventInfo} types, optional capability flags, and banner logo lines.
*/
public class ServerInfo {
@@ -39,77 +42,170 @@ public class ServerInfo {
private List logoLines = new ArrayList<>();
+ /**
+ * Creates an empty server info record.
+ */
public ServerInfo() {
}
+ /**
+ * Unique identifier for this server instance.
+ *
+ * @return server identifier
+ */
public String getServerIdentifier() {
return serverIdentifier;
}
+ /**
+ * Sets the server identifier.
+ *
+ * @param serverIdentifier server identifier
+ */
public void setServerIdentifier(String serverIdentifier) {
this.serverIdentifier = serverIdentifier;
}
+ /**
+ * Running Unomi version string.
+ *
+ * @return server version
+ */
public String getServerVersion() {
return serverVersion;
}
+ /**
+ * Sets the server version.
+ *
+ * @param serverVersion server version
+ */
public void setServerVersion(String serverVersion) {
this.serverVersion = serverVersion;
}
+ /**
+ * Build number of this server distribution.
+ *
+ * @return build number
+ */
public String getServerBuildNumber() {
return serverBuildNumber;
}
+ /**
+ * Sets the build number.
+ *
+ * @param serverBuildNumber build number
+ */
public void setServerBuildNumber(String serverBuildNumber) {
this.serverBuildNumber = serverBuildNumber;
}
+ /**
+ * When this server build was produced.
+ *
+ * @return build date
+ */
public Date getServerBuildDate() {
return serverBuildDate;
}
+ /**
+ * Sets the build date.
+ *
+ * @param serverBuildDate build date
+ */
public void setServerBuildDate(Date serverBuildDate) {
this.serverBuildDate = serverBuildDate;
}
+ /**
+ * Server timestamp string (for example {@code YYYYMMDDHHmmss}).
+ *
+ * @return server timestamp
+ */
public String getServerTimestamp() {
return serverTimestamp;
}
+ /**
+ * Sets the server timestamp.
+ *
+ * @param serverTimestamp server timestamp
+ */
public void setServerTimestamp(String serverTimestamp) {
this.serverTimestamp = serverTimestamp;
}
+ /**
+ * Source control branch this build came from.
+ *
+ * @return SCM branch name
+ */
public String getServerScmBranch() {
return serverScmBranch;
}
+ /**
+ * Sets the SCM branch name.
+ *
+ * @param serverScmBranch SCM branch name
+ */
public void setServerScmBranch(String serverScmBranch) {
this.serverScmBranch = serverScmBranch;
}
+ /**
+ * Event types this server instance supports, with occurrence counts.
+ *
+ * @return supported event types
+ */
public List getEventTypes() {
return eventTypes;
}
+ /**
+ * Sets the supported event types.
+ *
+ * @param eventTypes event types
+ */
public void setEventTypes(List eventTypes) {
this.eventTypes = eventTypes;
}
+ /**
+ * Optional capability flags reported by the server.
+ *
+ * @return map of capability name to description
+ */
public Map getCapabilities() {
return capabilities;
}
+ /**
+ * Sets the capability map.
+ *
+ * @param capabilities capability name to description
+ */
public void setCapabilities(Map capabilities) {
this.capabilities = capabilities;
}
+ /**
+ * ASCII art lines shown in the server logo banner.
+ *
+ * @return logo lines
+ */
public List getLogoLines() {
return logoLines;
}
+ /**
+ * Sets the logo banner lines.
+ *
+ * @param logoLines logo lines
+ */
public void setLogoLines(List logoLines) {
this.logoLines = logoLines;
}
diff --git a/api/src/main/java/org/apache/unomi/api/Session.java b/api/src/main/java/org/apache/unomi/api/Session.java
index 8ca067720..ad986b931 100644
--- a/api/src/main/java/org/apache/unomi/api/Session.java
+++ b/api/src/main/java/org/apache/unomi/api/Session.java
@@ -58,18 +58,18 @@ public class Session extends Item implements TimestampedItem, SystemPropertiesIt
private List originEventIds = new ArrayList<>();
/**
- * Instantiates a new Session.
+ * Default constructor.
*/
public Session() {
}
/**
- * Instantiates a new Session.
+ * Creates a session linked to a profile, timestamp, and scope.
*
- * @param itemId the identifier for this Session
- * @param profile the associated {@link Profile}
- * @param timeStamp the time stamp
- * @param scope the scope
+ * @param itemId the session identifier
+ * @param profile the associated profile
+ * @param timeStamp the session start time
+ * @param scope the session scope
*/
public Session(String itemId, Profile profile, Date timeStamp, String scope) {
super(itemId);
@@ -80,18 +80,18 @@ public Session(String itemId, Profile profile, Date timeStamp, String scope) {
}
/**
- * Retrieves the identifier of the associated Profile.
+ * Identifier of the profile linked to this session.
*
- * @return the identifier of the associated Profile
+ * @return the profile id
*/
public String getProfileId() {
return profileId;
}
/**
- * Retrieves the associated Profile.
+ * Profile associated with this session.
*
- * @return the associated profile
+ * @return the profile
*/
public Profile getProfile() {
return profile;
@@ -119,19 +119,19 @@ public void setProperty(String name, Object value) {
}
/**
- * Retrieves the property identified by the specified name.
+ * Value of the named session property.
*
- * @param name the name of the property to retrieve
- * @return the value of the specified property or {@code null} if no such property exists
+ * @param name the property name
+ * @return the property value, or {@code null} if unset
*/
public Object getProperty(String name) {
return properties.get(name);
}
/**
- * Retrieves a Map of all property name - value pairs.
+ * All user-visible session properties.
*
- * @return a Map of all property name - value pairs
+ * @return the property map
*/
public Map getProperties() {
return properties;
@@ -147,10 +147,9 @@ public void setProperties(Map properties) {
}
/**
- * 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.
+ * Internal properties used by implementations and not shown in UIs.
*
- * @return a Map of system property name - value pairs
+ * @return the system property map
*/
public Map getSystemProperties() {
return systemProperties;
@@ -166,16 +165,16 @@ public void setSystemProperties(Map systemProperties) {
}
/**
- * Retrieves the session creation timestamp.
+ * When this session was created.
*
- * @return the session creation timestamp
+ * @return the creation timestamp
*/
public Date getTimeStamp() {
return timeStamp;
}
/**
- * Retrieves the last event date.
+ * Timestamp of the most recent event in this session.
*
* @return the last event date
*/
@@ -196,18 +195,18 @@ public void setLastEventDate(Date lastEventDate) {
}
/**
- * Retrieves the duration.
+ * Elapsed time between session start and last event, in milliseconds.
*
- * @return the duration
+ * @return the session duration
*/
public int getDuration() {
return duration;
}
/**
- * Retrieves the size.
+ * Number of events recorded in this session.
*
- * @return the size
+ * @return the event count
*/
public int getSize() {
return size;
@@ -222,45 +221,55 @@ public void setSize(int size) {
this.size = size;
}
+ /**
+ * Scope this session belongs to.
+ *
+ * @return the scope id
+ */
public String getScope() {
return scope;
}
+ /**
+ * Sets the scope this session belongs to.
+ *
+ * @param scope the session scope identifier
+ */
public void setScope(String scope) {
this.scope = scope;
}
/**
- * Get the events types which causes the session creation
+ * Event types that triggered session creation.
*
- * @return List of event types
+ * @return the origin event types
*/
public List getOriginEventTypes() {
return originEventTypes;
}
/**
- * Set the events types which causes the session creation
+ * Sets the event types that triggered session creation.
*
- * @param originEventTypes List of event types
+ * @param originEventTypes the origin event types
*/
public void setOriginEventTypes(List originEventTypes) {
this.originEventTypes = originEventTypes;
}
/**
- * Get the events ids which causes the session creation
+ * Event ids that triggered session creation.
*
- * @return event ids
+ * @return the origin event ids
*/
public List getOriginEventIds() {
return originEventIds;
}
/**
- * Set the events ids which causes the session creation
+ * Sets the event ids that triggered session creation.
*
- * @param originEventIds List of event ids
+ * @param originEventIds the origin event ids
*/
public void setOriginEventIds(List originEventIds) {
this.originEventIds = originEventIds;
diff --git a/api/src/main/java/org/apache/unomi/api/SystemPropertiesItem.java b/api/src/main/java/org/apache/unomi/api/SystemPropertiesItem.java
index e191562cc..45786d5aa 100644
--- a/api/src/main/java/org/apache/unomi/api/SystemPropertiesItem.java
+++ b/api/src/main/java/org/apache/unomi/api/SystemPropertiesItem.java
@@ -19,7 +19,9 @@
import java.util.Map;
/**
- * An Item that is holding system properties.
+ * {@link Item} that stores system-level properties in a map.
+ * System properties are internal or cross-cutting values kept separately
+ * from visitor profile properties.
*/
public interface SystemPropertiesItem {
diff --git a/api/src/main/java/org/apache/unomi/api/TimestampedItem.java b/api/src/main/java/org/apache/unomi/api/TimestampedItem.java
index 0a0799a15..a552e5ee5 100644
--- a/api/src/main/java/org/apache/unomi/api/TimestampedItem.java
+++ b/api/src/main/java/org/apache/unomi/api/TimestampedItem.java
@@ -20,13 +20,15 @@
import java.util.Date;
/**
- * A context-server entity that is timestamped.
+ * {@link Item} that records when it was created or last modified.
+ * Event and profile-like types implement this interface so retention,
+ * ordering, and auditing can use consistent timestamps.
*/
public interface TimestampedItem {
/**
- * Retrieves the associated timestamp.
+ * Creation or last-modification timestamp for timestamped items.
*
- * @return the associated timestamp
+ * @return the timestamp
*/
Date getTimeStamp();
}
diff --git a/api/src/main/java/org/apache/unomi/api/Topic.java b/api/src/main/java/org/apache/unomi/api/Topic.java
index 03d789d38..01843ad7b 100644
--- a/api/src/main/java/org/apache/unomi/api/Topic.java
+++ b/api/src/main/java/org/apache/unomi/api/Topic.java
@@ -16,26 +16,52 @@
*/
package org.apache.unomi.api;
+/**
+ * Named category tag stored as an {@link Item}.
+ * Topics group configuration or content entities so administrators can
+ * organize and search related objects across the context server.
+ */
public class Topic extends Item {
+ /** Defines the item type string used for Topic entities. */
public static final String ITEM_TYPE = "topic";
private String topicId;
private String name;
+ /**
+ * Topic identifier.
+ *
+ * @return the topic id
+ */
public String getTopicId() {
return topicId;
}
+ /**
+ * Sets the topic identifier.
+ *
+ * @param topicId the topic id
+ */
public void setTopicId(String topicId) {
this.topicId = topicId;
}
+ /**
+ * Display name of the topic.
+ *
+ * @return the topic name
+ */
public String getName() {
return name;
}
+ /**
+ * Sets the display name.
+ *
+ * @param name the topic name
+ */
public void setName(String name) {
this.name = name;
}
diff --git a/api/src/main/java/org/apache/unomi/api/ValueType.java b/api/src/main/java/org/apache/unomi/api/ValueType.java
index d470a694b..95aff9dbc 100644
--- a/api/src/main/java/org/apache/unomi/api/ValueType.java
+++ b/api/src/main/java/org/apache/unomi/api/ValueType.java
@@ -23,7 +23,9 @@
import java.util.Set;
/**
- * A value type to be used to constrain property values.
+ * Definition of allowed values for a {@link PropertyType}.
+ * Value types describe validation rules, ranges, and serializers so profile
+ * and session properties stay consistent with their schema.
*/
public class ValueType implements PluginType, Serializable {
@@ -34,42 +36,43 @@ public class ValueType implements PluginType, Serializable {
private Set tags = new LinkedHashSet<>();
/**
- * Instantiates a new Value type.
+ * Default constructor.
*/
public ValueType() {
}
/**
- * Instantiates a new Value type with the specified identifier.
+ * Creates a value type with the given identifier.
*
- * @param id the identifier
+ * @param id the value type id
*/
public ValueType(String id) {
this.id = id;
}
/**
- * Retrieves this ValueType's identifier.
+ * Value type identifier.
*
- * @return this ValueType's identifier
+ * @return the value type id
*/
public String getId() {
return id;
}
/**
- * Sets this ValueType's identifier.
+ * Sets the value type identifier.
*
- * @param id this ValueType's identifier
+ * @param id the value type id
*/
public void setId(String id) {
this.id = id;
}
/**
- * Retrieves the {@link java.util.ResourceBundle} key used to localize this ValueType's name.
+ * Resource bundle key for localizing the display name.
+ * Defaults to {@code type.} when unset.
*
- * @return the {@link java.util.ResourceBundle} key used to localize this ValueType's name
+ * @return the name localization key
*/
public String getNameKey() {
if (nameKey == null) {
@@ -79,18 +82,19 @@ public String getNameKey() {
}
/**
- * Sets the name key.
+ * Sets the name localization key.
*
- * @param nameKey the name key
+ * @param nameKey the resource bundle key
*/
public void setNameKey(String nameKey) {
this.nameKey = nameKey;
}
/**
- * Retrieves the {@link java.util.ResourceBundle} key used to localize this ValueType's description.
+ * Resource bundle key for localizing the description.
+ * Defaults to {@code type..description} when unset.
*
- * @return the {@link java.util.ResourceBundle} key used to localize this ValueType's name
+ * @return the description localization key
*/
public String getDescriptionKey() {
if (descriptionKey == null) {
@@ -100,36 +104,44 @@ public String getDescriptionKey() {
}
/**
- * Sets the description key.
+ * Sets the description localization key.
*
- * @param descriptionKey the description key
+ * @param descriptionKey the resource bundle key
*/
public void setDescriptionKey(String descriptionKey) {
this.descriptionKey = descriptionKey;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
@XmlTransient
public long getPluginId() {
return pluginId;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setPluginId(long pluginId) {
this.pluginId = pluginId;
}
/**
- * Retrieves the tags used by this ValueType.
+ * Tags associated with this value type.
*
- * @return the tags used by this ValueType
+ * @return the tag names
*/
public Set getTags() {
return tags;
}
/**
- * Sets the tags used by this ValueType.
+ * Sets the tags for this value type.
*
- * @param tags the tags used by this ValueType
+ * @param tags the tag names
*/
public void setTags(Set tags) {
this.tags = tags;
diff --git a/api/src/main/java/org/apache/unomi/api/actions/Action.java b/api/src/main/java/org/apache/unomi/api/actions/Action.java
index aeaba1bc6..7d10fe5d7 100644
--- a/api/src/main/java/org/apache/unomi/api/actions/Action.java
+++ b/api/src/main/java/org/apache/unomi/api/actions/Action.java
@@ -42,13 +42,13 @@ public class Action implements Serializable, YamlConvertible {
private Map parameterValues = new HashMap<>();
/**
- * Instantiates a new Action.
+ * Default constructor.
*/
public Action() {
}
/**
- * Instantiates a new Action with the specified {@link ActionType}
+ * Creates an action with the given action type
*
* @param actionType the action's type
*/
@@ -57,7 +57,7 @@ public Action(ActionType actionType) {
}
/**
- * Retrieves the action's type.
+ * Action type for this action.
*
* @return the action's type
*/
@@ -77,7 +77,7 @@ public void setActionType(ActionType actionType) {
}
/**
- * Retrieves the identifier of the associated action type.
+ * Identifier of the associated action type.
*
* @return the identifier of the associated action type
*/
@@ -96,7 +96,7 @@ public void setActionTypeId(String actionTypeId) {
}
/**
- * Retrieves the parameter values as a Map of parameter name - associated value pairs.
+ * Parameter values keyed by parameter name.
*
* @return a Map of parameter name - associated value pairs
*/
@@ -105,7 +105,7 @@ public Map getParameterValues() {
}
/**
- * Sets the parameter values as a Map of parameter name - associated value pairs.
+ * Sets parameter values keyed by parameter name.
*
* @param parameterValues the parameter values as a Map of parameter name - associated value pairs
*/
@@ -129,6 +129,7 @@ public void setParameter(String name, Object value) {
* Implements YamlConvertible interface with circular reference detection.
*
* @param visited set of already visited objects to prevent infinite recursion (may be null)
+ * @param maxDepth maximum recursion depth to prevent stack overflow
* @return a Map representation of this action
*/
@Override
diff --git a/api/src/main/java/org/apache/unomi/api/actions/ActionExecutor.java b/api/src/main/java/org/apache/unomi/api/actions/ActionExecutor.java
index 6f33b9e02..4941df8bf 100644
--- a/api/src/main/java/org/apache/unomi/api/actions/ActionExecutor.java
+++ b/api/src/main/java/org/apache/unomi/api/actions/ActionExecutor.java
@@ -21,7 +21,9 @@
import org.apache.unomi.api.services.EventService;
/**
- * A piece of code that performs a specified {@link Action}, given a triggering {@link Event}
+ * Runtime implementation of an {@link org.apache.unomi.api.actions.Action}.
+ * When a rule fires, executors perform the configured action (send email,
+ * set property, etc.) for the triggering {@link Event}.
*/
public interface ActionExecutor {
diff --git a/api/src/main/java/org/apache/unomi/api/actions/ActionPostExecutor.java b/api/src/main/java/org/apache/unomi/api/actions/ActionPostExecutor.java
index e80d6cd95..923ba31cc 100644
--- a/api/src/main/java/org/apache/unomi/api/actions/ActionPostExecutor.java
+++ b/api/src/main/java/org/apache/unomi/api/actions/ActionPostExecutor.java
@@ -20,7 +20,9 @@
import org.apache.unomi.api.rules.Rule;
/**
- * An action to be executed after all {@link Rule}-derived have been processed.
+ * Hook executed after all rule actions for an event have run.
+ * Use post-executors for cleanup, logging, or follow-up work that must
+ * happen once per event after the main action chain completes.
*/
public interface ActionPostExecutor {
/**
diff --git a/api/src/main/java/org/apache/unomi/api/actions/ActionType.java b/api/src/main/java/org/apache/unomi/api/actions/ActionType.java
index bf6fb477a..501dafd97 100644
--- a/api/src/main/java/org/apache/unomi/api/actions/ActionType.java
+++ b/api/src/main/java/org/apache/unomi/api/actions/ActionType.java
@@ -31,7 +31,9 @@
import static org.apache.unomi.api.utils.YamlUtils.toYamlValue;
/**
- * A type definition for {@link Action}s.
+ * Declarative definition of an action that rules can trigger.
+ * Action types describe parameters and point to the {@link ActionExecutor}
+ * implementation that performs the work at runtime.
*/
public class ActionType extends MetadataItem implements PluginType, YamlConvertible {
/** Item type identifier for action types. */
@@ -43,50 +45,51 @@ public class ActionType extends MetadataItem implements PluginType, YamlConverti
private long pluginId;
/**
- * Instantiates a new Action type.
+ * Default constructor.
*/
public ActionType() {
}
/**
- * Instantiates a new Action type.
- * @param metadata the metadata
+ * Creates an action type with the given metadata.
+ *
+ * @param metadata the action type metadata
*/
public ActionType(Metadata metadata) {
super(metadata);
}
/**
- * Retrieves the action executor.
+ * OSGi executor id that runs this action at runtime.
*
- * @return the action executor
+ * @return the action executor id
*/
public String getActionExecutor() {
return actionExecutor;
}
/**
- * Sets the action executor.
+ * Sets the action executor id.
*
- * @param actionExecutor the action executor
+ * @param actionExecutor the executor id
*/
public void setActionExecutor(String actionExecutor) {
this.actionExecutor = actionExecutor;
}
/**
- * Retrieves the parameters.
+ * Parameters accepted by this action type.
*
- * @return the parameters
+ * @return the parameter definitions
*/
public List getParameters() {
return parameters;
}
/**
- * Sets the parameters.
+ * Sets the parameter definitions.
*
- * @param parameters the parameters
+ * @param parameters the parameter list
*/
public void setParameters(List parameters) {
this.parameters = parameters;
diff --git a/api/src/main/java/org/apache/unomi/api/campaigns/Campaign.java b/api/src/main/java/org/apache/unomi/api/campaigns/Campaign.java
index c932475c0..f28789738 100644
--- a/api/src/main/java/org/apache/unomi/api/campaigns/Campaign.java
+++ b/api/src/main/java/org/apache/unomi/api/campaigns/Campaign.java
@@ -26,7 +26,9 @@
import java.util.Date;
/**
- * A goal-oriented, time-limited marketing operation that needs to be evaluated for return on investment performance by tracking the ratio of visits to conversions.
+ * Time-bounded marketing program built around {@link org.apache.unomi.api.goals.Goal}s.
+ * Campaigns track entry conditions, duration, and conversion metrics so teams
+ * can measure ROI for a specific promotion or experiment.
*/
public class Campaign extends MetadataItem {
/**
@@ -51,22 +53,22 @@ public class Campaign extends MetadataItem {
private String timezone;
/**
- * Instantiates a new Campaign.
+ * Default constructor.
*/
public Campaign() {
}
/**
- * Instantiates a new Campaign with the specified metadata.
+ * Creates a campaign with the given metadata.
*
- * @param metadata the metadata
+ * @param metadata the campaign metadata
*/
public Campaign(Metadata metadata) {
super(metadata);
}
/**
- * Retrieves the start date for this Campaign.
+ * When the campaign becomes active.
*
* @return the start date
*/
@@ -75,7 +77,7 @@ public Date getStartDate() {
}
/**
- * Sets the start date for this Campaign.
+ * Sets the campaign start date.
*
* @param startDate the start date
*/
@@ -84,7 +86,7 @@ public void setStartDate(Date startDate) {
}
/**
- * Retrieves the end date for this Campaign.
+ * When the campaign stops being active.
*
* @return the end date
*/
@@ -93,7 +95,7 @@ public Date getEndDate() {
}
/**
- * Sets the end date for this Campaign.
+ * Sets the campaign end date.
*
* @param endDate the end date
*/
@@ -102,90 +104,90 @@ public void setEndDate(Date endDate) {
}
/**
- * Retrieves the entry condition that must be satisfied for users to be considered as taking part of this Campaign.
+ * Condition a profile must satisfy to enter the campaign.
*
- * @return the entry condition that must be satisfied for users to be considered as taking part of this Campaign
+ * @return the entry condition
*/
public Condition getEntryCondition() {
return entryCondition;
}
/**
- * Sets the entry condition that must be satisfied for users to be considered as taking part of this Campaign..
+ * Sets the campaign entry condition.
*
- * @param entryCondition the entry condition that must be satisfied for users to be considered as taking part of this Campaign
+ * @param entryCondition the entry condition
*/
public void setEntryCondition(Condition entryCondition) {
this.entryCondition = entryCondition;
}
/**
- * Retrieves the cost incurred by this Campaign.
+ * Reported cost of running this campaign.
*
- * @return the cost incurred by this Campaign
+ * @return the campaign cost
*/
public Double getCost() {
return cost;
}
/**
- * Sets the cost incurred by this Campaign.
+ * Sets the campaign cost.
*
- * @param cost the cost incurred by this Campaign
+ * @param cost the campaign cost
*/
public void setCost(Double cost) {
this.cost = cost;
}
/**
- * Retrieves the currency associated to the Campaign's cost.
+ * Currency code for {@link #getCost()}.
*
- * @return the currency associated to the Campaign's cost
+ * @return the currency code
*/
public String getCurrency() {
return currency;
}
/**
- * Sets the currency associated to the Campaign's cost.
+ * Sets the currency code for the campaign cost.
*
- * @param currency the currency associated to the Campaign's cost
+ * @param currency the currency code
*/
public void setCurrency(String currency) {
this.currency = currency;
}
/**
- * Retrieves the identifier for this Campaign's primary {@link Goal}.
+ * Identifier of the primary goal tracked for this campaign.
*
- * @return the identifier for this Campaign's primary {@link Goal}
+ * @return the primary goal id
*/
public String getPrimaryGoal() {
return primaryGoal;
}
/**
- * Sets the identifier for this Campaign's primary {@link Goal}.
+ * Sets the primary goal id for this campaign.
*
- * @param primaryGoal the identifier for this Campaign's primary {@link Goal}
+ * @param primaryGoal the primary goal id
*/
public void setPrimaryGoal(String primaryGoal) {
this.primaryGoal = primaryGoal;
}
/**
- * Retrieves the timezone associated with this Campaign's start and end dates.
+ * Time zone used to interpret {@link #getStartDate()} and {@link #getEndDate()}.
*
- * @return the timezone associated with this Campaign's start and end dates
+ * @return the time zone id
*/
public String getTimezone() {
return timezone;
}
/**
- * Sets the timezone associated with this Campaign's start and end dates.
+ * Sets the time zone for campaign start and end dates.
*
- * @param timezone the timezone associated with this Campaign's start and end dates
+ * @param timezone the time zone id
*/
public void setTimezone(String timezone) {
this.timezone = timezone;
diff --git a/api/src/main/java/org/apache/unomi/api/campaigns/CampaignDetail.java b/api/src/main/java/org/apache/unomi/api/campaigns/CampaignDetail.java
index db35100a8..164fec4ef 100644
--- a/api/src/main/java/org/apache/unomi/api/campaigns/CampaignDetail.java
+++ b/api/src/main/java/org/apache/unomi/api/campaigns/CampaignDetail.java
@@ -18,9 +18,10 @@
package org.apache.unomi.api.campaigns;
/**
- * Details about a {@link Campaign}.
- *
- * Created by kevan on 03/06/15.
+ * Live campaign performance snapshot built from profiles, sessions, and goals.
+ * Counts engaged profiles, session views and successes, linked goals, and an
+ * overall conversion rate. {@link org.apache.unomi.api.services.GoalsService} and campaign REST endpoints
+ * return this object for campaign dashboards.
*/
public class CampaignDetail {
private long engagedProfiles = 0;
@@ -31,52 +32,52 @@ public class CampaignDetail {
private Campaign campaign;
/**
- * Instantiates a new Campaign detail.
+ * Creates campaign performance details for the given campaign.
*
- * @param campaign the campaign
+ * @param campaign the campaign being reported on
*/
public CampaignDetail(Campaign campaign) {
this.campaign = campaign;
}
/**
- * Retrieves the number of engaged profiles.
+ * Number of profiles that engaged with the campaign.
*
- * @return the number of engaged profiles
+ * @return the engaged profile count
*/
public long getEngagedProfiles() {
return engagedProfiles;
}
/**
- * Sets the number of engaged profiles.
+ * Sets the engaged profile count.
*
- * @param engagedProfiles the number of engaged profiles
+ * @param engagedProfiles the engaged profile count
*/
public void setEngagedProfiles(long engagedProfiles) {
this.engagedProfiles = engagedProfiles;
}
/**
- * Retrieves the number of goals.
+ * Number of goals linked to the campaign.
*
- * @return the number of goals
+ * @return the goal count
*/
public long getNumberOfGoals() {
return numberOfGoals;
}
/**
- * Sets the number of goals.
+ * Sets the goal count.
*
- * @param numberOfGoals the number of goals
+ * @param numberOfGoals the goal count
*/
public void setNumberOfGoals(long numberOfGoals) {
this.numberOfGoals = numberOfGoals;
}
/**
- * Retrieves the conversion rate.
+ * Overall conversion rate for the campaign.
*
* @return the conversion rate
*/
@@ -94,16 +95,16 @@ public void setConversionRate(double conversionRate) {
}
/**
- * Retrieves the associated campaign.
+ * Campaign these metrics describe.
*
- * @return the associated campaign
+ * @return the campaign
*/
public Campaign getCampaign() {
return campaign;
}
/**
- * Sets the associated campaign.
+ * Sets the campaign reference.
*
* @param campaign the campaign
*/
@@ -112,36 +113,36 @@ public void setCampaign(Campaign campaign) {
}
/**
- * Retrieves the number of campaign session views.
+ * Number of campaign sessions that recorded a view.
*
- * @return the number of campaign session views
+ * @return the session view count
*/
public long getCampaignSessionViews() {
return campaignSessionViews;
}
/**
- * Sets the number of campaign session views.
+ * Sets the campaign session view count.
*
- * @param campaignSessionViews the number of campaign session views
+ * @param campaignSessionViews the session view count
*/
public void setCampaignSessionViews(long campaignSessionViews) {
this.campaignSessionViews = campaignSessionViews;
}
/**
- * Retrieves the number of campaign session successes.
+ * Number of campaign sessions that reached a success state.
*
- * @return the number of campaign session successes
+ * @return the session success count
*/
public long getCampaignSessionSuccess() {
return campaignSessionSuccess;
}
/**
- * Sets the number of campaign session successes.
+ * Sets the campaign session success count.
*
- * @param campaignSessionSuccess the number of campaign session successes
+ * @param campaignSessionSuccess the session success count
*/
public void setCampaignSessionSuccess(long campaignSessionSuccess) {
this.campaignSessionSuccess = campaignSessionSuccess;
diff --git a/api/src/main/java/org/apache/unomi/api/campaigns/events/CampaignEvent.java b/api/src/main/java/org/apache/unomi/api/campaigns/events/CampaignEvent.java
index 3591cec45..b3a1d055b 100644
--- a/api/src/main/java/org/apache/unomi/api/campaigns/events/CampaignEvent.java
+++ b/api/src/main/java/org/apache/unomi/api/campaigns/events/CampaignEvent.java
@@ -25,9 +25,7 @@
import java.util.Date;
/**
- * A specific campaign event to help analyzing your key performance indicators by marking specific dates during your campaign.
- *
- * @author : rincevent Created : 17/03/15
+ * A campaign milestone event used to mark dates and costs during a campaign for KPI analysis.
*/
public class CampaignEvent extends MetadataItem {
/**
@@ -44,13 +42,13 @@ public class CampaignEvent extends MetadataItem {
private String timezone;
/**
- * Instantiates a new Campaign event.
+ * Default constructor.
*/
public CampaignEvent() {
}
/**
- * Instantiates a new Campaign event with the specified metadata.
+ * Creates a campaign event with the given metadata.
*
* @param metadata the metadata
*/
@@ -59,9 +57,9 @@ public CampaignEvent(Metadata metadata) {
}
/**
- * Retrieves the cost associated with this campaign event.
+ * Cost associated with this campaign event.
*
- * @return the cost associated with this campaign event
+ * @return the event cost
*/
public Double getCost() {
return cost;
@@ -77,9 +75,9 @@ public void setCost(Double cost) {
}
/**
- * Retrieves the currency.
+ * Currency code for the event cost.
*
- * @return the currency
+ * @return the currency code
*/
public String getCurrency() {
return currency;
@@ -95,7 +93,7 @@ public void setCurrency(String currency) {
}
/**
- * Retrieves the event date.
+ * Date when this campaign event occurred.
*
* @return the event date
*/
@@ -113,9 +111,9 @@ public void setEventDate(Date eventDate) {
}
/**
- * Retrieves the identifier of the associated {@link Campaign}.
+ * Identifier of the associated {@link Campaign}.
*
- * @return the identifier of the associated {@link Campaign}
+ * @return the campaign identifier
*/
public String getCampaignId() {
return campaignId;
@@ -131,9 +129,9 @@ public void setCampaignId(String campaignId) {
}
/**
- * Retrieves the timezone.
+ * Timezone for interpreting the event date.
*
- * @return the timezone
+ * @return the timezone identifier
*/
public String getTimezone() {
return timezone;
diff --git a/api/src/main/java/org/apache/unomi/api/conditions/Condition.java b/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
index 248d1c43a..fd7655286 100644
--- a/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
+++ b/api/src/main/java/org/apache/unomi/api/conditions/Condition.java
@@ -38,7 +38,9 @@
import static org.apache.unomi.api.utils.YamlUtils.toYamlValue;
/**
- * A set of elements that can be evaluated.
+ * Boolean expression evaluated against context (profiles, events, sessions).
+ * Conditions combine parameters and nested sub-conditions; segments, rules,
+ * and queries all use them to decide when logic applies.
*/
public class Condition implements Serializable, YamlConvertible {
private static final long serialVersionUID = 7584522402785053206L;
@@ -48,24 +50,24 @@ public class Condition implements Serializable, YamlConvertible {
Map parameterValues = new HashMap<>();
/**
- * Instantiates a new Condition.
+ * Default constructor.
*/
public Condition() {
}
/**
- * Instantiates a new Condition with the specified {@link ConditionType}.
+ * Creates a condition with the given condition type.
*
- * @param conditionType the condition type
+ * @param conditionType the condition type definition
*/
public Condition(ConditionType conditionType) {
setConditionType(conditionType);
}
/**
- * Retrieves the associated condition type.
+ * Resolved condition type definition.
*
- * @return the condition type
+ * @return the condition type, or {@code null} if only the id is set
*/
@XmlTransient
public ConditionType getConditionType() {
@@ -85,9 +87,9 @@ public void setConditionType(ConditionType conditionType) {
}
/**
- * Retrieves the identifier of the associated condition type.
+ * Identifier of the condition type backing this expression.
*
- * @return the identifier of the associated condition type
+ * @return the condition type id
*/
@XmlElement(name="type")
public String getConditionTypeId() {
@@ -104,19 +106,18 @@ public void setConditionTypeId(String conditionTypeId) {
}
/**
- * Retrieves a Map of all parameter name - value pairs for this condition.
- *
- * @return a Map of all parameter name - value pairs for this condition. These depend on the condition type being used in the condition.
+ * Parameter values supplied for this condition instance.
*
+ * @return the parameter map; contents depend on the condition type
*/
public Map getParameterValues() {
return parameterValues;
}
/**
- * Sets the parameter name - value pairs for this profile.
+ * Sets all parameter values for this condition.
*
- * @param parameterValues a Map containing the parameter name - value pairs for this profile
+ * @param parameterValues the parameter map
*/
public void setParameterValues(Map parameterValues) {
this.parameterValues = parameterValues != null ? parameterValues : new HashMap<>();
@@ -133,10 +134,10 @@ public boolean containsParameter(String name) {
}
/**
- * Retrieves the parameter identified by the specified name.
+ * Value of the named condition parameter.
*
- * @param name the name of the parameter to retrieve
- * @return the value of the specified parameter or {@code null} if no such parameter exists
+ * @param name the parameter name
+ * @return the parameter value, or {@code null} if unset
*/
public Object getParameter(String name) {
return parameterValues != null ? parameterValues.get(name) : null;
diff --git a/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java b/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java
index e1a00bda1..4adadf8e6 100644
--- a/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java
+++ b/api/src/main/java/org/apache/unomi/api/conditions/ConditionType.java
@@ -49,13 +49,14 @@ public class ConditionType extends MetadataItem implements PluginType, YamlConve
private long pluginId;
/**
- * Instantiates a new Condition type.
+ * Default constructor.
*/
public ConditionType() {
}
/**
- * Instantiates a new Condition type with the specified metadata
+ * Creates a condition type with the given metadata
+ *
* @param metadata the metadata
*/
public ConditionType(Metadata metadata) {
@@ -63,7 +64,7 @@ public ConditionType(Metadata metadata) {
}
/**
- * Retrieves the condition evaluator.
+ * Condition evaluator implementation identifier.
*
* @return the condition evaluator
*/
@@ -81,7 +82,7 @@ public void setConditionEvaluator(String conditionEvaluator) {
}
/**
- * Retrieves the query builder.
+ * Query builder implementation identifier.
*
* @return the query builder
*/
@@ -99,7 +100,7 @@ public void setQueryBuilder(String queryBuilder) {
}
/**
- * Retrieves the parent condition.
+ * Parent condition for composite condition types.
*
* @return the parent condition
*/
@@ -117,7 +118,7 @@ public void setParentCondition(Condition parentCondition) {
}
/**
- * Retrieves the defined {@link Parameter}s for this ConditionType.
+ * Parameters defined for this condition type.
*
* @return a List of the defined {@link Parameter}s for this ConditionType
*/
@@ -166,6 +167,7 @@ public void setPluginId(long pluginId) {
* Implements YamlConvertible interface with circular reference detection.
*
* @param visited set of already visited objects to prevent infinite recursion (may be null)
+ * @param maxDepth maximum recursion depth to prevent stack overflow
* @return a Map representation of this condition type
*/
@Override
diff --git a/api/src/main/java/org/apache/unomi/api/conditions/ConditionValidation.java b/api/src/main/java/org/apache/unomi/api/conditions/ConditionValidation.java
index 9dfd5feaf..2b449dd39 100644
--- a/api/src/main/java/org/apache/unomi/api/conditions/ConditionValidation.java
+++ b/api/src/main/java/org/apache/unomi/api/conditions/ConditionValidation.java
@@ -26,7 +26,9 @@
import static org.apache.unomi.api.utils.YamlUtils.setToSortedList;
/**
- * Validation metadata for condition parameters
+ * Rules that constrain values allowed in a {@link Condition} parameter.
+ * Segment builders and the validation service use this metadata to reject
+ * invalid parameter values before save.
*/
public class ConditionValidation implements Serializable, YamlConvertible {
private static final long serialVersionUID = 1L;
@@ -63,7 +65,7 @@ public enum Type {
private transient Class> customType;
/**
- * Instantiates a new ConditionValidation.
+ * Default constructor.
*/
public ConditionValidation() {
}
@@ -217,6 +219,7 @@ public void setCustomType(Class> customType) {
* Implements YamlConvertible interface.
*
* @param visited set of already visited objects to prevent infinite recursion (may be null)
+ * @param maxDepth maximum recursion depth to prevent stack overflow
* @return a Map representation of this validation
*/
@Override
diff --git a/api/src/main/java/org/apache/unomi/api/exceptions/BadSegmentConditionException.java b/api/src/main/java/org/apache/unomi/api/exceptions/BadSegmentConditionException.java
index 8bd908a2c..fdca53bc7 100644
--- a/api/src/main/java/org/apache/unomi/api/exceptions/BadSegmentConditionException.java
+++ b/api/src/main/java/org/apache/unomi/api/exceptions/BadSegmentConditionException.java
@@ -18,19 +18,21 @@
package org.apache.unomi.api.exceptions;
/**
- * Exception thrown when a segment condition is invalid or cannot be used.
+ * Raised when a segment condition is malformed or cannot be evaluated.
+ * Indicates the condition JSON or references are invalid so callers can
+ * surface a clear error to administrators.
*/
public class BadSegmentConditionException extends RuntimeException {
/**
- * Instantiates a new BadSegmentConditionException.
+ * Default constructor.
*/
public BadSegmentConditionException() {
super();
}
/**
- * Constructs with a message.
+ * Creates an exception with the given message.
*
* @param message the error message
*/
@@ -39,7 +41,7 @@ public BadSegmentConditionException(String message) {
}
/**
- * Constructs with a message and cause.
+ * Creates an exception with the given message and cause.
*
* @param message the error message
* @param cause the root cause
diff --git a/api/src/main/java/org/apache/unomi/api/goals/Goal.java b/api/src/main/java/org/apache/unomi/api/goals/Goal.java
index d2cac5db8..673191015 100644
--- a/api/src/main/java/org/apache/unomi/api/goals/Goal.java
+++ b/api/src/main/java/org/apache/unomi/api/goals/Goal.java
@@ -42,6 +42,7 @@
*
*/
public class Goal extends MetadataItem implements YamlConvertible {
+ /** The constant string used to identify this object as a goal item type. */
public static final String ITEM_TYPE = "goal";
private static final long serialVersionUID = 6131648013470949983L;
private Condition startEvent;
@@ -50,49 +51,72 @@ public class Goal extends MetadataItem implements YamlConvertible {
private String campaignId;
+ /**
+ * Default constructor.
+ */
public Goal() {
}
+ /**
+ * Creates a goal with the given metadata.
+ *
+ * @param metadata the goal metadata
+ */
public Goal(Metadata metadata) {
super(metadata);
}
/**
- * Retrieves the {@link Condition} determining the goal's start event if any, used for more complex goals where an action has to be accomplished first before evaluating the
- * success of the final goal (funnel goal for example).
+ * Optional start condition for funnel-style goals.
+ * When set, goal tracking begins only after this condition is met.
*
- * @return the condition associated with the start event for this goal or {@code null} if no such event exists
+ * @return the start condition, or {@code null} if none is configured
*/
public Condition getStartEvent() {
return startEvent;
}
+ /**
+ * Sets the optional start condition for funnel-style goals.
+ *
+ * @param startEvent the start condition, or {@code null} to clear it
+ */
public void setStartEvent(Condition startEvent) {
this.startEvent = startEvent;
}
/**
- * Retrieves the {@link Condition} determining the target event which needs to occur to consider the goal accomplished.
+ * Condition that marks the goal as accomplished when it matches.
*
- * @return the condition associated with the event determining if the goal is reached or not
+ * @return the target condition
*/
public Condition getTargetEvent() {
return targetEvent;
}
+ /**
+ * Sets the condition that marks the goal as accomplished.
+ *
+ * @param targetEvent the target condition, or {@code null} to clear it
+ */
public void setTargetEvent(Condition targetEvent) {
this.targetEvent = targetEvent;
}
/**
- * Retrieves the identifier of the campaign this goal is part of, if any.
+ * Campaign id when this goal is scoped to a campaign.
*
- * @return the identifier of the campaign this goal is part of, or {@code null} if this goal is not part of any campaign
+ * @return the campaign id, or {@code null} for scope-level goals
*/
public String getCampaignId() {
return campaignId;
}
+ /**
+ * Sets the campaign id for campaign-scoped goals.
+ *
+ * @param campaignId the campaign id, or {@code null} for scope-level goals
+ */
public void setCampaignId(String campaignId) {
this.campaignId = campaignId;
}
diff --git a/api/src/main/java/org/apache/unomi/api/goals/GoalReport.java b/api/src/main/java/org/apache/unomi/api/goals/GoalReport.java
index 1d4413805..11a442325 100644
--- a/api/src/main/java/org/apache/unomi/api/goals/GoalReport.java
+++ b/api/src/main/java/org/apache/unomi/api/goals/GoalReport.java
@@ -21,34 +21,60 @@
import java.util.List;
/**
- * Report information about a {@link Goal}.
+ * Goal conversion report returned by {@link org.apache.unomi.api.services.GoalsService}.
+ * {@link #globalStats} aggregates all traffic; {@link #split} breaks the same
+ * metrics down per experiment or variant key so marketers can compare branches
+ * of a goal or campaign.
*/
public class GoalReport implements Serializable {
private static final long serialVersionUID = -9150361970326342064L;
private Stat globalStats;
private List split;
+ /**
+ * Creates an empty goal report.
+ */
public GoalReport() {
}
+ /**
+ * Aggregated statistics across all traffic.
+ *
+ * @return global statistics
+ */
public Stat getGlobalStats() {
return globalStats;
}
+ /**
+ * Sets the global statistics.
+ *
+ * @param globalStats global statistics
+ */
public void setGlobalStats(Stat globalStats) {
this.globalStats = globalStats;
}
+ /**
+ * Per-split statistics (for example A/B variants).
+ *
+ * @return split statistics
+ */
public List getSplit() {
return split;
}
+ /**
+ * Sets the per-split statistics.
+ *
+ * @param split split statistics
+ */
public void setSplit(List split) {
this.split = split;
}
/**
- * Statistics
+ * Counts and rates for one goal report bucket.
*/
public static class Stat implements Serializable {
private static final long serialVersionUID = 4306277648074263098L;
@@ -58,48 +84,101 @@ public static class Stat implements Serializable {
private double conversionRate;
private double percentage;
+ /**
+ * Creates an empty stat bucket.
+ */
public Stat() {
}
+ /**
+ * Bucket key (for example a split name).
+ *
+ * @return stat key
+ */
public String getKey() {
return key;
}
+ /**
+ * Sets the bucket key.
+ *
+ * @param key stat key
+ */
public void setKey(String key) {
this.key = key;
}
+ /**
+ * Number of goal starts.
+ *
+ * @return start count
+ */
public long getStartCount() {
return startCount;
}
+ /**
+ * Sets the start count.
+ *
+ * @param startCount start count
+ */
public void setStartCount(long startCount) {
this.startCount = startCount;
}
+ /**
+ * Number of goal completions.
+ *
+ * @return target count
+ */
public long getTargetCount() {
return targetCount;
}
+ /**
+ * Sets the target count.
+ *
+ * @param targetCount target count
+ */
public void setTargetCount(long targetCount) {
this.targetCount = targetCount;
}
+ /**
+ * Conversion rate ({@code targetCount / startCount}).
+ *
+ * @return conversion rate
+ */
public double getConversionRate() {
return conversionRate;
}
+ /**
+ * Sets the conversion rate.
+ *
+ * @param conversionRate conversion rate
+ */
public void setConversionRate(double conversionRate) {
this.conversionRate = conversionRate;
}
+ /**
+ * Share of the total as a percentage.
+ *
+ * @return percentage value
+ */
public double getPercentage() {
return percentage;
}
+ /**
+ * Sets the percentage value.
+ *
+ * @param percentage percentage value
+ */
public void setPercentage(double percentage) {
this.percentage = percentage;
}
}
-}
\ No newline at end of file
+}
diff --git a/api/src/main/java/org/apache/unomi/api/lists/UserList.java b/api/src/main/java/org/apache/unomi/api/lists/UserList.java
index dc82b89b5..e7f11cb16 100644
--- a/api/src/main/java/org/apache/unomi/api/lists/UserList.java
+++ b/api/src/main/java/org/apache/unomi/api/lists/UserList.java
@@ -22,7 +22,9 @@
import org.apache.unomi.api.MetadataItem;
/**
- * Created by amidani on 24/03/2017.
+ * Named list of profile identifiers maintained for campaigns or exports.
+ * User lists let marketers target or exclude a fixed audience without
+ * defining a dynamic segment.
*/
public class UserList extends MetadataItem{
@@ -36,12 +38,12 @@ public class UserList extends MetadataItem{
private static final long serialVersionUID = -1384533444875433496L;
/**
- * Instantiates a new UserList.
+ * Default constructor.
*/
public UserList() {}
/**
- * Instantiates a new UserList with the specified metadata.
+ * Creates a user list with the given metadata.
*
* @param metadata the metadata
*/
diff --git a/api/src/main/java/org/apache/unomi/api/query/Aggregate.java b/api/src/main/java/org/apache/unomi/api/query/Aggregate.java
index 9c2f3ffca..3dc959fc2 100644
--- a/api/src/main/java/org/apache/unomi/api/query/Aggregate.java
+++ b/api/src/main/java/org/apache/unomi/api/query/Aggregate.java
@@ -42,13 +42,13 @@ public class Aggregate implements Serializable {
/**
- * Instantiates a new Aggregate.
+ * Default constructor.
*/
public Aggregate() {
}
/**
- * Retrieves the aggregation type.
+ * Aggregation type.
*
* Supported values are {@code date}, {@code dateRange}, {@code numericRange}, and {@code ipRange}.
* When {@code null}, a terms aggregation is used on distinct property values.
@@ -72,7 +72,7 @@ public void setType(String type) {
}
/**
- * Retrieves the aggregation parameters.
+ * Aggregation parameters.
*
* For {@code date} aggregations, expected keys are {@code interval} and {@code format}.
* For {@code dateRange} aggregations, the {@code format} key defines the date format.
@@ -96,7 +96,7 @@ public void setParameters(Map parameters) {
}
/**
- * Retrieves the property to aggregate on.
+ * Property to aggregate on.
*
* @return the property to aggregate on
*/
@@ -114,7 +114,7 @@ public void setProperty(String property) {
}
/**
- * Retrieves the numeric ranges used by {@code numericRange} aggregations.
+ * Numeric ranges for {@code numericRange} aggregations.
*
* @return the numeric ranges
*/
@@ -123,7 +123,7 @@ public List getNumericRanges() {
}
/**
- * Retrieves the date ranges used by {@code dateRange} aggregations.
+ * Date ranges for {@code dateRange} aggregations.
*
* @return the date ranges
*/
@@ -141,7 +141,7 @@ public void setDateRanges(List dateRanges) {
}
/**
- * Retrieves the IP ranges used by {@code ipRange} aggregations.
+ * IP ranges for {@code ipRange} aggregations.
*
* @return the IP ranges
*/
diff --git a/api/src/main/java/org/apache/unomi/api/query/AggregateQuery.java b/api/src/main/java/org/apache/unomi/api/query/AggregateQuery.java
index 0f44b3b33..96ce0db9c 100644
--- a/api/src/main/java/org/apache/unomi/api/query/AggregateQuery.java
+++ b/api/src/main/java/org/apache/unomi/api/query/AggregateQuery.java
@@ -30,13 +30,13 @@ public class AggregateQuery implements Serializable {
private Condition condition;
/**
- * Instantiates a new Aggregate query.
+ * Default constructor.
*/
public AggregateQuery() {
}
/**
- * Instantiates a new Aggregate query with the specified {@link Aggregate}.
+ * Creates an aggregate query with the given aggregate specification.
*
* @param aggregate the aggregate
*/
@@ -45,7 +45,7 @@ public AggregateQuery(Aggregate aggregate) {
}
/**
- * Instantiates a new Aggregate query with the specified {@link Condition}.
+ * Creates an aggregate query with the given filter condition.
*
* @param condition the condition
*/
@@ -54,7 +54,7 @@ public AggregateQuery(Condition condition) {
}
/**
- * Instantiates a new Aggregate query with the specified {@link Aggregate} and {@link Condition}
+ * Creates an aggregate query with the given aggregate and filter condition
*
* @param aggregate the aggregate
* @param condition the condition
@@ -65,7 +65,7 @@ public AggregateQuery(Aggregate aggregate, Condition condition) {
}
/**
- * Retrieves the aggregate.
+ * Aggregate specification for this query.
*
* @return the aggregate
*/
@@ -83,7 +83,7 @@ public void setAggregate(Aggregate aggregate) {
}
/**
- * Retrieves the condition.
+ * Filter condition for this query.
*
* @return the condition
*/
diff --git a/api/src/main/java/org/apache/unomi/api/query/DateRange.java b/api/src/main/java/org/apache/unomi/api/query/DateRange.java
index 47390b3d8..cfdfb01e5 100644
--- a/api/src/main/java/org/apache/unomi/api/query/DateRange.java
+++ b/api/src/main/java/org/apache/unomi/api/query/DateRange.java
@@ -20,36 +20,72 @@
import java.io.Serializable;
/**
- * A data range.
+ * Named inclusive date bucket for queries and aggregations.
+ * Combines a display {@code key} with {@code from} and {@code to} bounds so
+ * segment conditions and aggregate queries can group events or profiles inside
+ * a calendar window.
*/
public class DateRange implements Serializable {
private String key;
private Object from;
private Object to;
+ /**
+ * Creates an empty date range.
+ */
public DateRange() {
}
+ /**
+ * Label for this range in query results.
+ *
+ * @return range key
+ */
public String getKey() {
return key;
}
+ /**
+ * Sets the range label.
+ *
+ * @param key range key
+ */
public void setKey(String key) {
this.key = key;
}
+ /**
+ * Inclusive lower bound of the interval.
+ *
+ * @return start date or value
+ */
public Object getFrom() {
return from;
}
+ /**
+ * Sets the inclusive lower bound.
+ *
+ * @param from start date or value
+ */
public void setFrom(Object from) {
this.from = from;
}
+ /**
+ * Inclusive upper bound of the interval.
+ *
+ * @return end date or value
+ */
public Object getTo() {
return to;
}
+ /**
+ * Sets the inclusive upper bound.
+ *
+ * @param to end date or value
+ */
public void setTo(Object to) {
this.to = to;
}
diff --git a/api/src/main/java/org/apache/unomi/api/query/IpRange.java b/api/src/main/java/org/apache/unomi/api/query/IpRange.java
index 411f58598..a2deb51ed 100644
--- a/api/src/main/java/org/apache/unomi/api/query/IpRange.java
+++ b/api/src/main/java/org/apache/unomi/api/query/IpRange.java
@@ -20,36 +20,71 @@
import java.io.Serializable;
/**
- * An IP address range.
+ * Named inclusive IP range used in geo or network segment conditions.
+ * The {@code from} and {@code to} strings define lower and upper bounds checked
+ * when evaluating whether a visitor's IP address belongs to the range.
*/
public class IpRange implements Serializable {
private String key;
private String from;
private String to;
+ /**
+ * Creates an empty IP range.
+ */
public IpRange() {
}
+ /**
+ * Label for this range in query results.
+ *
+ * @return range key
+ */
public String getKey() {
return key;
}
+ /**
+ * Sets the range label.
+ *
+ * @param key range key
+ */
public void setKey(String key) {
this.key = key;
}
+ /**
+ * Inclusive lower IP bound.
+ *
+ * @return start IP address
+ */
public String getFrom() {
return from;
}
+ /**
+ * Sets the inclusive lower IP bound.
+ *
+ * @param from start IP address
+ */
public void setFrom(String from) {
this.from = from;
}
+ /**
+ * Inclusive upper IP bound.
+ *
+ * @return end IP address
+ */
public String getTo() {
return to;
}
+ /**
+ * Sets the inclusive upper IP bound.
+ *
+ * @param to end IP address
+ */
public void setTo(String to) {
this.to = to;
}
diff --git a/api/src/main/java/org/apache/unomi/api/query/NumericRange.java b/api/src/main/java/org/apache/unomi/api/query/NumericRange.java
index 149a35805..9a493b79b 100644
--- a/api/src/main/java/org/apache/unomi/api/query/NumericRange.java
+++ b/api/src/main/java/org/apache/unomi/api/query/NumericRange.java
@@ -20,36 +20,71 @@
import java.io.Serializable;
/**
- * A numeric range.
+ * Named inclusive numeric bucket for query filters and aggregations.
+ * Stores a {@code key} plus {@code from}/{@code to} bounds so conditions can
+ * test profile or event properties against numeric intervals.
*/
public class NumericRange implements Serializable {
private String key;
private Double from;
private Double to;
+ /**
+ * Creates an empty numeric range.
+ */
public NumericRange() {
}
+ /**
+ * Label for this range in query results.
+ *
+ * @return range key
+ */
public String getKey() {
return key;
}
+ /**
+ * Sets the range label.
+ *
+ * @param key range key
+ */
public void setKey(String key) {
this.key = key;
}
+ /**
+ * Inclusive lower bound.
+ *
+ * @return lower bound, or {@code null} if unset
+ */
public Double getFrom() {
return from;
}
+ /**
+ * Sets the inclusive lower bound.
+ *
+ * @param from lower bound
+ */
public void setFrom(Double from) {
this.from = from;
}
+ /**
+ * Inclusive upper bound.
+ *
+ * @return upper bound, or {@code null} if unset
+ */
public Double getTo() {
return to;
}
+ /**
+ * Sets the inclusive upper bound.
+ *
+ * @param to upper bound
+ */
public void setTo(Double to) {
this.to = to;
}
diff --git a/api/src/main/java/org/apache/unomi/api/query/Query.java b/api/src/main/java/org/apache/unomi/api/query/Query.java
index 48e0c1a6b..9e3e0fbe2 100644
--- a/api/src/main/java/org/apache/unomi/api/query/Query.java
+++ b/api/src/main/java/org/apache/unomi/api/query/Query.java
@@ -22,9 +22,10 @@
import java.io.Serializable;
/**
- * A query wrapper gathering all elements needed for a potentially complex CXS query: {@link Condition}, offset, limit, sorting specification, etc.
- *
- * Created by kevan on 14/05/15.
+ * Search and paging request sent to {@link org.apache.unomi.api.services.QueryService}
+ * and profile/segment REST endpoints.
+ * Combines an optional full-text filter, a {@link Condition}, sort field, offset/limit,
+ * and a {@code forceRefresh} flag that controls whether indexes are refreshed first.
*/
public class Query implements Serializable {
private String text;
@@ -37,134 +38,153 @@ public class Query implements Serializable {
private String scrollIdentifier;
/**
- * Instantiates a new Query.
+ * Default constructor.
*/
public Query() {
}
/**
- * Retrieves the text to be used in full-text searches, if any.
+ * Optional full-text filter applied to the search.
*
- * @return the text to be used in full-text searches or {@code null} if no full-text search is needed for this Query
+ * @return the search text, or {@code null} if none is set
*/
public String getText() {
return text;
}
/**
- * Sets to be used in full-text searches
+ * Sets the full-text filter.
*
- * @param text the text to be used in full-text searches or {@code null} if no full-text search is needed for this Query
+ * @param text the search text, or {@code null} to disable full-text search
*/
public void setText(String text) {
this.text = text;
}
-
/**
- * Retrieves the offset of the first element to be retrieved
+ * Zero-based index of the first result to return.
*
- * @return zero or a positive integer specifying the position of the first item to be retrieved in the total ordered collection of matching items
+ * @return the result offset
*/
public int getOffset() {
return offset;
}
/**
- * Sets the offset of the first element to be retrieved
+ * Sets the zero-based result offset.
*
- * @param offset zero or a positive integer specifying the position of the first item to be retrieved in the total ordered collection of matching items
+ * @param offset the first result index
*/
public void setOffset(int offset) {
this.offset = offset;
}
/**
- * Retrieves the number of elements to retrieve.
+ * Maximum number of results to return, or {@code -1} for all matches.
*
- * @return a positive integer specifying how many matching items should be retrieved or {@code -1} if all of them should be retrieved
+ * @return the result limit
*/
public int getLimit() {
return limit;
}
/**
- * Sets the number of elements to retrieve.
+ * Sets the maximum number of results to return.
*
- * @param limit a positive integer specifying how many matching items should be retrieved or {@code -1} if all of them should be retrieved
+ * @param limit the result limit, or {@code -1} for all matches
*/
public void setLimit(int limit) {
this.limit = limit;
}
/**
- * Retrieves the sorting specifications for this Query in String format, if any.
+ * Sort specification as a comma-separated property list.
+ * Each property may be followed by {@code :asc} or {@code :desc}.
*
- * @return an optional ({@code null} if no sorting is required) String of comma ({@code ,}) 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 ({@code :}) and an order specifier: {@code asc} or {@code desc}.
+ * @return the sort specification, or {@code null} if unsorted
*/
public String getSortby() {
return sortby;
}
/**
- * Sets the String representation of the sorting specifications for this Query if any. See {@link #getSortby()} method documentation for format.
+ * Sets the sort specification.
+ * See {@link #getSortby()} for the expected format.
*
- * @param sortby the String representation of the sorting specifications for this Query or {@code null} if no sorting is required
+ * @param sortby the sort specification, or {@code null} for no sorting
*/
public void setSortby(String sortby) {
this.sortby = sortby;
}
/**
- * Retrieves the {@link Condition} associated with this Query.
+ * Structured filter condition for the query.
*
- * @return the {@link Condition} associated with this Query
+ * @return the condition, or {@code null} if none is set
*/
public Condition getCondition() {
return condition;
}
/**
- * Sets the {@link Condition} associated with this Query.
+ * Sets the structured filter condition.
*
- * @param condition the {@link Condition} associated with this Query
+ * @param condition the condition
*/
public void setCondition(Condition condition) {
this.condition = condition;
}
/**
- * Determines whether or not an index refresh is needed before performing this Query
+ * Whether the search index should be refreshed before executing the query.
*
- * @return {@code true} if an index refresh is needed before performing this Query, {@code false} otherwise
+ * @return {@code true} to force a refresh, {@code false} otherwise
*/
public boolean isForceRefresh() {
return forceRefresh;
}
/**
- * Specifies whether or not an index refresh is needed before performing this Query.
+ * Sets whether to refresh the index before executing the query.
*
- * @param forceRefresh {@code true} if an index refresh is needed before performing this Query, {@code false} otherwise
+ * @param forceRefresh {@code true} to force a refresh
*/
public void setForceRefresh(boolean forceRefresh) {
this.forceRefresh = forceRefresh;
}
+ /**
+ * Scroll token for continuing a deep result set query.
+ *
+ * @return the scroll identifier, or {@code null} if scrolling is not active
+ */
public String getScrollIdentifier() {
return scrollIdentifier;
}
+ /**
+ * Sets the scroll token for continuing a scroll query.
+ *
+ * @param scrollIdentifier the scroll identifier, or {@code null} to clear it
+ */
public void setScrollIdentifier(String scrollIdentifier) {
this.scrollIdentifier = scrollIdentifier;
}
+ /**
+ * How long the scroll context remains valid (for example {@code 10m}).
+ *
+ * @return the scroll validity period, or {@code null} if not set
+ */
public String getScrollTimeValidity() {
return scrollTimeValidity;
}
+ /**
+ * Sets how long the scroll context remains valid.
+ *
+ * @param scrollTimeValidity the validity period (for example {@code 10m})
+ */
public void setScrollTimeValidity(String scrollTimeValidity) {
this.scrollTimeValidity = scrollTimeValidity;
}
diff --git a/api/src/main/java/org/apache/unomi/api/rules/Rule.java b/api/src/main/java/org/apache/unomi/api/rules/Rule.java
index cd6f751e5..1e2586f18 100644
--- a/api/src/main/java/org/apache/unomi/api/rules/Rule.java
+++ b/api/src/main/java/org/apache/unomi/api/rules/Rule.java
@@ -64,13 +64,13 @@ public class Rule extends MetadataItem implements YamlConvertible {
private int priority;
/**
- * Instantiates a new Rule.
+ * Default constructor.
*/
public Rule() {
}
/**
- * Instantiates a new Rule with the specified {@link Metadata}.
+ * Creates a rule with the given metadata.
*
* @param metadata the metadata
*/
@@ -79,7 +79,7 @@ public Rule(Metadata metadata) {
}
/**
- * Retrieves the condition that, when satisfied, triggers the rule.
+ * Condition that triggers the rule when satisfied.
*
* @return the condition that, when satisfied, triggers the rule.
*/
@@ -97,7 +97,7 @@ public void setCondition(Condition condition) {
}
/**
- * Retrieves the actions to be performed when this rule triggers.
+ * Actions performed when this rule triggers.
*
* @return the actions to be performed when this rule triggers
*/
@@ -115,7 +115,7 @@ public void setActions(List actions) {
}
/**
- * Retrieves the linked items.
+ * Identifiers of items linked to this rule.
*
* @return the linked items
*/
@@ -142,9 +142,9 @@ public boolean isRaiseEventOnlyOnceForProfile() {
}
/**
- * Determines whether the event raised when the rule is triggered should only be raised once
+ * Whether the rule-triggered event should be raised only once per incoming event.
*
- * @return {@code true} if the rule-triggered event should only be raised once per profile
+ * @return {@code true} if the rule-triggered event should only be raised once per event
*/
public boolean isRaiseEventOnlyOnce() {
return raiseEventOnlyOnce;
@@ -187,7 +187,7 @@ public void setRaiseEventOnlyOnce(boolean raiseEventOnlyOnce) {
}
/**
- * Retrieves the priority in case this Rule needs to be executed before other ones when similar conditions match.
+ * Priority when this rule must run before others with similar conditions before other ones when similar conditions match.
*
* @return the priority
*/
@@ -209,6 +209,7 @@ public void setPriority(int priority) {
* Implements YamlConvertible interface with circular reference detection.
*
* @param visited set of already visited objects to prevent infinite recursion (may be null)
+ * @param maxDepth maximum recursion depth to prevent stack overflow
* @return a Map representation of this rule
*/
@Override
diff --git a/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java b/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
index 4dd18c79b..80cf18ac4 100644
--- a/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
+++ b/api/src/main/java/org/apache/unomi/api/rules/RuleStatistics.java
@@ -21,15 +21,18 @@
import java.util.Date;
/**
- * A separate item to track rule statistics, because we will manage the persistence and updating of
- * these seperately from the rules themselves. This object contains all the relevant statistics
- * concerning the execution of a rule, including accumulated execution times.
+ * Persisted statistics for a {@link org.apache.unomi.api.rules.Rule}, stored separately from the rule
+ * definition so counters can be updated without rewriting the rule itself.
+ *
+ * Cluster-wide fields ({@link #executionCount}, {@link #conditionsTime}, {@link #actionsTime}) hold
+ * aggregated totals synchronized across nodes. Matching {@code local*} fields track counts and
+ * timings on the current node since {@link #lastSyncDate}; they are merged into the cluster totals
+ * during synchronization.
*/
public class RuleStatistics extends Item {
/**
* The RuleStatistics ITEM_TYPE.
- *
* @see Item for a discussion of ITEM_TYPE
*/
public static final String ITEM_TYPE = "rulestats";
@@ -43,125 +46,142 @@ public class RuleStatistics extends Item {
private long localActionsTime = 0;
private Date lastSyncDate;
+ /**
+ * Default constructor.
+ */
public RuleStatistics() {
}
+ /**
+ * Creates statistics for the rule with the given identifier.
+ *
+ * @param itemId the rule item identifier these statistics belong to
+ */
public RuleStatistics(String itemId) {
super(itemId);
}
/**
- * Retrieve the execution count of the rule in the cluster
- * @return a long that is the total number of executions of the rule without the local node execution
- * count
+ * Cluster-wide execution count (excluding the current node's unsynchronized local count).
+ *
+ * @return the cluster execution count
*/
public long getExecutionCount() {
return executionCount;
}
/**
- * Set the execution count of the rule in the cluster
- * @param executionCount a long that represents the number of execution of the rule in the cluster
+ * Sets the cluster-wide execution count.
+ *
+ * @param executionCount the cluster execution count
*/
public void setExecutionCount(long executionCount) {
this.executionCount = executionCount;
}
/**
- * Retrieve the execution count of the rule on this single node since the last sync with the cluster
- * @return a long that is the total number of executions on this node since the last sync with the
- * cluster
+ * Execution count on this node since the last cluster synchronization.
+ *
+ * @return the local execution count
*/
public long getLocalExecutionCount() {
return localExecutionCount;
}
/**
- * Sets the number of local execution counts for this node since the last sync with the cluster
- * @param localExecutionCount a long that represents the number of execution of the rule since the
- * last sync with the cluster
+ * Sets the local execution count since the last cluster synchronization.
+ *
+ * @param localExecutionCount the local execution count
*/
public void setLocalExecutionCount(long localExecutionCount) {
this.localExecutionCount = localExecutionCount;
}
/**
- * Retrieve the accumulated time evaluating the conditions of the rule in the cluster
- * @return a long representing the accumulated time in milliseconds that represents the time spent
- * evaluating the conditions of the rule for the whole cluster
+ * Cluster-wide accumulated time spent evaluating rule conditions, in milliseconds.
+ *
+ * @return the cluster conditions time in milliseconds
*/
public long getConditionsTime() {
return conditionsTime;
}
/**
- * Sets the execution time of the condition of the rule for the whole cluster
- * @param conditionsTime a long representing a time in milliseconds
+ * Sets the cluster-wide accumulated conditions evaluation time.
+ *
+ * @param conditionsTime the cluster conditions time in milliseconds
*/
public void setConditionsTime(long conditionsTime) {
this.conditionsTime = conditionsTime;
}
/**
- * Retrieve the accumulated execution time of the rule's condition since the last sync with the cluster
- * @return a long that represents the accumulated time in milliseconds
+ * Local accumulated time spent evaluating rule conditions since the last cluster sync, in milliseconds.
+ *
+ * @return the local conditions time in milliseconds
*/
public long getLocalConditionsTime() {
return localConditionsTime;
}
/**
- * Sets the accumulated execution time of the rule's condition since the last sync with the cluster
- * @param localConditionsTime a long that represents the accumulated time in milliseconds
+ * Sets the local accumulated conditions evaluation time since the last cluster sync.
+ *
+ * @param localConditionsTime the local conditions time in milliseconds
*/
public void setLocalConditionsTime(long localConditionsTime) {
this.localConditionsTime = localConditionsTime;
}
/**
- * Retrieve the accumulated time of the rule's actions
- * @return a long representing the accumulated time in milliseconds
+ * Cluster-wide accumulated time spent executing rule actions, in milliseconds.
+ *
+ * @return the cluster actions time in milliseconds
*/
public long getActionsTime() {
return actionsTime;
}
/**
- * Sets the accumulated time for the rule's actions
- * @param actionsTime a long representing the accumulated time in milliseconds
+ * Sets the cluster-wide accumulated actions execution time.
+ *
+ * @param actionsTime the cluster actions time in milliseconds
*/
public void setActionsTime(long actionsTime) {
this.actionsTime = actionsTime;
}
/**
- * Retrieve the accumulated time spent executing the rule's actions since the last sync with the cluster
- * @return a long representing the accumulated time in milliseconds
+ * Local accumulated time spent executing rule actions since the last cluster sync, in milliseconds.
+ *
+ * @return the local actions time in milliseconds
*/
public long getLocalActionsTime() {
return localActionsTime;
}
/**
- * Sets the accumulated time spend executing the rule's actions since the last sync with the cluster
- * @param localActionsTime a long representing the accumulated time in milliseconds
+ * Sets the local accumulated actions execution time since the last cluster sync.
+ *
+ * @param localActionsTime the local actions time in milliseconds
*/
public void setLocalActionsTime(long localActionsTime) {
this.localActionsTime = localActionsTime;
}
/**
- * Retrieve the last sync date
- * @return a date that was set the last time the statistics were synchronized with the cluster
+ * Date when local counters were last merged into the cluster totals.
+ *
+ * @return the last synchronization date
*/
public Date getLastSyncDate() {
return lastSyncDate;
}
/**
- * Sets the last sync date
- * @param lastSyncDate a date that represents the last time the statistics were synchronized
- * with the cluster
+ * Sets the last cluster synchronization date.
+ *
+ * @param lastSyncDate the last synchronization date
*/
public void setLastSyncDate(Date lastSyncDate) {
this.lastSyncDate = lastSyncDate;
diff --git a/api/src/main/java/org/apache/unomi/api/security/EncryptionService.java b/api/src/main/java/org/apache/unomi/api/security/EncryptionService.java
index d77c8c1e6..f3c1c2e8a 100644
--- a/api/src/main/java/org/apache/unomi/api/security/EncryptionService.java
+++ b/api/src/main/java/org/apache/unomi/api/security/EncryptionService.java
@@ -17,22 +17,23 @@
package org.apache.unomi.api.security;
/**
- * Service for handling encryption operations.
+ * Encrypts and decrypts sensitive tenant or configuration values.
+ * Implementations hide key management details from the rest of the API.
*/
public interface EncryptionService {
/**
- * Get the encryption key for a specific tenant.
+ * Encryption key for the specified tenant.
*
* @param tenantId the tenant ID
- * @return the encryption key as a byte array
+ * @return the encryption key bytes
*/
byte[] getTenantEncryptionKey(String tenantId);
/**
- * Generate a new encryption key for a tenant.
+ * Generates a new encryption key for the specified tenant.
*
* @param tenantId the tenant ID
- * @return the newly generated encryption key
+ * @return the newly generated encryption key bytes
*/
byte[] generateTenantEncryptionKey(String tenantId);
-}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/api/src/main/java/org/apache/unomi/api/security/SecurityService.java b/api/src/main/java/org/apache/unomi/api/security/SecurityService.java
index 6b5f92cc3..656f88f88 100644
--- a/api/src/main/java/org/apache/unomi/api/security/SecurityService.java
+++ b/api/src/main/java/org/apache/unomi/api/security/SecurityService.java
@@ -35,7 +35,7 @@ public interface SecurityService {
String SYSTEM_TENANT = "system";
/**
- * Retrieves the current subject from the security context. The subject is determined in the following order:
+ * Current subject from the security context. The subject is determined in the following order:
* 1. JAAS context - If a JAAS authentication is active
* 2. Privileged subject - If a temporary privileged operation is in progress
* 3. Current request subject - The subject associated with the current request
@@ -45,7 +45,7 @@ public interface SecurityService {
Subject getCurrentSubject();
/**
- * Retrieves the current principal from the active subject.
+ * Current principal from the active subject.
* The principal represents the primary identity of the authenticated entity.
*
* @return the current principal or null if no subject is set or the subject has no principals
@@ -128,7 +128,7 @@ public interface SecurityService {
void executeWithPrivilegedSubject(Subject privilegedSubject, Runnable operation);
/**
- * Retrieves the current tenant ID based on the active subject context.
+ * Current tenant identifier from the active subject context.
* The tenant ID is determined from the subject's principal.
*
* @return the current tenant ID, or SYSTEM_TENANT if operating in system context
@@ -144,7 +144,7 @@ public interface SecurityService {
boolean isOperatingOnSystemTenant();
/**
- * Retrieves the encryption key for a specific tenant.
+ * Encryption key for the specified tenant.
* This key is used for encrypting sensitive data within the tenant's context.
*
* @param tenantId the ID of the tenant whose encryption key should be retrieved
@@ -207,20 +207,23 @@ public interface SecurityService {
boolean hasSystemAccess();
/**
- * Get the system subject with administrative privileges
+ * System subject with administrative privileges.
+ *
* @return the system subject
*/
Subject getSystemSubject();
/**
- * Extract roles from a subject
+ * Role names granted to the given subject.
+ *
* @param subject the subject to extract roles from
* @return set of role names
*/
Set extractRolesFromSubject(Subject subject);
/**
- * Get the security service configuration
+ * Security service configuration.
+ *
* @return the security configuration
*/
SecurityServiceConfiguration getConfiguration();
diff --git a/api/src/main/java/org/apache/unomi/api/security/SecurityServiceConfiguration.java b/api/src/main/java/org/apache/unomi/api/security/SecurityServiceConfiguration.java
index f3ccc0d31..b3f4d0c52 100644
--- a/api/src/main/java/org/apache/unomi/api/security/SecurityServiceConfiguration.java
+++ b/api/src/main/java/org/apache/unomi/api/security/SecurityServiceConfiguration.java
@@ -22,22 +22,85 @@
import java.util.Set;
/**
- * Configuration for the Security Service
+ * Settings that control authentication, authorization, and API access.
+ * Loaded at startup to configure how the security layer validates users,
+ * roles, and tenant principals.
*/
public class SecurityServiceConfiguration {
- // Permission constants
+ /**
+ * Defines the permission key used when querying items, which is also
+ * utilized to validate the tenant ID scope for query operations.
+ */
public static final String PERMISSION_QUERY = "QUERY";
+ /**
+ * Defines the permission key required for performing aggregations on item
+ * data, and is used internally to validate the tenant ID scope during
+ * aggregation queries.
+ */
public static final String PERMISSION_AGGREGATE = "AGGREGATE";
+ /**
+ * Defines the permission key necessary for continuing or
+ * initiating a scroll query.
+ * This constant is used to validate the tenant ID when
+ * executing scroll operations.
+ */
public static final String PERMISSION_SCROLL_QUERY = "SCROLL_QUERY";
+ /**
+ * Defines the permission key required for saving new items. It is also used
+ * internally to ensure that the correct tenant ID is set
+ * during save operations.
+ */
public static final String PERMISSION_SAVE = "SAVE";
+ /**
+ * Defines the permission key necessary for updating existing items. This
+ * constant is utilized to validate the tenant ID scope when
+ * performing item updates.
+ */
public static final String PERMISSION_UPDATE = "UPDATE";
+ /**
+ * Defines the permission key required for deleting items. It is used both
+ * in defining default roles and internally to validate the tenant ID during
+ * deletion operations.
+ */
public static final String PERMISSION_DELETE = "DELETE";
+ /**
+ * Defines the permission key needed when removing multiple items
+ * using a query condition.
+ * This constant is used to validate the tenant ID scope for remove
+ * by query operations.
+ */
public static final String PERMISSION_REMOVE_BY_QUERY = "REMOVE_BY_QUERY";
+ /**
+ * Defines the permission key required for purging data. It is utilized both
+ * in defining default roles and internally to validate the tenant ID
+ * during purge operations.
+ */
public static final String PERMISSION_PURGE = "PURGE";
+ /**
+ * Defines the permission key required for performing system
+ * maintenance operations.
+ */
public static final String PERMISSION_SYSTEM_MAINTENANCE = "SYSTEM_MAINTENANCE";
+ /**
+ * Defines the permission key needed when profile data
+ * encryption is required.
+ */
public static final String PERMISSION_ENCRYPT_PROFILE_DATA = "ENCRYPT_PROFILE_DATA";
+ /**
+ * Defines the permission key needed when profile data decryption is
+ * required. This constant is used to validate the tenant ID scope
+ * for remove operations.
+ */
public static final String PERMISSION_DECRYPT_PROFILE_DATA = "DECRYPT_PROFILE_DATA";
+ /**
+ * Defines the permission key required for writing or modifying schemas.
+ * This constant is used to validate access during schema write operations.
+ */
public static final String PERMISSION_SCHEMA_WRITE = "SCHEMA_WRITE";
+ /**
+ * Defines the permission key required for deleting schemas. This constant
+ * is used to validate access during schema delete operations.
+ */
public static final String PERMISSION_SCHEMA_DELETE = "SCHEMA_DELETE";
private Map permissionRoles;
@@ -45,6 +108,9 @@ public class SecurityServiceConfiguration {
private Set systemRoles = new HashSet<>();
private boolean enableEncryption = false;
+ /**
+ * Initializes default system roles and permission-to-role mappings.
+ */
public SecurityServiceConfiguration() {
// Initialize default system roles
systemRoles.add(UnomiRoles.ADMINISTRATOR);
@@ -68,51 +134,102 @@ public SecurityServiceConfiguration() {
defaultRole = UnomiRoles.USER;
}
+ /**
+ * Permission keys mapped to the roles allowed to perform them.
+ *
+ * @return the permission-to-roles map
+ */
public Map getPermissionRoles() {
return permissionRoles;
}
+ /**
+ * Replaces the full permission-to-role mapping.
+ *
+ * @param permissionRoles the permission-to-roles map
+ */
public void setPermissionRoles(Map permissionRoles) {
this.permissionRoles = permissionRoles;
}
+ /**
+ * Role assigned when no explicit mapping exists.
+ *
+ * @return the default role name
+ */
public String getDefaultRole() {
return defaultRole;
}
+ /**
+ * Sets the default role name.
+ *
+ * @param defaultRole the default role
+ */
public void setDefaultRole(String defaultRole) {
this.defaultRole = defaultRole;
}
/**
- * Get required roles for an permission
- * @param permission the permission to check
- * @return array of required roles, or array containing default role if permission not mapped
+ * Roles required for the given permission.
+ *
+ * @param permission the permission key
+ * @return the required roles, or an array containing the default role if unmapped
*/
public String[] getRequiredRolesForPermission(String permission) {
return permissionRoles.getOrDefault(permission, new String[]{defaultRole});
}
+ /**
+ * Platform roles recognized by the security service.
+ *
+ * @return the system role names
+ */
public Set getSystemRoles() {
return systemRoles;
}
+ /**
+ * Replaces the set of recognized system roles.
+ *
+ * @param systemRoles the system role names
+ */
public void setSystemRoles(Set systemRoles) {
this.systemRoles = systemRoles;
}
+ /**
+ * Adds a system role name.
+ *
+ * @param role the role to add
+ */
public void addSystemRole(String role) {
systemRoles.add(role);
}
+ /**
+ * Removes a system role name.
+ *
+ * @param role the role to remove
+ */
public void removeSystemRole(String role) {
systemRoles.remove(role);
}
+ /**
+ * Whether profile data encryption is enabled.
+ *
+ * @return {@code true} if encryption is enabled
+ */
public boolean isEnableEncryption() {
return enableEncryption;
}
+ /**
+ * Enables or disables profile data encryption.
+ *
+ * @param enableEncryption {@code true} to enable encryption
+ */
public void setEnableEncryption(boolean enableEncryption) {
this.enableEncryption = enableEncryption;
}
diff --git a/api/src/main/java/org/apache/unomi/api/segments/DependentMetadata.java b/api/src/main/java/org/apache/unomi/api/segments/DependentMetadata.java
index 1830c1ee5..30926539f 100644
--- a/api/src/main/java/org/apache/unomi/api/segments/DependentMetadata.java
+++ b/api/src/main/java/org/apache/unomi/api/segments/DependentMetadata.java
@@ -22,29 +22,60 @@
import java.io.Serializable;
import java.util.List;
+/**
+ * Holds segment and scoring definitions that depend on each other.
+ * Used when exporting or editing related segment/scoring metadata as one
+ * unit in the segmentation UI.
+ */
public class DependentMetadata implements Serializable {
private List segments;
private List scorings;
+ /**
+ * Creates dependent metadata from segment and scoring definitions.
+ *
+ * @param segments metadata for dependent segments
+ * @param scorings metadata for dependent scorings
+ */
public DependentMetadata(List segments, List scorings) {
this.segments = segments;
this.scorings = scorings;
}
+ /**
+ * Metadata for segments that depend on the edited item.
+ *
+ * @return the dependent segment metadata
+ */
public List getSegments() {
return segments;
}
+ /**
+ * Sets the dependent segment metadata.
+ *
+ * @param segments the segment metadata list
+ */
public void setSegments(List segments) {
this.segments = segments;
}
+ /**
+ * Metadata for scorings that depend on the edited item.
+ *
+ * @return the dependent scoring metadata
+ */
public List getScorings() {
return scorings;
}
+ /**
+ * Sets the dependent scoring metadata.
+ *
+ * @param scorings the scoring metadata list
+ */
public void setScorings(List scorings) {
this.scorings = scorings;
}
diff --git a/api/src/main/java/org/apache/unomi/api/segments/Scoring.java b/api/src/main/java/org/apache/unomi/api/segments/Scoring.java
index b32aa8ab0..85e36ad1e 100644
--- a/api/src/main/java/org/apache/unomi/api/segments/Scoring.java
+++ b/api/src/main/java/org/apache/unomi/api/segments/Scoring.java
@@ -45,13 +45,13 @@ public class Scoring extends MetadataItem implements YamlConvertible {
private List elements;
/**
- * Instantiates a new Scoring.
+ * Default constructor.
*/
public Scoring() {
}
/**
- * Instantiates a new Scoring with the specified metadata.
+ * Creates a scoring definition with the given metadata.
*
* @param metadata the metadata
*/
@@ -60,9 +60,9 @@ public Scoring(Metadata metadata) {
}
/**
- * Retrieves the details of this Scoring.
+ * Scoring elements that define conditions and point values.
*
- * @return the elements
+ * @return the scoring elements
*/
public List getElements() {
return elements;
@@ -82,6 +82,7 @@ public void setElements(List elements) {
* Implements YamlConvertible interface with circular reference detection.
*
* @param visited set of already visited objects to prevent infinite recursion (may be null)
+ * @param maxDepth maximum recursion depth to prevent stack overflow
* @return a Map representation of this scoring
*/
@Override
diff --git a/api/src/main/java/org/apache/unomi/api/segments/ScoringElement.java b/api/src/main/java/org/apache/unomi/api/segments/ScoringElement.java
index ab79d132a..7467f5788 100644
--- a/api/src/main/java/org/apache/unomi/api/segments/ScoringElement.java
+++ b/api/src/main/java/org/apache/unomi/api/segments/ScoringElement.java
@@ -30,20 +30,22 @@
import static org.apache.unomi.api.utils.YamlUtils.toYamlValue;
/**
- * A scoring dimension along profiles can be evaluated and associated value to be assigned.
+ * One dimension of a {@link org.apache.unomi.api.segments.Scoring} model.
+ * Assigns a numeric value along an axis (for example engagement) when a
+ * profile matches the element's condition.
*/
public class ScoringElement implements Serializable, YamlConvertible {
private Condition condition;
private int value;
/**
- * Instantiates a new Scoring element.
+ * Default constructor.
*/
public ScoringElement() {
}
/**
- * Retrieves the condition.
+ * Condition evaluated to decide whether this scoring element applies.
*
* @return the condition
*/
@@ -52,7 +54,7 @@ public Condition getCondition() {
}
/**
- * Sets the condition.
+ * Sets the matching condition.
*
* @param condition the condition
*/
@@ -61,18 +63,18 @@ public void setCondition(Condition condition) {
}
/**
- * Retrieves the value.
+ * Score contributed when the condition matches.
*
- * @return the value
+ * @return the score value
*/
public int getValue() {
return value;
}
/**
- * Sets the value.
+ * Sets the score value contributed when the condition matches.
*
- * @param value the value
+ * @param value the score value
*/
public void setValue(int value) {
this.value = value;
diff --git a/api/src/main/java/org/apache/unomi/api/segments/Segment.java b/api/src/main/java/org/apache/unomi/api/segments/Segment.java
index 126279c15..b5a4758ab 100644
--- a/api/src/main/java/org/apache/unomi/api/segments/Segment.java
+++ b/api/src/main/java/org/apache/unomi/api/segments/Segment.java
@@ -49,13 +49,13 @@ public class Segment extends MetadataItem implements YamlConvertible {
private Condition condition;
/**
- * Instantiates a new Segment.
+ * Default constructor.
*/
public Segment() {
}
/**
- * Instantiates a new Segment with the specified metadata.
+ * Creates a segment with the given metadata.
*
* @param metadata the metadata
*/
@@ -64,9 +64,9 @@ public Segment(Metadata metadata) {
}
/**
- * Retrieves the condition that users' {@link Profile} must satisfy in order to be considered member of this Segment.
+ * Condition that profiles must satisfy to belong to this segment.
*
- * @return the condition that users must match
+ * @return the membership condition
*/
public Condition getCondition() {
return condition;
@@ -86,6 +86,7 @@ public void setCondition(Condition condition) {
* Implements YamlConvertible interface with circular reference detection.
*
* @param visited set of already visited objects to prevent infinite recursion (may be null)
+ * @param maxDepth maximum recursion depth to prevent stack overflow
* @return a Map representation of this segment
*/
@Override
diff --git a/api/src/main/java/org/apache/unomi/api/segments/SegmentsAndScores.java b/api/src/main/java/org/apache/unomi/api/segments/SegmentsAndScores.java
index f9fafaf3a..0ba7dd634 100644
--- a/api/src/main/java/org/apache/unomi/api/segments/SegmentsAndScores.java
+++ b/api/src/main/java/org/apache/unomi/api/segments/SegmentsAndScores.java
@@ -24,37 +24,39 @@
import java.util.Set;
/**
- * A combination of {@link Segment} and scores (usually associated with a {@link Profile}).
+ * Segment memberships and scoring totals for one {@link org.apache.unomi.api.Profile}.
+ * {@link org.apache.unomi.api.services.ProfileService} returns this snapshot when
+ * clients need both current segment ids and per-scoring-plan scores in a single
+ * response (for example after context resolution or profile reads).
*/
public class SegmentsAndScores implements Serializable {
private Set segments;
private Map scores;
/**
- * Instantiates a new SegmentsAndScores.
+ * Creates a snapshot with the given segment memberships and scores.
*
- * @param segments the set of segment identifiers
- * @param scores the scores as a Map of scoring name - associated score pairs
+ * @param segments segment identifiers
+ * @param scores map of scoring name to score value
*/
public SegmentsAndScores(Set segments, Map scores) {
this.segments = segments;
this.scores = scores;
}
-
/**
- * Retrieves the segments identifiers.
+ * Segment ids the profile belongs to.
*
- * @return the segments identifiers
+ * @return segment identifiers
*/
public Set getSegments() {
return segments;
}
/**
- * Retrieves the scores as a Map of scoring name - associated score pairs.
+ * Scoring totals keyed by scoring plan name.
*
- * @return the scores as a Map of scoring name - associated score pairs
+ * @return map of scoring name to score value
*/
public Map getScores() {
return scores;
diff --git a/api/src/main/java/org/apache/unomi/api/services/ClusterService.java b/api/src/main/java/org/apache/unomi/api/services/ClusterService.java
index f100be286..7d81d095a 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ClusterService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ClusterService.java
@@ -23,30 +23,31 @@
import java.util.List;
/**
- * A service to access information about the context server's cluster.
- *
+ * Access point for cluster topology and node health.
+ * Returns {@link ClusterNode} records and coordinates cluster-wide
+ * operations such as viewing which nodes store data.
*/
public interface ClusterService {
/**
- * Retrieves the list of available nodes for this context server instance.
+ * Returns cluster nodes known to this instance.
*
- * @return a list of {@link ClusterNode}
+ * @return cluster nodes in the current topology
*/
List getClusterNodes();
/**
- * Removes all data before the specified date from the context server.
+ * Deletes all persisted data older than the given cutoff date.
*
- * @param date the Date before which all data needs to be removed
+ * @param date cutoff; data before this date is removed
*/
@Deprecated
void purge(final Date date);
/**
- * Removes all data associated with the provided scope.
+ * Deletes all persisted data belonging to the given scope.
*
- * @param scope the scope for which we want to remove data
+ * @param scope scope whose data should be removed
*/
void purge(final String scope);
diff --git a/api/src/main/java/org/apache/unomi/api/services/ConditionValidationService.java b/api/src/main/java/org/apache/unomi/api/services/ConditionValidationService.java
index 2f77c95a8..b25cdebef 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ConditionValidationService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ConditionValidationService.java
@@ -40,7 +40,7 @@ public interface ConditionValidationService {
* ({@code script::}). Only literal parameter values are validated.
*
* @param condition the condition to validate
- * @return a list of validation errors, empty when the condition is valid
+ * @return validation errors, or an empty list when valid
*/
List validate(Condition condition);
@@ -57,7 +57,7 @@ class ValidationError {
private final ValidationError parentError;
/**
- * Instantiates a validation error for a single parameter.
+ * Creates a validation error for a single parameter.
*
* @param parameterName the parameter that caused the error
* @param message the error description
@@ -68,7 +68,7 @@ public ValidationError(String parameterName, String message, ValidationErrorType
}
/**
- * Instantiates a validation error with full condition context and optional parent error.
+ * Creates a validation error with full condition context and optional parent error.
*
* @param parameterName the parameter that caused the error
* @param message the error description
@@ -91,45 +91,45 @@ public ValidationError(String parameterName, String message, ValidationErrorType
}
/**
- * Retrieves the name of the parameter that caused the error.
+ * Parameter that failed validation.
*
- * @return the parameter name, or {@code null} if not applicable
+ * @return parameter name, or {@code null} if not applicable
*/
public String getParameterName() {
return parameterName;
}
/**
- * Retrieves the error description message.
+ * Human-readable error description.
*
- * @return the error message
+ * @return error message
*/
public String getMessage() {
return message;
}
/**
- * Retrieves the type of validation error.
+ * Category of validation failure.
*
- * @return the error type
+ * @return error type
*/
public ValidationErrorType getType() {
return type;
}
/**
- * Retrieves the identifier of the condition associated with this error.
+ * Condition instance that failed validation.
*
- * @return the condition identifier, or {@code null} if not applicable
+ * @return condition identifier, or {@code null} if not applicable
*/
public String getConditionId() {
return conditionId;
}
/**
- * Retrieves the identifier of the condition type associated with this error.
+ * Condition type definition that was validated.
*
- * @return the condition type identifier, or {@code null} if not applicable
+ * @return condition type identifier, or {@code null} if not applicable
*/
public String getConditionTypeId() {
return conditionTypeId;
@@ -137,6 +137,8 @@ public String getConditionTypeId() {
/**
* @deprecated Use {@link #getConditionTypeId()} instead.
+ *
+ * @return condition type identifier (same as {@link #getConditionTypeId()})
*/
@Deprecated
public String getConditionTypeName() {
@@ -144,27 +146,27 @@ public String getConditionTypeName() {
}
/**
- * Retrieves a copy of the additional context map for this error.
+ * Defensive copy of supplemental error context.
*
- * @return the context map
+ * @return context map
*/
public Map getContext() {
return new HashMap<>(context);
}
/**
- * Retrieves the parent error that caused this error, if any.
+ * Underlying error that caused this one, when chained.
*
- * @return the parent error, or {@code null} if none
+ * @return parent error, or {@code null} if none
*/
public ValidationError getParentError() {
return parentError;
}
/**
- * Retrieves a detailed error message including condition, parameter, context, and parent error information.
+ * Builds a message with condition, parameter, context, and parent-error details.
*
- * @return the detailed error message
+ * @return detailed error message
*/
public String getDetailedMessage() {
StringBuilder sb = new StringBuilder();
@@ -231,14 +233,19 @@ enum ValidationErrorType {
private final String description;
+ /**
+ * Associates a human-readable label with this error category.
+ *
+ * @param description descriptive text for this error type
+ */
ValidationErrorType(String description) {
this.description = description;
}
/**
- * Retrieves the human-readable description of this error type.
+ * Human-readable label for this error category.
*
- * @return the error type description
+ * @return error type description
*/
public String getDescription() {
return description;
diff --git a/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java b/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java
index d847905e5..03309e309 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ConfigSharingService.java
@@ -34,7 +34,7 @@
public interface ConfigSharingService {
/**
- * Retrieves the value of the named property.
+ * Value of the named property.
*
* @param name the property name
* @return the property value, or {@code null} if not set
@@ -67,7 +67,7 @@ public interface ConfigSharingService {
Object removeProperty(String name);
/**
- * Retrieves the names of all currently known properties.
+ * Names of all currently known properties.
*
* @return the property names
*/
@@ -94,7 +94,7 @@ public enum ConfigChangeEventType {
private Object newValue;
/**
- * Instantiates a configuration change event.
+ * Creates a configuration change event.
*
* @param eventType the type of change
* @param name the property name
@@ -109,7 +109,7 @@ public ConfigChangeEvent(ConfigChangeEventType eventType, String name, Object ol
}
/**
- * Retrieves the type of configuration change.
+ * Type of configuration change.
*
* @return the event type
*/
@@ -118,7 +118,7 @@ public ConfigChangeEventType getEventType() {
}
/**
- * Retrieves the name of the changed property.
+ * Name of the changed property.
*
* @return the property name
*/
@@ -127,7 +127,7 @@ public String getName() {
}
/**
- * Retrieves the previous value of the property.
+ * Previous value of the property.
*
* @return the old value, or {@code null} for {@link ConfigChangeEventType#ADDED} events
*/
@@ -136,7 +136,7 @@ public Object getOldValue() {
}
/**
- * Retrieves the new value of the property.
+ * New value of the property.
*
* @return the new value, or {@code null} for {@link ConfigChangeEventType#REMOVED} events
*/
diff --git a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
index 03da8090b..dd88845c7 100644
--- a/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/DefinitionsService.java
@@ -31,203 +31,203 @@
import java.util.Set;
/**
- * A service to retrieve definition information about core context server entities such as conditions, actions and values.
+ * Registry of built-in and plugin condition, action, and value type definitions.
+ * Used when loading rules from JSON, validating conditions, and resolving
+ * type metadata in the administration UI.
*/
public interface DefinitionsService {
/**
- * Retrieves all condition types.
+ * Returns every registered condition type.
*
- * @return a Collection of all collection types
+ * @return all condition types
*/
Collection getAllConditionTypes();
/**
- * Retrieves the set of condition types with the specified tag.
+ * Returns condition types tagged with the given tag, including sub-tags.
*
- * @param tag the tag marking the condition types we want to retrieve
- * @return the set of condition types with the specified tag (and its sub-tags, if specified)
+ * @param tag tag marking the condition types to include
+ * @return condition types with the specified tag
*/
Set getConditionTypesByTag(String tag);
/**
- * Retrieves the set of condition types with the specified system tag.
+ * Returns condition types with the given system tag, including sub-tags.
*
- * @param tag the system tag marking the condition types we want to retrieve
- * @return the set of condition types with the specified tag (and its sub-tags, if specified)
+ * @param tag system tag marking the condition types to include
+ * @return condition types with the specified system tag
*/
Set getConditionTypesBySystemTag(String tag);
/**
- * Retrieves the condition type associated with the specified identifier.
+ * Looks up a condition type by id.
*
- * @param id the identifier of the condition type to retrieve
- * @return the condition type associated with the specified identifier or {@code null} if no such condition type exists
+ * @param id condition type identifier
+ * @return matching condition type, or {@code null} if none exists
*/
ConditionType getConditionType(String id);
/**
- * Stores the condition type
+ * Registers or updates a condition type definition.
*
- * @param conditionType the condition type to store
+ * @param conditionType condition type to store
*/
void setConditionType(ConditionType conditionType);
/**
- * Remove the condition type
+ * Removes a condition type definition.
*
- * @param id the condition type to remove
+ * @param id identifier of the condition type to remove
*/
void removeConditionType(String id);
/**
- * Retrieves all known action types.
+ * Returns every registered action type.
*
- * @return all known action types
+ * @return all action types
*/
Collection getAllActionTypes();
/**
- * Retrieves the set of action types with the specified tag.
+ * Returns action types tagged with the given tag.
*
- * @param tag the tag marking the action types we want to retrieve
- * @return the set of action types with the specified tag
+ * @param tag tag marking the action types to include
+ * @return action types with the specified tag
*/
Set getActionTypeByTag(String tag);
/**
- * Retrieves the set of action types with the specified system tag.
+ * Returns action types with the given system tag.
*
- * @param tag the system tag marking the action types we want to retrieve
- * @return the set of action types with the specified tag
+ * @param tag system tag marking the action types to include
+ * @return action types with the specified system tag
*/
Set getActionTypeBySystemTag(String tag);
/**
- * Retrieves the action type associated with the specified identifier.
+ * Looks up an action type by id.
*
- * @param id the identifier of the action type to retrieve
- * @return the action type associated with the specified identifier or {@code null} if no such action type exists
+ * @param id action type identifier
+ * @return matching action type, or {@code null} if none exists
*/
ActionType getActionType(String id);
/**
- * Stores the action type
+ * Registers or updates an action type definition.
*
- * @param actionType the action type to store
+ * @param actionType action type to store
*/
void setActionType(ActionType actionType);
/**
- * Remove the action type
+ * Removes an action type definition.
*
- * @param id the action type to remove
+ * @param id identifier of the action type to remove
*/
void removeActionType(String id);
/**
- * Retrieves all known value types.
+ * Returns every registered value type.
*
- * @return all known value types
+ * @return all value types
*/
Collection getAllValueTypes();
/**
- * Retrieves the set of value types with the specified tag.
+ * Returns value types tagged with the given tag.
*
- * @param tag the tag marking the value types we want to retrieve
- * @return the set of value types with the specified tag
+ * @param tag tag marking the value types to include
+ * @return value types with the specified tag
*/
Set getValueTypeByTag(String tag);
/**
- * Retrieves the value type associated with the specified identifier.
+ * Looks up a value type by id.
*
- * @param id the identifier of the value type to retrieve
- * @return the value type associated with the specified identifier or {@code null} if no such value type exists
+ * @param id value type identifier
+ * @return matching value type, or {@code null} if none exists
*/
ValueType getValueType(String id);
/**
- * Stores the value type
+ * Registers or updates a value type definition.
*
- * @param valueType the value type to store
+ * @param valueType value type to store
*/
void setValueType(ValueType valueType);
/**
- * Remove the value type
+ * Removes a value type definition.
*
- * @param id the value type to remove
+ * @param id identifier of the value type to remove
*/
void removeValueType(String id);
/**
- * Retrieves a Map of plugin identifier to a list of plugin types defined by that particular plugin.
+ * Groups registered plugin types by plugin id.
*
- * @return a Map of plugin identifier to a list of plugin types defined by that particular plugin
+ * @return map of plugin id to plugin types defined by that plugin
*/
Map> getTypesByPlugin();
/**
- * Retrieves the property merge strategy type associated with the specified identifier.
+ * Looks up a property merge strategy type by id.
*
- * @param id the identifier of the property merge strategy type to retrieve
- * @return the property merge strategy type associated with the specified identifier or {@code null} if no such property merge strategy type exists
+ * @param id property merge strategy type identifier
+ * @return matching type, or {@code null} if none exists
*/
PropertyMergeStrategyType getPropertyMergeStrategyType(String id);
/**
- * Stores the property merge strategy type
+ * Registers or updates a property merge strategy type.
*
- * @param propertyMergeStrategyType the property merge strategy type to store
+ * @param propertyMergeStrategyType property merge strategy type to store
*/
void setPropertyMergeStrategyType(PropertyMergeStrategyType propertyMergeStrategyType);
/**
- * Remove the property merge strategy type
+ * Removes a property merge strategy type definition.
*
- * @param id the property merge strategy type to remove
+ * @param id identifier of the property merge strategy type to remove
*/
void removePropertyMergeStrategyType(String id);
/**
- * Retrieves all known property merge strategy types.
+ * Returns every registered property merge strategy type.
*
- * @return all known property merge strategy types
+ * @return all property merge strategy types
*/
Collection getAllPropertyMergeStrategyTypes();
/**
- * Retrieves all conditions of the specified type from the specified root condition.
+ * Collects nested conditions of the given type from a root condition tree.
*
- * TODO: remove?
*
- * @param rootCondition the condition from which we want to extract all conditions with the specified type
- * @param typeId the identifier of the condition type we want conditions to extract to match
- * @return a set of conditions contained in the specified root condition and matching the specified condition type or an empty set if no such condition exists
+ * @param rootCondition condition tree to walk
+ * @param typeId condition type id to match
+ * @return matching nested conditions, or an empty list if none
*/
List extractConditionsByType(Condition rootCondition, String typeId);
/**
- * Retrieves a condition matching the specified tag identifier from the specified root condition.
+ * Finds the first nested condition tagged with the given tag in a root condition tree.
*
- * TODO: remove from API and move to a different class?
- * TODO: purpose and behavior not clear
+ * Deprecated helper that may move out of this service in a future release.
*
- * @param rootCondition the root condition where to start the extraction by class
- * @param tag the tag to use to extract the condition
- * @return Condition the condition that has been found matching the tag, or null if none matched
+ * @param rootCondition condition tree to walk
+ * @param tag tag used to select a condition
+ * @return first matching condition, or {@code null} if none
* @deprecated As of 1.2.0-incubating, please use {@link #extractConditionBySystemTag(Condition, String)} instead
*/
@Deprecated
Condition extractConditionByTag(Condition rootCondition, String tag);
/**
- * Retrieves a condition matching the specified system tag identifier from the specified root condition.
+ * Finds the first nested condition with the given system tag in a root condition tree.
*
- * @param rootCondition the root condition where to start the extraction by class
- * @param systemTag the tag to use to extract the condition
- * @return Condition the condition that has been found matching the tag, or null if none matched
+ * @param rootCondition condition tree to walk
+ * @param systemTag system tag used to select a condition
+ * @return first matching condition, or {@code null} if none
*/
Condition extractConditionBySystemTag(Condition rootCondition, String systemTag);
@@ -261,26 +261,23 @@ public interface DefinitionsService {
void refresh();
/**
- * Gets the condition builder instance.
+ * Returns the shared condition builder for programmatic condition construction.
*
- * @return the condition builder instance
+ * @return condition builder instance
*/
ConditionBuilder getConditionBuilder();
/**
- * Gets the TypeResolutionService instance.
- * This service handles type resolution and invalid object tracking.
+ * Returns the type resolution service for condition and action type lookup.
*
- * @return the TypeResolutionService instance
+ * @return type resolution service instance
*/
TypeResolutionService getTypeResolutionService();
/**
- * Gets the ConditionValidationService instance.
- * This service validates conditions against their type definitions.
- * The service automatically resolves condition types if needed before validation.
+ * Returns the condition validation service, which resolves types before validating parameters.
*
- * @return the ConditionValidationService instance
+ * @return condition validation service instance
*/
ConditionValidationService getConditionValidationService();
}
diff --git a/api/src/main/java/org/apache/unomi/api/services/EventListenerService.java b/api/src/main/java/org/apache/unomi/api/services/EventListenerService.java
index 00bccb07e..8a5a4d46a 100644
--- a/api/src/main/java/org/apache/unomi/api/services/EventListenerService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/EventListenerService.java
@@ -20,7 +20,9 @@
import org.apache.unomi.api.Event;
/**
- * A service that gets notified (via {@link #onEvent(Event)}) whenever an event it can handle as decided by {@link #canHandle(Event)} occurs in the context server.
+ * Callback invoked for each {@link Event} the listener chooses to handle.
+ * Plugins implement this interface to react to events in real time alongside
+ * the rules engine.
*/
public interface EventListenerService {
diff --git a/api/src/main/java/org/apache/unomi/api/services/EventService.java b/api/src/main/java/org/apache/unomi/api/services/EventService.java
index d68a2c703..d6634bce2 100644
--- a/api/src/main/java/org/apache/unomi/api/services/EventService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/EventService.java
@@ -29,7 +29,9 @@
import java.util.Set;
/**
- * A service to publish events, notably issued from user interactions with tracked entities, in the context server.
+ * Publishes and retrieves {@link Event}s in the context server.
+ * Client integrations send visitor actions here; rules and listeners
+ * consume the same event stream.
*/
public interface EventService {
@@ -51,112 +53,106 @@ public interface EventService {
int PROFILE_UPDATED = 4;
/**
- * Propagates the specified event in the context server, notifying
- * {@link EventListenerService} instances if needed. If the event is persistent ({@link Event#isPersistent()}, it will be persisted appropriately. Once the event is
- * propagated, any {@link ActionPostExecutor} the event defined will be executed and the user profile updated if needed.
+ * Publishes an event, notifying listeners and persisting it when marked persistent.
+ * Runs post-actions and updates the profile or session when rules require it.
*
- * @param event the Event to be propagated
- * @return the result of the event handling as combination of EventService flags, to be checked using bitwise AND (&) operator
+ * @param event event to propagate
+ * @return bitmask of {@link #NO_CHANGE}, {@link #ERROR}, {@link #SESSION_UPDATED}, and {@link #PROFILE_UPDATED}
*/
int send(Event event);
/**
- * Check if the tenant is allowed to send the specified event. Restricted events must be explicitly allowed for a tenant.
+ * Checks whether the tenant may send the given event.
+ * Restricted event types must be explicitly allowed per tenant.
*
- * @param event event to test
- * @param tenantId the ID of the tenant
- * @param sourceIP the IP address from which the event was sent (not persisted for privacy)
- * @return true if the event is allowed for the tenant
+ * @param event event to test
+ * @param tenantId tenant identifier
+ * @param sourceIP client IP (not persisted for privacy)
+ * @return {@code true} if the event is allowed
*/
boolean isEventAllowedForTenant(Event event, String tenantId, String sourceIP);
/**
- * Retrieves the list of available event properties.
+ * Returns known event property definitions.
*
- * @return a list of available event properties
+ * @return available event properties
* @deprecated use event types instead
*/
List getEventProperties();
/**
- * Retrieves the set of known event type identifiers.
+ * Returns ids of all registered event types.
*
- * @return the set of known event type identifiers.
+ * @return known event type identifiers
*/
Set getEventTypeIds();
/**
- * Retrieves {@link Event}s matching the specified {@link Condition}. Events are ordered according to their time stamp ({@link Event#getTimeStamp()} and paged: only
- * {@code size} of them are retrieved, starting with the {@code offset}-th one.
+ * Searches events matching a condition, ordered by timestamp and paged.
*
- * @param condition the Condition we want the Events to match to be retrieved
- * @param offset zero or a positive integer specifying the position of the first event in the total ordered collection of matching events
- * @param size a positive integer specifying how many matching events should be retrieved or {@code -1} if all of them should be retrieved
- * @return a {@link PartialList} of matching events
+ * @param condition filter condition
+ * @param offset zero-based index of the first result
+ * @param size maximum results to return, or {@code -1} for all
+ * @return matching events
*/
PartialList searchEvents(Condition condition, int offset, int size);
/**
- * Retrieves {@link Event}s for the {@link Session} identified by the provided session identifier, matching any of the provided event types,
- * ordered according to the specified {@code sortBy} String and paged: only {@code size} of them are retrieved, starting with the {@code offset}-th one.
- * If a {@code query} is provided, a full text search is performed on the matching events to further filter them.
+ * Searches session events by type with optional full-text filtering, ordered and paged.
*
- * @param sessionId the identifier of the user session we're considering
- * @param eventTypes an array of event type names; the events to retrieve should at least match one of these
- * @param query a String to perform full text filtering on events matching the other conditions
- * @param offset zero or a positive integer specifying the position of the first event in the total ordered collection of matching events
- * @param size a positive integer specifying how many matching events should be retrieved or {@code -1} if all of them should be retrieved
- * @param sortBy an optional ({@code null} if no sorting is required) String of comma ({@code ,}) 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 ({@code :}) and an order specifier: {@code asc} or {@code desc}.
- * @return a {@link PartialList} of matching events
+ * @param sessionId session identifier
+ * @param eventTypes event types to include (any match)
+ * @param query optional full-text filter, or {@code null}
+ * @param offset zero-based index of the first result
+ * @param size maximum results to return, or {@code -1} for all
+ * @param sortBy optional comma-separated property list with optional {@code :asc}/{@code :desc} suffixes
+ * @return matching events
*/
PartialList searchEvents(String sessionId, String[] eventTypes, String query, int offset, int size, String sortBy);
/**
- * Retrieves {@link Event}s matching the specified {@link Query}.
+ * Searches events using a structured query.
*
- * @param query a {@link Query} specifying which Events to retrieve
- * @return a {@link PartialList} of {@code Event} instances matching the specified query
+ * @param query query specifying which events to return
+ * @return matching events
*/
PartialList search(Query query);
-
/**
- * Retrieves the {@link Event} by its identifier.
+ * Loads an event by id.
*
- * @param id the identifier of the {@link Event} to retrieve
- * @return the {@link Event} identified by the specified identifier or {@code null} if no such profile exists
+ * @param id event identifier
+ * @return matching event, or {@code null} if none exists
*/
Event getEvent(final String id);
/**
- * Checks whether the specified event has already been raised either for the associated session or profile depending on the specified {@code session} parameter.
+ * Checks whether an equivalent event was already raised for the session or profile.
*
- * @param event the event we want to check
- * @param session {@code true} if we want to check if the specified event has already been raised for the associated session, {@code false} if we want to check
- * whether the event has already been raised for the associated profile
- * @return {@code true} if the event has already been raised, {@code false} otherwise
+ * @param event event to check
+ * @param session {@code true} to check the session history, {@code false} for the profile history
+ * @return {@code true} if a matching event already exists
*/
boolean hasEventAlreadyBeenRaised(Event event, boolean session);
/**
- * Checks whether the specified event has already been raised with the same itemId.
+ * Checks whether an event with the same item id was already raised.
*
- * @param event the event we want to check
- * @return {@code true} if the event has already been raised, {@code false} otherwise
+ * @param event event to check
+ * @return {@code true} if a matching event already exists
*/
boolean hasEventAlreadyBeenRaised(Event event);
/**
- * Removes all events of the specified profile
+ * Deletes all events belonging to the given profile.
*
- * @param profileId identifier of the profile that we want to remove it's events
+ * @param profileId profile whose events should be removed
*/
void removeProfileEvents(String profileId);
/**
- * Delete an event by specifying its event identifier
- * @param eventIdentifier the unique identifier for the event
+ * Deletes a single event by id.
+ *
+ * @param eventIdentifier event identifier
*/
void deleteEvent(String eventIdentifier);
}
diff --git a/api/src/main/java/org/apache/unomi/api/services/ExecutionContextManager.java b/api/src/main/java/org/apache/unomi/api/services/ExecutionContextManager.java
index da1ab18a0..64011c5ac 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ExecutionContextManager.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ExecutionContextManager.java
@@ -21,24 +21,28 @@
import java.util.function.Supplier;
/**
- * Service interface for managing execution contexts in Unomi.
+ * Creates and binds {@link ExecutionContext} instances to the current thread.
+ * Ensures service calls run with the correct tenant and security credentials.
*/
public interface ExecutionContextManager {
/**
* Gets the current execution context.
+ *
* @return the current execution context
*/
ExecutionContext getCurrentContext();
/**
* Sets the current execution context.
+ *
* @param context the context to set as current
*/
void setCurrentContext(ExecutionContext context);
/**
* Executes an operation as the system user.
+ *
* @param operation the operation to execute
* @param the return type of the operation
* @return the result of the operation
@@ -47,6 +51,7 @@ public interface ExecutionContextManager {
/**
* Executes an operation as the system user without return value.
+ *
* @param operation the operation to execute
*/
void executeAsSystem(Runnable operation);
@@ -54,6 +59,7 @@ public interface ExecutionContextManager {
/**
* Executes an operation as a specific tenant.
* This method creates a tenant context, executes the operation, and ensures proper cleanup.
+ *
* @param tenantId the ID of the tenant to execute as
* @param operation the operation to execute
* @param the return type of the operation
@@ -64,6 +70,7 @@ public interface ExecutionContextManager {
/**
* Executes an operation as a specific tenant without return value.
* This method creates a tenant context, executes the operation, and ensures proper cleanup.
+ *
* @param tenantId the ID of the tenant to execute as
* @param operation the operation to execute
*/
@@ -71,6 +78,7 @@ public interface ExecutionContextManager {
/**
* Creates a new execution context for the given tenant.
+ *
* @param tenantId the tenant ID
* @return the created execution context
*/
diff --git a/api/src/main/java/org/apache/unomi/api/services/GoalsService.java b/api/src/main/java/org/apache/unomi/api/services/GoalsService.java
index 08e384e36..a4d938153 100644
--- a/api/src/main/java/org/apache/unomi/api/services/GoalsService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/GoalsService.java
@@ -31,141 +31,143 @@
import java.util.Set;
/**
- * A service to interact with {@link Goal}s and {@link Campaign}s.
+ * CRUD and reporting API for {@link org.apache.unomi.api.goals.Goal}s and
+ * {@link Campaign}s. Manages goal definitions, campaign lifecycle, and
+ * related statistics.
*/
public interface GoalsService {
/**
- * Retrieves the set of Metadata associated with existing goals.
+ * Returns metadata for all goals.
*
- * @return the set of Metadata associated with existing goals
+ * @return goal metadata entries
*/
Set getGoalMetadatas();
/**
- * Retrieves the set of Metadata associated with existing goals matching the specified {@link Query}
+ * Returns metadata for goals matching the given query.
*
- * @param query the Query used to filter the Goals which metadata we want to retrieve
- * @return the set of Metadata associated with existing goals matching the specified {@link Query}
+ * @param query filter for goals whose metadata should be returned
+ * @return matching goal metadata entries
*/
Set getGoalMetadatas(Query query);
/**
- * Retrieves the goal associated with the specified identifier.
+ * Loads a goal by id.
*
- * @param goalId the identifier of the goal to retrieve
- * @return the goal associated with the specified identifier or {@code null} if no such goal exists
+ * @param goalId goal identifier
+ * @return matching goal, or {@code null} if none exists
*/
Goal getGoal(String goalId);
/**
- * Saves the specified goal in the context server and creates associated {@link Rule}s if the goal is enabled.
+ * Saves a goal and creates associated rules when the goal is enabled.
*
- * TODO: rename to saveGoal
+ * The {@code setGoal} name is historical; a {@code saveGoal} alias may be added later.
*
- * @param goal the Goal to be saved
+ * @param goal goal to save
*/
void setGoal(Goal goal);
/**
- * Removes the goal associated with the specified identifier, also removing associated rules if needed.
+ * Deletes a goal and its associated rules when present.
*
- * @param goalId the identifier of the goal to be removed
+ * @param goalId goal identifier
*/
void removeGoal(String goalId);
/**
- * Retrieves the report for the goal identified with the specified identifier.
+ * Builds a performance report for the given goal.
*
- * @param goalId the identifier of the goal which report we want to retrieve
- * @return the report for the specified goal
+ * @param goalId goal identifier
+ * @return goal report
*/
GoalReport getGoalReport(String goalId);
/**
- * Retrieves the report for the goal identified with the specified identifier, considering only elements determined by the specified {@link AggregateQuery}.
+ * Builds a performance report for the given goal, filtered by an aggregate query.
*
- * @param goalId the identifier of the goal which report we want to retrieve
- * @param query an AggregateQuery to further specify which elements of the report we want
- * @return the report for the specified goal and query
+ * @param goalId goal identifier
+ * @param query aggregate query limiting report elements
+ * @return goal report for the query scope
*/
GoalReport getGoalReport(String goalId, AggregateQuery query);
/**
- * Retrieves the set of Metadata associated with existing campaigns.
+ * Returns metadata for all campaigns.
*
- * @return the set of Metadata associated with existing campaigns
+ * @return campaign metadata entries
*/
Set getCampaignMetadatas();
/**
- * Retrieves the set of Metadata associated with existing campaign matching the specified {@link Query}
+ * Returns metadata for campaigns matching the given query.
*
- * @param query the Query used to filter the campagins which metadata we want to retrieve
- * @return the set of Metadata associated with existing campaigns matching the specified {@link Query}
+ * @param query filter for campaigns whose metadata should be returned
+ * @return matching campaign metadata entries
*/
Set getCampaignMetadatas(Query query);
/**
- * Retrieves campaign details for campaigns matching the specified query.
+ * Returns detailed campaign records matching the given query.
*
- * @param query the query specifying which campaigns to retrieve
- * @return a {@link PartialList} of campaign details for the campaigns matching the specified query
+ * @param query filter for campaigns to return
+ * @return matching campaign details
*/
PartialList getCampaignDetails(Query query);
/**
- * Retrieves the {@link CampaignDetail} associated with the campaign identified with the specified identifier
+ * Loads detailed campaign information by id.
*
- * @param id the identifier of the campaign for which we want to retrieve the details
- * @return the CampaignDetail for the campaign identified by the specified identifier or {@code null} if no such campaign exists
+ * @param id campaign identifier
+ * @return campaign details, or {@code null} if none exists
*/
CampaignDetail getCampaignDetail(String id);
/**
- * Retrieves the campaign identified by the specified identifier
+ * Loads a campaign by id.
*
- * @param campaignId the identifier of the campaign we want to retrieve
- * @return the campaign associated with the specified identifier or {@code null} if no such campaign exists
+ * @param campaignId campaign identifier
+ * @return matching campaign, or {@code null} if none exists
*/
Campaign getCampaign(String campaignId);
/**
- * Saves the specified campaign in the context server and creates associated {@link Rule}s if the campaign is enabled.
+ * Saves a campaign and creates associated rules when the campaign is enabled.
*
- * TODO: rename to saveCampaign
+ * The {@code setCampaign} name is historical; a {@code saveCampaign} alias may be added later.
*
- * @param campaign the Campaign to be saved
+ * @param campaign campaign to save
*/
void setCampaign(Campaign campaign);
/**
- * Removes the campaign associated with the specified identifier, also removing associated rules if needed.
+ * Deletes a campaign and its associated rules when present.
*
- * @param campaignId the identifier of the campaign to be removed
+ * @param campaignId campaign identifier
*/
void removeCampaign(String campaignId);
/**
- * Retrieves {@link CampaignEvent}s matching the specified query.
+ * Searches campaign events matching the given query.
*
- * @param query the Query specifying which CampaignEvents to retrieve
- * @return a {@link PartialList} of campaign events matching the specified query
+ * @param query filter for campaign events to return
+ * @return matching campaign events
*/
PartialList getEvents(Query query);
/**
- * Saves the specified campaign event in the context server.
+ * Saves a campaign event.
*
- * TODO: rename to saveCampaignEvent
+ * The {@code setEvent} name is historical; a {@code saveCampaignEvent} alias may be added later.
*
- * @param event the CampaignEvent to be saved
+ * @param event campaign event to save
*/
void setCampaignEvent(CampaignEvent event);
/**
- * Removes the campaign event associated with the specified identifier.
+ * Deletes a campaign event by id.
*
- * @param campaignEventId the identifier of the campaign event to be removed
+ * @param campaignEventId campaign event identifier
*/
void removeCampaignEvent(String campaignEventId);
}
diff --git a/api/src/main/java/org/apache/unomi/api/services/InvalidObjectInfo.java b/api/src/main/java/org/apache/unomi/api/services/InvalidObjectInfo.java
index 7307fb4bd..131cb31ea 100644
--- a/api/src/main/java/org/apache/unomi/api/services/InvalidObjectInfo.java
+++ b/api/src/main/java/org/apache/unomi/api/services/InvalidObjectInfo.java
@@ -23,7 +23,10 @@
import java.util.concurrent.atomic.AtomicLong;
/**
- * Information about an invalid object, including detailed reasons for invalidation.
+ * Accumulated record for a definition that references missing condition or action types.
+ * {@link org.apache.unomi.api.services.TypeResolutionService} creates and updates
+ * these entries when JSON rules, segments, or other items fail type resolution.
+ * Operators use the missing-type lists and encounter counts to fix broken imports.
*/
public class InvalidObjectInfo {
private final String objectType;
@@ -36,12 +39,29 @@ public class InvalidObjectInfo {
private final Set missingActionTypeIds;
private final Set contextNames;
+ /**
+ * Creates a record with type, id, and reason only.
+ *
+ * @param objectType invalid object type
+ * @param objectId invalid object id
+ * @param reason why the object is invalid
+ */
public InvalidObjectInfo(String objectType, String objectId, String reason) {
this(objectType, objectId, reason, null, null, null);
}
- public InvalidObjectInfo(String objectType, String objectId, String reason,
- List missingConditionTypeIds,
+ /**
+ * Creates a record with initial missing-type and context details.
+ *
+ * @param objectType invalid object type
+ * @param objectId invalid object id
+ * @param reason why the object is invalid
+ * @param missingConditionTypeIds missing condition types from the first encounter, or {@code null}
+ * @param missingActionTypeIds missing action types from the first encounter, or {@code null}
+ * @param contextName context where the object was first seen, or {@code null}
+ */
+ public InvalidObjectInfo(String objectType, String objectId, String reason,
+ List missingConditionTypeIds,
List missingActionTypeIds,
String contextName) {
this.objectType = objectType;
@@ -60,38 +80,83 @@ public InvalidObjectInfo(String objectType, String objectId, String reason,
}
}
+ /**
+ * Invalid object type.
+ *
+ * @return object type
+ */
public String getObjectType() {
return objectType;
}
+ /**
+ * Invalid object id.
+ *
+ * @return object id
+ */
public String getObjectId() {
return objectId;
}
+ /**
+ * Why the object failed validation.
+ *
+ * @return reason, or {@code null} if unset
+ */
public String getReason() {
return reason;
}
+ /**
+ * When this record was first created (milliseconds since epoch).
+ *
+ * @return first-seen timestamp
+ */
public long getFirstSeenTimestamp() {
return firstSeenTimestamp;
}
+ /**
+ * When this object was last seen as invalid (milliseconds since epoch).
+ *
+ * @return last-seen timestamp
+ */
public long getLastSeenTimestamp() {
return lastSeenTimestamp.get();
}
+ /**
+ * How many times this invalid object has been encountered.
+ *
+ * @return encounter count
+ */
public int getEncounterCount() {
return encounterCount.get();
}
+ /**
+ * Condition types that could not be resolved for this object.
+ *
+ * @return unmodifiable list of missing condition type ids
+ */
public List getMissingConditionTypeIds() {
return Collections.unmodifiableList(new ArrayList<>(missingConditionTypeIds));
}
+ /**
+ * Action types that could not be resolved for this object.
+ *
+ * @return unmodifiable list of missing action type ids
+ */
public List getMissingActionTypeIds() {
return Collections.unmodifiableList(new ArrayList<>(missingActionTypeIds));
}
+ /**
+ * Contexts where this invalid object was seen.
+ *
+ * @return unmodifiable set of context names
+ */
public Set getContextNames() {
return Collections.unmodifiableSet(contextNames);
}
@@ -102,9 +167,9 @@ public Set getContextNames() {
* {@code getMissingConditionTypeIds()}, {@code getMissingActionTypeIds()}, and
* {@code getContextNames()} are safe during concurrent writes.
*
- * @param missingConditionTypeIds additional missing condition type IDs found in this encounter
- * @param missingActionTypeIds additional missing action type IDs found in this encounter
- * @param contextName context where this encounter occurred
+ * @param missingConditionTypeIds additional missing condition type ids from this encounter
+ * @param missingActionTypeIds additional missing action type ids from this encounter
+ * @param contextName context where this encounter occurred
*/
public void updateEncounter(List missingConditionTypeIds,
List missingActionTypeIds,
@@ -160,4 +225,3 @@ public String toString() {
return sb.toString();
}
}
-
diff --git a/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java b/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java
index f4dea3d9d..bcd9a238c 100644
--- a/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/PersonalizationService.java
@@ -26,37 +26,39 @@
import java.util.Map;
/**
- * A service to fulfill personalization request.
+ * Resolves which content variants to show a visitor.
+ * Evaluates personalization requests against profiles, sessions, and
+ * segments, returning {@link PersonalizationResult} with matching content ids.
*/
public interface PersonalizationService {
/**
- * Check if an item is visible for the specified profile and session
+ * Evaluates whether personalized content is visible for the given profile and session.
*
- * @param profile The profile
- * @param session The session
- * @param personalizedContent Personalized content, containing a list of filters
- * @return If the content is visible or not
+ * @param profile visitor profile
+ * @param session visitor session
+ * @param personalizedContent content definition with filters to evaluate
+ * @return {@code true} if the content should be shown
*/
boolean filter(Profile profile, Session session, PersonalizedContent personalizedContent);
/**
- * Get the best match among a list of items, for the specified profile and session
+ * Selects the best-matching content variant for the given profile and session.
*
- * @param profile The profile
- * @param session The session
- * @param personalizationRequest Personalization request, containing the list of variants and the required strategy
- * @return The id of the best-matching variant
+ * @param profile visitor profile
+ * @param session visitor session
+ * @param personalizationRequest request with variants and selection strategy
+ * @return id of the best-matching variant
*/
String bestMatch(Profile profile, Session session, PersonalizationRequest personalizationRequest);
/**
- * Get a personalized list, filtered and sorted, based on the profile and session
+ * Filters and ranks content variants for the given profile and session.
*
- * @param profile The profile
- * @param session The session
- * @param personalizationRequest Personalization request, containing the list of variants and the required strategy
- * @return List of ids, based on user profile
+ * @param profile visitor profile
+ * @param session visitor session
+ * @param personalizationRequest request with variants and selection strategy
+ * @return ordered personalization result for the visitor
*/
PersonalizationResult personalizeList(Profile profile, Session session, PersonalizationRequest personalizationRequest);
@@ -69,34 +71,74 @@ class PersonalizationRequest {
private Map strategyOptions;
private List contents;
+ /**
+ * Request identifier.
+ *
+ * @return request id
+ */
public String getId() {
return id;
}
+ /**
+ * Sets the request identifier.
+ *
+ * @param id request id
+ */
public void setId(String id) {
this.id = id;
}
+ /**
+ * Personalization strategy name (for example {@code alwaysSet}).
+ *
+ * @return strategy name
+ */
public String getStrategy() {
return strategy;
}
+ /**
+ * Sets the personalization strategy name.
+ *
+ * @param strategy strategy name (for example {@code alwaysSet})
+ */
public void setStrategy(String strategy) {
this.strategy = strategy;
}
+ /**
+ * Content variants included in this request.
+ *
+ * @return personalized content items
+ */
public List getContents() {
return contents;
}
+ /**
+ * Sets the content variants for this request.
+ *
+ * @param contents personalized content items
+ */
public void setContents(List contents) {
this.contents = contents;
}
+ /**
+ * Strategy-specific options passed to the personalization engine.
+ *
+ * @return strategy options, or {@code null} if none
+ */
public Map getStrategyOptions() {
return strategyOptions;
}
+ /**
+ * Sets strategy-specific options for this request.
+ *
+ * @param strategyOptions strategy options map
+ */
public void setStrategyOptions(Map strategyOptions) {
this.strategyOptions = strategyOptions;
}
@@ -111,18 +153,18 @@ class PersonalizedContent {
private Map properties;
/**
- * Retrieves the filter identifier associated with this content filtering definition.
+ * Content variant identifier.
*
- * @return the filter identifier associated with this content filtering definition
+ * @return content id
*/
public String getId() {
return id;
}
/**
- * Sets the filter identifier associated with this content filtering definition.
+ * Sets the content variant identifier.
*
- * @param id the filter identifier associated with this content filtering definition
+ * @param id content id
*/
public void setId(String id) {
this.id = id;
@@ -130,7 +172,6 @@ public void setId(String id) {
/**
* Sets the filter identifier associated with this content filtering definition.
- *
* @param filterid the filter identifier associated with this content filtering definition
* @deprecated As of version 1.3.0-incubating, please use {@link #setId(String)} instead
*/
@@ -140,27 +181,37 @@ public void setFilterid(String filterid) {
}
/**
- * Retrieves the filters.
+ * Filters applied to this content variant.
*
- * @return the filters
+ * @return filter definitions
*/
public List getFilters() {
return filters;
}
/**
- * Sets the filters.
+ * Sets the filters for this content variant.
*
- * @param filters the filters
+ * @param filters filter definitions
*/
public void setFilters(List filters) {
this.filters = filters;
}
+ /**
+ * Additional properties attached to this content variant.
+ *
+ * @return content properties
+ */
public Map getProperties() {
return properties;
}
+ /**
+ * Sets additional properties for this content variant.
+ *
+ * @param properties content properties
+ */
public void setProperties(Map properties) {
this.properties = properties;
}
@@ -175,45 +226,55 @@ class Filter {
private Map properties;
/**
- * Retrieves the list of targets this filter applies on.
+ * Targets this filter should be evaluated against.
*
- * @return the applies on
+ * @return applicable targets
*/
public List getAppliesOn() {
return appliesOn;
}
/**
- * Specifies which targets this filter applies on.
+ * Sets the targets this filter applies to.
*
- * @param appliesOn the list of {@link Target} this filter should be applied on
+ * @param appliesOn applicable targets
*/
public void setAppliesOn(List appliesOn) {
this.appliesOn = appliesOn;
}
/**
- * Retrieves the condition associated with this filter.
+ * Condition evaluated when applying this filter.
*
- * @return the condition associated with this filter
+ * @return filter condition
*/
public Condition getCondition() {
return condition;
}
/**
- * Sets the condition associated with this filter.
+ * Sets the condition for this filter.
*
- * @param condition the condition associated with this filter
+ * @param condition filter condition
*/
public void setCondition(Condition condition) {
this.condition = condition;
}
+ /**
+ * Additional properties for this filter.
+ *
+ * @return filter properties map
+ */
public Map getProperties() {
return properties;
}
+ /**
+ * Sets additional properties for this filter.
+ *
+ * @param properties filter properties map
+ */
public void setProperties(Map properties) {
this.properties = properties;
}
@@ -227,36 +288,36 @@ class Target {
private List values;
/**
- * Retrieves the target.
+ * Target dimension name (for example profile property or segment).
*
- * @return the target
+ * @return target name
*/
public String getTarget() {
return target;
}
/**
- * Sets the target.
+ * Sets the target dimension name.
*
- * @param target the target
+ * @param target target name
*/
public void setTarget(String target) {
this.target = target;
}
/**
- * Retrieves the values.
+ * Allowed values for this target dimension.
*
- * @return the values
+ * @return target values
*/
public List getValues() {
return values;
}
/**
- * Sets the values.
+ * Sets allowed values for this target dimension.
*
- * @param values the values
+ * @param values target values
*/
public void setValues(List values) {
this.values = values;
diff --git a/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java b/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java
index 3f7d5554b..98fbeb074 100644
--- a/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/PrivacyService.java
@@ -23,137 +23,134 @@
import java.util.List;
/**
- * This service regroups all privacy-related operations
+ * Entry point for consent, anonymization, and privacy-related operations.
+ * Wraps profile updates required for GDPR-style requests and consent tracking.
*/
public interface PrivacyService {
/**
- * Retrieves the default base Apache Unomi server information, including the name and version of the server, build
- * time information and the event types
- * if recognizes as well as the capabilities supported by the system. For more detailed information about the system
- * and extensions use the getServerInfos method.
- * @return a ServerInfo object with all the server information
+ * Returns base server information (name, version, build time, event types, capabilities).
+ * For extension details, use {@link #getServerInfos()}.
+ *
+ * @return default server information
*/
ServerInfo getServerInfo();
/**
- * Retrieves the list of the server information objects, that include extensions. Each object includes the
- * name and version of the server, build time information and the event types
- * if recognizes as well as the capabilities supported by the system.
- * @return a list of ServerInfo objects with all the server information
+ * Returns server information for the core instance and all extensions.
+ *
+ * @return server information entries, including extensions
*/
List getServerInfos();
/**
- * Deletes the current profile (but has no effect on sessions and events). This will delete the
- * persisted profile and replace it with a new empty one with the same profileId.
- * @param profileId the identifier of the profile to delete and replace
- * @return true if the deletion was successful
+ * Replaces a profile with a new empty profile that keeps the same id.
+ * Sessions and events are not removed.
+ *
+ * @param profileId profile identifier
+ * @return {@code true} if deletion succeeded
*/
Boolean deleteProfile(String profileId);
/**
- * This method will "anonymize" a profile by removing from the associated profile all the properties
- * that have been defined as "denied properties".
- * @param profileId the identifier of the profile that needs to be anonymized.
- * @param scope The scope will be used to send events, once for the anonymizeProfile event, the other for the profileUpdated event
- * @return true if the profile had some properties purged, false otherwise
+ * Removes denied (personally identifying) properties from a profile.
+ *
+ * @param profileId profile identifier
+ * @param scope scope used when emitting anonymize and profile-updated events
+ * @return {@code true} if any properties were removed
*/
Boolean anonymizeProfile(String profileId, String scope);
/**
- * This method will anonymize browsing data by creating an anonymous profile for the current profile,
- * and then re-associating all the profile's sessions and events with the new anonymous profile
- * todo this method does not anonymize any session or event properties that may contain profile
- * data (such as the login event)
- * @param profileId the identifier of the profile on which to perform the anonymizations of the browsing
- * data
- * @return true if the operation was successful, false otherwise
+ * Moves a profile's sessions and events to a new anonymous profile.
+ * Does not anonymize session or event properties that may contain PII.
+ *
+ * @param profileId profile identifier
+ * @return {@code true} if the operation succeeded
*/
Boolean anonymizeBrowsingData(String profileId);
/**
- * This method will perform two operations, first it will call the anonymizeBrowsingData method on the
- * specified profile, and then it will delete the profile from the persistence service.
- * @param profileId the identifier of the profile
- * @param purgeData flag that indicates whether to purge the profile's data
- * @return true if the operation was successful, false otherwise
+ * Anonymizes browsing data, then optionally deletes the original profile.
+ *
+ * @param profileId profile identifier
+ * @param purgeData when {@code true}, deletes the profile after anonymization
+ * @return {@code true} if the operation succeeded
*/
Boolean deleteProfileData(String profileId,boolean purgeData);
/**
- * Controls the activation/deactivation of anonymous browsing. This method will simply set a system
- * property called requireAnonymousProfile that will be then use to know if we should associate
- * browsing data with the main profile or the associated anonymous profile.
- * Note that changing this setting will also reset the goals and pastEvents system properties for the
- * profile.
- * @param profileId the identifier of the profile on which to set the anonymous browsing property flag
- * @param anonymous the value of the anonymous browsing flag.
- * @param scope a scope used to send a profileUpdated event internally
- * @return true if successful, false otherwise
+ * Enables or disables anonymous browsing for a profile.
+ * Resets goals and past-events system properties when the flag changes.
+ *
+ * @param profileId profile identifier
+ * @param anonymous anonymous-browsing flag value
+ * @param scope scope used when emitting a profile-updated event
+ * @return {@code true} if the update succeeded
*/
Boolean setRequireAnonymousBrowsing(String profileId, boolean anonymous, String scope);
/**
- * Tests if the anonymous browsing flag is set of the specified profile.
- * @param profileId the identifier of the profile on which we want to retrieve the anonymous browsing flag
- * @return true if successful, false otherwise
+ * Checks whether anonymous browsing is required for the given profile id.
+ *
+ * @param profileId profile identifier
+ * @return {@code true} if anonymous browsing is required
*/
Boolean isRequireAnonymousBrowsing(String profileId);
/**
- * Tests if the anonymous browsing flag is set of the specified profile.
- * @param profile the profile on which we want to retrieve the anonymous browsing flag
- * @return true if successful, false otherwise
+ * Checks whether anonymous browsing is required for the given profile.
+ *
+ * @param profile profile to inspect
+ * @return {@code true} if anonymous browsing is required
*/
Boolean isRequireAnonymousBrowsing(Profile profile);
/**
- * Build a new anonymous profile (but doesn't persist it in the persistence service). This will also
- * copy the profile properties from the passed profile that are not listed as denied properties.
- * @param profile the profile for which to create the anonymous profile
- * @return a newly created (but not persisted) profile for the passed profile.
+ * Builds an anonymous profile copy without persisting it.
+ * Copies non-denied properties from the source profile.
+ *
+ * @param profile source profile
+ * @return new anonymous profile (not persisted)
*/
Profile getAnonymousProfile(Profile profile);
/**
- * Retrieve the list of events that the profile has deactivated. For each profile a visitor may indicate
- * that he doesn't want some events to be collected. This method retrieves this list from the specified
- * profile
- * @param profileId the identifier for the profile for which we want to retrieve the list of forbidden
- * event types
- * @return a list of event types
+ * Returns event types the visitor has opted out of collecting.
+ *
+ * @param profileId profile identifier
+ * @return blocked event type names
*/
List getFilteredEventTypes(String profileId);
/**
- * Retrieve the list of events that the profile has deactivated. For each profile a visitor may indicate
- * that he doesn't want some events to be collected. This method retrieves this list from the specified
- * profile
- * @param profile the profile for which we want to retrieve the list of forbidden
- * event types
- * @return a list of event types
+ * Returns event types the visitor has opted out of collecting.
+ *
+ * @param profile profile to inspect
+ * @return blocked event type names
*/
List getFilteredEventTypes(Profile profile);
/**
- * Set the list of filtered event types for a profile. This is the list of event types that the visitor
- * has specified he does not want the server to collect.
- * @param profileId the identifier of the profile on which to filter the events
- * @param eventTypes a list of event types that will be filter for the profile
- * @return true if successfull, false otherwise.
+ * Sets event types the visitor has opted out of collecting.
+ *
+ * @param profileId profile identifier
+ * @param eventTypes blocked event type names
+ * @return {@code true} if the update succeeded
*/
Boolean setFilteredEventTypes(String profileId, List eventTypes);
/**
- * Gets the list of denied properties. These are properties marked with a personal identifier tag.
- * @param profileId the identified of the profile
- * @return a list of profile properties identifiers that are marked as personally identifying
+ * Returns property names tagged as personally identifying for the profile.
+ *
+ * @param profileId profile identifier
+ * @return denied property identifiers
*/
List getDeniedProperties(String profileId);
/**
* Sets the list of denied properties.
+ *
* @param profileId the profile for which to see the denied properties
* @param propertyNames the property names to be denied
* @return null all the time, this method is not used and is marked as deprecated
@@ -165,6 +162,7 @@ public interface PrivacyService {
/**
* This method doesn't do anything anymore please don't use it
+ *
* @param profileId the identifier of the profile
* @return do not use
* @deprecated As of version 1.3.0-incubating, do not use this method
@@ -174,6 +172,7 @@ public interface PrivacyService {
/**
* This method doesn't do anything anymore please don't use it
+ *
* @param profileId the identifier of the profile
* @param propertyNames do not use
* @return do not use
@@ -183,10 +182,11 @@ public interface PrivacyService {
Boolean setDeniedPropertyDistribution(String profileId, List propertyNames);
/**
- * Removes a property from the specified profile. This change is persisted.
- * @param profileId the identifier of the profile
- * @param propertyName the name of the property to remove
- * @return true if sucessfull, false otherwise
+ * Removes a property from a profile and persists the change.
+ *
+ * @param profileId profile identifier
+ * @param propertyName property to remove
+ * @return {@code true} if the removal succeeded
*/
Boolean removeProperty(String profileId, String propertyName);
diff --git a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
index 78ecb1ffb..0c1041415 100644
--- a/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/ProfileService.java
@@ -25,431 +25,401 @@
import java.util.*;
/**
- * A service to access and operate on {@link Profile}s, {@link Session}s and {@link Persona}s.
+ * Primary API for {@link Profile}s, {@link Session}s, and {@link Persona}s.
+ * Loads and saves visitor data, merges profiles, manages sessions, and
+ * supports persona-based testing workflows.
*/
public interface ProfileService {
+ /**
+ * The system tag name used to identify property types that store
+ * personal identifiers.
+ */
String PERSONAL_IDENTIFIER_TAG_NAME = "personalIdentifierProperties";
/**
- * Retrieves the number of unique profiles.
+ * Returns the total number of profiles.
*
- * @return the number of unique profiles.
+ * @return profile count
*/
long getAllProfilesCount();
/**
- * Retrieves profiles or personas matching the specified query.
+ * Searches profiles or personas using a structured query.
*
- * @param the specific sub-type of {@link Profile} to retrieve
- * @param query a {@link Query} specifying which elements to retrieve
- * @param clazz the class of elements to retrieve
- * @return a {@link PartialList} of {@code T} instances matching the specified query
+ * @param profile subtype to return
+ * @param query search query
+ * @param clazz profile class to load
+ * @return matching profiles or personas
*/
PartialList search(Query query, Class clazz);
/**
- * Retrieves sessions matching the specified query.
+ * Searches sessions using a structured query.
*
- * @param query a {@link Query} specifying which elements to retrieve
- * @return a {@link PartialList} of sessions matching the specified query
+ * @param query search query
+ * @return matching sessions
*/
PartialList searchSessions(Query query);
/**
- * Creates a String containing comma-separated values (CSV) formatted version of profiles matching the specified query.
+ * Exports matching profile properties as a CSV string.
*
- * @param query the query specifying which profiles to export
- * @return a CSV-formatted String version of the profiles matching the specified query
+ * @param query search query selecting profiles to export
+ * @return CSV representation of matching profile properties
*/
String exportProfilesPropertiesToCsv(Query query);
/**
- * Find profiles which have the specified property with the specified value, ordered according to the specified {@code sortBy} String and paged: only
- * {@code size} of them are retrieved, starting with the {@code offset}-th one.
+ * Finds profiles with a given property value, ordered and paged.
*
- * TODO: replace with version using a query instead of separate parameters
- * TODO: remove as it's unused?
+ * Prefer {@link #search(Query, Class)} for new code; this overload remains for backward compatibility.
*
- * @param propertyName the name of the property we're interested in
- * @param propertyValue the value of the property we want profiles to have
- * @param offset zero or a positive integer specifying the position of the first profile in the total ordered collection of matching profiles
- * @param size a positive integer specifying how many matching profiles should be retrieved or {@code -1} if all of them should be retrieved
- * @param sortBy an optional ({@code null} if no sorting is required) String of comma ({@code ,}) 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 ({@code :}) and an order specifier: {@code asc} or {@code desc}.
- * @return a {@link PartialList} of matching profiles
+ * @param propertyName property name to match
+ * @param propertyValue required property value
+ * @param offset zero-based index of the first result
+ * @param size maximum results to return, or {@code -1} for all
+ * @param sortBy optional comma-separated property list with optional {@code :asc}/{@code :desc} suffixes
+ * @return matching profiles
*/
PartialList findProfilesByPropertyValue(String propertyName, String propertyValue, int offset, int size, String sortBy);
/**
- * Merges the specified profiles into the provided so-called master profile, merging properties according to the {@link PropertyMergeStrategyType} specified on their {@link
- * PropertyType}.
+ * Merges profiles into a master profile using each property's merge strategy.
*
- * @param masterProfile the profile into which the specified profiles will be merged
- * @param profilesToMerge the list of profiles to merge into the specified master profile
- * @return the merged profile
+ * @param masterProfile profile that receives merged data
+ * @param profilesToMerge profiles to merge into the master
+ * @return merged master profile
*/
Profile mergeProfiles(Profile masterProfile, List profilesToMerge);
/**
- * Retrieves the profile identified by the specified identifier.
+ * Loads a profile by id.
*
- * @param profileId the identifier of the profile to retrieve
- * @return the profile identified by the specified identifier or {@code null} if no such profile exists
+ * @param profileId profile identifier
+ * @return matching profile, or {@code null} if none exists
*/
Profile load(String profileId);
/**
- * Saves the specified profile in the context server.
+ * Persists a profile.
*
- * @param profile the profile to be saved
- * @return the newly saved profile
+ * @param profile profile to save
+ * @return saved profile
*/
Profile save(Profile profile);
/**
- * Adds the alias to the profile.
+ * Links an alias to a profile for the given client.
*
- * @param profileID the identifier of the profile
- * @param alias the alias which should be linked with of the profile
- * @param clientID the identifier of the client
+ * @param profileID profile identifier
+ * @param alias alias to link
+ * @param clientID client identifier
*/
void addAliasToProfile(String profileID, String alias, String clientID);
/**
- * Removes the alias from the profile.
+ * Unlinks an alias from a profile for the given client.
*
- * @param profileID the identifier of the profile
- * @param alias the alias which should be unlinked from the profile
- * @param clientID the identifier of the client
- * @return the removed ProfileAlias, or null if not found
+ * @param profileID profile identifier
+ * @param alias alias to unlink
+ * @param clientID client identifier
+ * @return removed alias, or {@code null} if not found
*/
ProfileAlias removeAliasFromProfile(String profileID, String alias, String clientID);
/**
- * Find profile aliases which have the specified property with the specified value, ordered according to the specified {@code sortBy} String and paged: only
- * {@code size} of them are retrieved, starting with the {@code offset}-th one.
+ * Lists aliases linked to a profile, ordered and paged.
*
- * @param profileId the identifier of the profile
- * @param offset zero or a positive integer specifying the position of the first profile in the total ordered collection of matching profiles
- * @param size a positive integer specifying how many matching profiles should be retrieved or {@code -1} if all of them should be retrieved
- * @param sortBy an optional ({@code null} if no sorting is required) String of comma ({@code ,}) 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 ({@code :}) and an order specifier: {@code asc} or {@code desc}.
- * @return a {@link PartialList} of matching profiles
+ * @param profileId profile identifier
+ * @param offset zero-based index of the first result
+ * @param size maximum results to return, or {@code -1} for all
+ * @param sortBy optional comma-separated property list with optional {@code :asc}/{@code :desc} suffixes
+ * @return matching profile aliases
*/
PartialList findProfileAliases(String profileId, int offset, int size, String sortBy);
/**
- * Merge the specified profile properties in an existing profile,or save new profile if it does not exist yet
+ * Saves a new profile or merges properties into an existing one.
*
- * @param profile the profile to be saved
- * @return the newly saved or merged profile or null if the save or merge operation failed.
+ * @param profile profile to save or merge
+ * @return saved or merged profile, or {@code null} on failure
*/
Profile saveOrMerge(Profile profile);
/**
- * Removes the profile (or persona if the {@code persona} parameter is set to {@code true}) identified by the specified identifier.
+ * Deletes a profile or persona by id.
*
- * @param profileId the identifier of the profile or persona to delete
- * @param persona {@code true} if the specified identifier is supposed to refer to a persona, {@code false} if it is supposed to refer to a profile
+ * @param profileId profile or persona identifier
+ * @param persona {@code true} when deleting a persona, {@code false} for a profile
*/
void delete(String profileId, boolean persona);
/**
- * Retrieves the sessions associated with the profile identified by the specified identifier that match the specified query (if specified), ordered according to the specified
- * {@code sortBy} String and and paged: only {@code size} of them are retrieved, starting with the {@code offset}-th one.
- *
- * TODO: use a Query object instead of distinct parameter
+ * Lists a profile's sessions with optional full-text filtering, ordered and paged.
*
- * @param profileId the identifier of the profile we want to retrieve sessions from
- * @param query a String of text used for fulltext filtering which sessions we are interested in or {@code null} (or an empty String) if we want to retrieve all sessions
- * @param offset zero or a positive integer specifying the position of the first session in the total ordered collection of matching sessions
- * @param size a positive integer specifying how many matching sessions should be retrieved or {@code -1} if all of them should be retrieved
- * @param sortBy an optional ({@code null} if no sorting is required) String of comma ({@code ,}) 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 ({@code :}) and an order specifier: {@code asc} or {@code desc}.
- * @return a {@link PartialList} of matching sessions
+ * @param profileId profile identifier
+ * @param query optional full-text filter, or {@code null} for all sessions
+ * @param offset zero-based index of the first result
+ * @param size maximum results to return, or {@code -1} for all
+ * @param sortBy optional comma-separated property list with optional {@code :asc}/{@code :desc} suffixes
+ * @return matching sessions
*/
PartialList getProfileSessions(String profileId, String query, int offset, int size, String sortBy);
/**
- * Retrieves the session identified by the specified identifier.
- * @deprecated {@code dateHint} is not supported anymore, please use {@link #loadSession(String)}
+ * Loads a session by id.
*
- * @param sessionId the identifier of the session to be retrieved
- * @param dateHint a Date helping in identifying where the item is located
- * @return the session identified by the specified identifier
+ * @deprecated {@code dateHint} is not supported anymore; use {@link #loadSession(String)}
+ * @param sessionId session identifier
+ * @param dateHint unused date hint
+ * @return matching session
*/
@Deprecated
Session loadSession(String sessionId, Date dateHint);
/**
- * Retrieves the session identified by the specified identifier.
+ * Loads a session by id.
*
- * @param sessionId the identifier of the session to be retrieved
- * @return the session identified by the specified identifier
+ * @param sessionId session identifier
+ * @return matching session
*/
default Session loadSession(String sessionId) {
return loadSession(sessionId, null);
};
/**
- * Saves the specified session.
+ * Persists a session.
*
- * @param session the session to be saved
- * @return the newly saved session
+ * @param session session to save
+ * @return saved session
*/
Session saveSession(Session session);
/**
- * Retrieves sessions associated with the profile identified by the specified identifier.
+ * Returns all sessions linked to a profile.
*
- * @param profileId the profile id for which we want to retrieve the sessions
- * @return a {@link PartialList} of the profile's sessions
+ * @param profileId profile identifier
+ * @return profile sessions
*/
PartialList findProfileSessions(String profileId);
/**
- * Removes all sessions of the specified profile
+ * Deletes all sessions belonging to a profile.
*
- * @param profileId identifier of the profile that we want to remove it's sessions
+ * @param profileId profile identifier
*/
void removeProfileSessions(String profileId);
/**
- * Deletes the session identified by the given identifier from persistence.
- * Note: events belonging to this session are NOT removed; they remain in persistence
- * with a dangling sessionId reference.
+ * Deletes a session by id.
+ * Events for the session remain in persistence with a dangling session id.
*
- * @param sessionIdentifier the unique identifier for the session
+ * @param sessionIdentifier session identifier
*/
void deleteSession(String sessionIdentifier);
/**
- * Checks whether the specified profile and/or session satisfy the specified condition.
+ * Evaluates whether a profile and/or session satisfy a condition.
*
- * @param condition the condition we're testing against which might or might not have profile- or session-specific sub-conditions
- * @param profile the profile we're testing
- * @param session the session we're testing
- * @return {@code true} if the profile and/or sessions match the specified condition, {@code false} otherwise
+ * @param condition condition to test (may include profile- or session-specific parts)
+ * @param profile profile to evaluate
+ * @param session session to evaluate
+ * @return {@code true} when the condition matches
*/
boolean matchCondition(Condition condition, Profile profile, Session session);
/**
- * Update all profiles in batch according to the specified {@link BatchUpdate}
+ * Applies a batch update to matching profiles.
*
- * @param update the batch update specification
+ * @param update batch update specification
*/
void batchProfilesUpdate(BatchUpdate update);
/**
- * Retrieves the persona identified by the specified identifier.
+ * Loads a persona by id.
*
- * @param personaId the identifier of the persona to retrieve
- * @return the persona associated with the specified identifier or {@code null} if no such persona exists.
+ * @param personaId persona identifier
+ * @return matching persona, or {@code null} if none exists
*/
Persona loadPersona(String personaId);
/**
- * Persists the specified {@link Persona} in the context server.
+ * Persists a persona.
*
- * @param persona the persona to persist
- * @return the newly persisted persona
+ * @param persona persona to save
+ * @return saved persona
*/
Persona savePersona(Persona persona);
/**
- * Retrieves the persona identified by the specified identifier and all its associated sessions
+ * Loads a persona and all of its sessions.
*
- * @param personaId the identifier of the persona to retrieve
- * @return a {@link PersonaWithSessions} instance with the persona identified by the specified identifier and all its associated sessions
+ * @param personaId persona identifier
+ * @return persona with associated sessions
*/
PersonaWithSessions loadPersonaWithSessions(String personaId);
/**
- * Creates a persona with the specified identifier and automatically creates an associated session with it.
+ * Creates a persona and an initial session for it.
*
- * @param personaId the identifier to use for the new persona
- * @return the newly created persona
+ * @param personaId identifier for the new persona
+ * @return newly created persona
*/
Persona createPersona(String personaId);
/**
- * Retrieves the sessions associated with the persona identified by the specified identifier, ordered according to the specified {@code sortBy} String and and paged: only
- * {@code size} of them are retrieved, starting with the {@code offset}-th one.
+ * Lists persona sessions, ordered and paged.
*
- * @param personaId the persona id
- * @param offset zero or a positive integer specifying the position of the first session in the total ordered collection of matching sessions
- * @param size a positive integer specifying how many matching sessions should be retrieved or {@code -1} if all of them should be retrieved
- * @param sortBy an optional ({@code null} if no sorting is required) String of comma ({@code ,}) 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 ({@code :}) and an order specifier: {@code asc} or {@code desc}.
- * @return a {@link PartialList} of sessions for the persona identified by the specified identifier
+ * @param personaId persona identifier
+ * @param offset zero-based index of the first result
+ * @param size maximum results to return, or {@code -1} for all
+ * @param sortBy optional comma-separated property list with optional {@code :asc}/{@code :desc} suffixes
+ * @return matching persona sessions
*/
PartialList getPersonaSessions(String personaId, int offset, int size, String sortBy);
/**
- * Save a persona with its sessions.
+ * Persists a persona together with its sessions.
*
- * @param personaToSave the persona object containing all the persona information and sessions
- * @return the persona with sessions
+ * @param personaToSave persona and session data to save
+ * @return saved persona with sessions
*/
PersonaWithSessions savePersonaWithSessions(PersonaWithSessions personaToSave);
-
/**
- * Retrieves all the property types associated with the specified target.
- *
- * TODO: move to a different class
+ * Returns property types registered for the given target.
*
- * @param target the target for which we want to retrieve the associated property types
- * @return a collection of all the property types associated with the specified target
+ * @param target target name (for example profiles or events)
+ * @return property types for the target
*/
Collection getTargetPropertyTypes(String target);
/**
- * Retrieves all known property types.
+ * Returns all property types grouped by target.
*
- * TODO: move to a different class
- * TODO: use Map instead of HashMap
- *
- * @return a Map associating targets as keys to related {@link PropertyType}s
+ * @return map of target name to property types
*/
Map> getTargetPropertyTypes();
/**
- * Retrieves all property types with the specified tag
- *
- * TODO: move to a different class
+ * Returns property types tagged with the given tag.
*
- * @param tag the tag name marking property types we want to retrieve
- * @return a Set of the property types with the specified tag
+ * @param tag tag name
+ * @return matching property types
*/
Set getPropertyTypeByTag(String tag);
/**
- * Retrieves all property types with the specified system tag
+ * Returns property types with the given system tag.
*
- * TODO: move to a different class
- *
- * @param tag the system tag name marking property types we want to retrieve
- * @return a Set of the property types with the specified system tag
+ * @param tag system tag name
+ * @return matching property types
*/
Set getPropertyTypeBySystemTag(String tag);
/**
- * TODO
- * @param fromPropertyTypeId fromPropertyTypeId
- * @return property type mapping
+ * Returns the persistence mapping for a property type.
+ *
+ * @param fromPropertyTypeId source property type id
+ * @return mapped property type id
*/
String getPropertyTypeMapping(String fromPropertyTypeId);
/**
- * TODO
- * @param propertyName the property name
- * @return list of property types
+ * Returns property types mapped to the given property name.
+ *
+ * @param propertyName property name to look up
+ * @return matching property types
*/
Collection getPropertyTypeByMapping(String propertyName);
/**
- * Retrieves the property type identified by the specified identifier.
- *
- * TODO: move to a different class
+ * Looks up a property type by id.
*
- * @param id the identifier of the property type to retrieve
- * @return the property type identified by the specified identifier or {@code null} if no such property type exists
+ * @param id property type identifier
+ * @return matching property type, or {@code null} if none exists
*/
PropertyType getPropertyType(String id);
/**
- * Persists the specified property type in the context server.
- *
- * TODO: move to a different class
+ * Registers or updates a property type definition.
*
- * @param property the property type to persist
- * @return {@code true} if the property type was properly created, {@code false} otherwise (for example, if the property type already existed
+ * @param property property type to persist
+ * @return {@code true} when created, {@code false} when it already existed
*/
boolean setPropertyType(PropertyType property);
/**
- * This function will try to set the target on the property type if not set already, based on the file URL
+ * Infers and sets the property type target from a definition URL when missing.
+ * By default uses the fifth path segment after {@code /}.
*
- * @param 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 "/" character
- * @param propertyType the property type to register
+ * @param predefinedPropertyTypeURL URL of the property type definition
+ * @param propertyType property type to update
*/
void setPropertyTypeTarget(URL predefinedPropertyTypeURL, PropertyType propertyType);
/**
- * Deletes the property type identified by the specified identifier.
+ * Deletes a property type by id.
*
- * TODO: move to a different class
- *
- * @param propertyId the identifier of the property type to delete
- * @return {@code true} if the property type was properly deleted, {@code false} otherwise
+ * @param propertyId property type identifier
+ * @return {@code true} when deleted successfully
*/
boolean deletePropertyType(String propertyId);
/**
- * Retrieves the existing property types for the specified type as defined by the Item subclass public field {@code ITEM_TYPE} and with the specified tag.
- *
- * TODO: move to a different class
+ * Returns property types defined for an item type that carry the given tag.
*
- * @param tag the tag we're interested in
- * @param itemType the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
- * @return all property types defined for the specified item type and with the specified tag
+ * @param tag tag to match
+ * @param itemType item type name from the item class {@code ITEM_TYPE} field
+ * @return matching property types
*/
Set getExistingProperties(String tag, String itemType);
/**
- * Retrieves the existing property types for the specified type as defined by the Item subclass public
- * field {@code ITEM_TYPE} and with the specified tag (system or regular)
+ * Returns property types defined for an item type that carry the given tag or system tag.
*
- * TODO: move to a different class
- *
- * @param tag the tag we're interested in
- * @param itemType the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
- * @param systemTag whether the specified is a system tag or a regular one
- * @return all property types defined for the specified item type and with the specified tag
+ * @param tag tag to match
+ * @param itemType item type name from the item class {@code ITEM_TYPE} field
+ * @param systemTag {@code true} when {@code tag} is a system tag
+ * @return matching property types
*/
Set getExistingProperties(String tag, String itemType, boolean systemTag);
/**
- * Forces a refresh of the profile service, to load data from persistence immediately instead of waiting for
- * scheduled tasks to execute. Warning : this may have serious impacts on performance so it should only be used
- * in specific scenarios such as integration tests.
+ * Reloads profile service state from persistence immediately.
+ * Expensive; intended for integration tests and similar scenarios.
*/
void refresh();
/**
- * Purge (delete) profiles
- * example: Purge profile inactive since 10 days only:
- * purgeProfiles(10, 0);
- * example: Purge profile created since 30 days only:
- * purgeProfiles(0, 30);
+ * Deletes profiles by inactivity and/or age criteria.
+ * Example: purge profiles inactive for 10 days only: {@code purgeProfiles(10, 0)}.
+ * Example: purge profiles created within the last 30 days: {@code purgeProfiles(0, 30)}.
*
- * @param inactiveNumberOfDays will purge profiles with no visits since this number of days (0 or negative value, will have no effect)
- * @param existsNumberOfDays will purge profiles created since this number of days (0 or negative value, will have no effect)
+ * @param inactiveNumberOfDays purge profiles with no visits since this many days (ignored when {@code <= 0})
+ * @param existsNumberOfDays purge profiles created within this many days (ignored when {@code <= 0})
*/
void purgeProfiles(int inactiveNumberOfDays, int existsNumberOfDays);
/**
- * Purge (delete) session items
- * @param existsNumberOfDays will purge sessions created since this number of days (0 or negative value, will have no effect)
+ * Deletes session items older than the given age threshold.
+ *
+ * @param existsNumberOfDays purge sessions created within this many days (ignored when {@code <= 0})
*/
void purgeSessionItems(int existsNumberOfDays);
/**
- * Purge (delete) event items
- * @param existsNumberOfDays will purge events created since this number of days (0 or negative value, will have no effect)
+ * Deletes event items older than the given age threshold.
+ *
+ * @param existsNumberOfDays purge events created within this many days (ignored when {@code <= 0})
*/
void purgeEventItems(int existsNumberOfDays);
/**
- * Use purgeSessionItems and purgeEventItems to remove rollover items instead
- * @param existsNumberOfMonths used to remove monthly indices older than this number of months
+ * @deprecated Use {@link #purgeSessionItems(int)} and {@link #purgeEventItems(int)} for rollover cleanup.
+ *
+ * @param existsNumberOfMonths remove monthly indices older than this many months
*/
@Deprecated
void purgeMonthlyItems(int existsNumberOfMonths);
diff --git a/api/src/main/java/org/apache/unomi/api/services/QueryService.java b/api/src/main/java/org/apache/unomi/api/services/QueryService.java
index c397fda75..b4b657825 100644
--- a/api/src/main/java/org/apache/unomi/api/services/QueryService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/QueryService.java
@@ -24,32 +24,29 @@
import java.util.Map;
/**
- * A service to perform queries.
+ * Runs stored queries and aggregations against the persistence layer.
+ * Complements segment search with lower-level query and aggregate access.
*/
public interface QueryService {
/**
- * Retrieves the number of items with the specified type as defined by the Item subclass public field {@code ITEM_TYPE} and aggregated by possible values of the specified
- * property.
+ * Counts items of the given type grouped by a property's distinct values.
*
- * @param itemType the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
- * @param property the property we're aggregating on, i.e. for each possible value of this property, we are counting how many items of the specified type have that value
- * @return a Map associating a specific value of the property to the cardinality of items with that value
+ * @param itemType item type name from the item class {@code ITEM_TYPE} field
+ * @param property property to aggregate on
+ * @return map of property value to item count
* @see Item Item for a discussion of {@code ITEM_TYPE}
*/
Map getAggregate(String itemType, String property);
/**
- * TODO: rework, this method is confusing since it either behaves like {@link #getAggregate(String, String)} if query is null but completely differently if it isn't
+ * Counts items of the given type grouped by property values, optionally filtered by an aggregate query.
+ * Also returns the global document count when {@code query} is {@code null}.
*
- * Retrieves the number of items with the specified type as defined by the Item subclass public field {@code ITEM_TYPE} and aggregated by possible values of the specified
- * property or, if the specified query is not {@code null}, perform that aggregate query.
- * Also return the global count of document matching the {@code ITEM_TYPE}
- *
- * @param itemType the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
- * @param property the property we're aggregating on, i.e. for each possible value of this property, we are counting how many items of the specified type have that value
- * @param query the {@link AggregateQuery} specifying the aggregation that should be perfomed
- * @return a Map associating a specific value of the property to the cardinality of items with that value
+ * @param itemType item type name from the item class {@code ITEM_TYPE} field
+ * @param property property to aggregate on
+ * @param query optional aggregate query, or {@code null} for simple aggregation
+ * @return map of property value to item count
* @see Item Item for a discussion of {@code ITEM_TYPE}
* @deprecated As of 1.3.0-incubating, please use {@link #getAggregateWithOptimizedQuery(String, String, AggregateQuery)} instead
*/
@@ -57,38 +54,35 @@ public interface QueryService {
Map getAggregate(String itemType, String property, AggregateQuery query);
/**
- * Retrieves the number of items with the specified type as defined by the Item subclass public field {@code ITEM_TYPE} and aggregated by possible values of the specified
- * property or, if the specified query is not {@code null}, perform that aggregate query.
- * This aggregate won't return the global count and should therefore be much faster than {@link #getAggregate(String, String, AggregateQuery)}
+ * Counts items of the given type grouped by property values using an optimized aggregate query.
+ * Does not return a global document count.
*
- * @param itemType the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
- * @param property the property we're aggregating on, i.e. for each possible value of this property, we are counting how many items of the specified type have that value
- * @param query the {@link AggregateQuery} specifying the aggregation that should be perfomed
- * @return a Map associating a specific value of the property to the cardinality of items with that value
+ * @param itemType item type name from the item class {@code ITEM_TYPE} field
+ * @param property property to aggregate on
+ * @param query aggregate query defining the aggregation
+ * @return map of property value to item count
* @see Item Item for a discussion of {@code ITEM_TYPE}
*/
Map getAggregateWithOptimizedQuery(String itemType, String property, AggregateQuery query);
/**
- * Retrieves the number of items of the specified type as defined by the Item subclass public field {@code ITEM_TYPE} and matching the specified {@link Condition}.
+ * Counts items of the given type that match a condition.
*
- * @param condition the condition the items must satisfy
- * @param itemType the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
- * @return the number of items of the specified type
+ * @param condition filter condition
+ * @param itemType item type name from the item class {@code ITEM_TYPE} field
+ * @return matching item count
* @see Item Item for a discussion of {@code ITEM_TYPE}
*/
long getQueryCount(String itemType, Condition condition);
/**
- * Retrieves the specified metrics for the specified field of items of the specified type as defined by the Item subclass public field {@code ITEM_TYPE} and matching the
- * specified {@link Condition}.
+ * Computes numeric metrics (sum, avg, min, max) for a field on items matching a condition.
*
- * @param condition the condition the items must satisfy
- * @param slashConcatenatedMetrics a String specifying which metrics should be computed, separated by a slash ({@code /}) (possible values: {@code sum} for the sum of the
- * values, {@code avg} for the average of the values, {@code min} for the minimum value and {@code max} for the maximum value)
- * @param property the name of the field for which the metrics should be computed
- * @param type the String representation of the item type we want to retrieve the count of, as defined by its class' {@code ITEM_TYPE} field
- * @return a Map associating computed metric name as key to its associated value
+ * @param condition filter condition
+ * @param slashConcatenatedMetrics metrics to compute, separated by {@code /} ({@code sum}, {@code avg}, {@code min}, {@code max})
+ * @param property field name to aggregate
+ * @param type item type name from the item class {@code ITEM_TYPE} field
+ * @return map of metric name to computed value
* @see Item Item for a discussion of {@code ITEM_TYPE}
*/
Map getMetric(String type, String property, String slashConcatenatedMetrics, Condition condition);
diff --git a/api/src/main/java/org/apache/unomi/api/services/RuleListenerService.java b/api/src/main/java/org/apache/unomi/api/services/RuleListenerService.java
index f65990403..0d948a1f2 100644
--- a/api/src/main/java/org/apache/unomi/api/services/RuleListenerService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/RuleListenerService.java
@@ -21,7 +21,9 @@
import org.apache.unomi.api.rules.Rule;
/**
- * A service that gets called when a rule's conditions are evaluated or when a rule's actions are executed.
+ * Observer notified when rules are evaluated or executed.
+ * Lets extensions audit rule firing or add diagnostics without changing
+ * core rule processing.
*/
public interface RuleListenerService {
@@ -29,8 +31,11 @@ public interface RuleListenerService {
* This enum indicates which type of already raised event we are dealing with
*/
enum AlreadyRaisedFor {
+ /** Rule was already raised for the session. */
SESSION,
+ /** Rule was already raised for the profile. */
PROFILE,
+ /** Rule was already raised for the event. */
EVENT
}
@@ -38,6 +43,7 @@ enum AlreadyRaisedFor {
* Called before a rule's conditions are evaluated. Be careful when implemented this listener because rule's condition
* are called in very high frequencies and the performance of this listener might have a huge impact on rule's
* performance
+ *
* @param rule the rule that is being evaluated
* @param event the event we are processing and evaluating against the rule
*/
@@ -45,6 +51,7 @@ enum AlreadyRaisedFor {
/**
* Called when a rule has already been raised either for a session or a profile.
+ *
* @param alreadyRaisedFor an enum that indicates if the rule was already raised once for the session or for the
* profile
* @param rule the rule that has already been raised
@@ -54,6 +61,7 @@ enum AlreadyRaisedFor {
/**
* Called just before a matching rule's actions are about to be executed.
+ *
* @param rule the matching rule for the current event
* @param event the event we are processing that matched the current rule.
*/
diff --git a/api/src/main/java/org/apache/unomi/api/services/RulesService.java b/api/src/main/java/org/apache/unomi/api/services/RulesService.java
index dd5a44786..7f3ad7260 100644
--- a/api/src/main/java/org/apache/unomi/api/services/RulesService.java
+++ b/api/src/main/java/org/apache/unomi/api/services/RulesService.java
@@ -31,100 +31,105 @@
import java.util.Set;
/**
- * A service to access and operate on {@link Rule}s.
+ * Loads, saves, and searches {@link org.apache.unomi.api.rules.Rule} definitions.
+ * Rules tie conditions to actions and drive most automated behavior when
+ * events arrive.
*/
public interface RulesService {
/**
- * Retrieves the metadata for all known rules.
- * Note that it only includes the rules in memory, not those persisted in storage.
- * @return the Set of known metadata
+ * Returns metadata for all in-memory rules.
+ * Does not query persistence directly.
+ *
+ * @return rule metadata from the in-memory cache
*/
Set getRuleMetadatas();
/**
- * Retrieves rule metadatas for rules matching the specified {@link Query}.
+ * Returns metadata for rules matching the given query.
*
- * @param query the query the rules which metadata we want to retrieve must match
- * @return a {@link PartialList} of rules metadata for the rules matching the specified query
+ * @param query filter for rules whose metadata should be returned
+ * @return matching rule metadata
*/
PartialList getRuleMetadatas(Query query);
/**
- * Retrieves rule details for rules matching the specified query.
+ * Returns full rule definitions matching the given query.
*
- * @param query the query specifying which rules to retrieve
- * @return a {@link PartialList} of rule details for the rules matching the specified query
+ * @param query filter for rules to return
+ * @return matching rules
*/
PartialList getRuleDetails(Query query);
/**
- * Get all rules available in the system.
- * (This is not doing a persistence query to retrieve the rules, it's using the internal in memory cache
- * that is refreshed every second by default but can vary depending on your own configuration)
+ * Returns all rules from the in-memory cache.
+ * The cache refreshes on a configurable interval (default one second).
*
- * @return all rules available.
+ * @return all cached rules
*/
List getAllRules();
/**
- * Retrieves the rule identified by the specified identifier.
+ * Loads a rule by id.
*
- * @param ruleId the identifier of the rule we want to retrieve
- * @return the rule identified by the specified identifier or {@code null} if no such rule exists.
+ * @param ruleId rule identifier
+ * @return matching rule, or {@code null} if none exists
*/
Rule getRule(String ruleId);
/**
- * Retrieves the statistics for a rule
- * @param ruleId the identifier of the rule
- * @return a long representing the number of times the rule was matched and executed.
+ * Returns execution statistics for a rule.
+ *
+ * @param ruleId rule identifier
+ * @return rule match and execution counts
*/
RuleStatistics getRuleStatistics(String ruleId);
/**
- * Retrieves the statistics for all the rules
- * @return a map containing rule IDs as key, and the RuleStatistics object as a value
+ * Returns execution statistics for all rules.
+ *
+ * @return map of rule id to statistics
*/
Map