Annotation Interface ActivityTracked


@InterceptorBinding @Inherited @Target({METHOD,TYPE}) @Retention(RUNTIME) public @interface ActivityTracked
Marks a business method (or a whole bean) whose invocation should be recorded onto the ambient activity timeline — the declarative way to feed the assistant's working memory without writing any capture code by hand.

What this annotation is for

Put @ActivityTracked on a service or backing-bean method, and every successful call to it becomes one UserActivityEvent in the store. You describe, in the annotation, what the call means: its category, a verb, which method parameters identify the business entity it touched (entityIdParams()), and whether a textual argument should be captured (includeText()). The ActivityTrackedInterceptor reads all of this at call time and hands a finished event to the ActivityRecorder.

Familiar analogy: a label you stick on a desk drawer that says "log every time this is opened, and note which file was pulled". You attach the label once (annotate the method); thereafter the logging happens by itself, with exactly the detail the label asked for.

How it is used


 @Stateless
 public class OrderService {

     @ActivityTracked(type = Type.BUSINESS_ACTION, verb = "approve",
                      entityType = "order", entityIdParams = "orderId")
     public void approve(String orderId) { ... }

     @ActivityTracked(type = Type.SEARCH, includeText = true)
     public List<Order> search(String query) { ... }
 }
 

Notes

  • All members are Nonbinding — they configure the recorded event but do not participate in interceptor binding resolution, so any combination of values is matched by the single ActivityTrackedInterceptor.
  • Placed on a
    invalid reference
    type
    , it applies to all of that bean's business methods.
  • The interceptor records after the method returns successfully; a method that throws records nothing.
  • For tabs, the declarative shortcut @DynTab(trackActivity = true) is the navigation-flavoured equivalent of annotating the tab's entry method with @ActivityTracked(type = NAVIGATION).
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Names of the method parameters that carry the touched entity's id(s).
    The entity type to tag the recorded event with (e.g.
    boolean
    Whether to capture a textual argument as the event's text (e.g. a search query or a note body).
    The coarse category recorded for the call.
    The specific act in your domain's vocabulary (e.g.
  • Element Details

    • type

      The coarse category recorded for the call.
      Returns:
      the UserActivityEvent.Type; defaults to UserActivityEvent.Type.BUSINESS_ACTION
      Default:
      BUSINESS_ACTION
    • verb

      String verb
      The specific act in your domain's vocabulary (e.g. "approve", "cancel").

      When left blank, the interceptor falls back to the method's own name — so an explicit verb always wins, and you get a sensible default for free.

      Returns:
      the verb, or an empty string to derive it from the method name
      Default:
      ""
    • entityType

      String entityType
      The entity type to tag the recorded event with (e.g. "order").

      When blank, the interceptor falls back to the simple name of the method's declaring class.

      Returns:
      the entity type, or an empty string to derive it from the declaring class
      Default:
      ""
    • entityIdParams

      String[] entityIdParams
      Names of the method parameters that carry the touched entity's id(s).

      For each named parameter present, the interceptor builds an EntityRef of entityType() whose id is the argument's string value. These refs are the raw material the assistant uses to resolve "this"/"that". Requires the module to be compiled with -parameters (which this project is) so parameter names are available at runtime.

      Returns:
      parameter names to read entity ids from; empty means "record no entity"
      Default:
      {}
    • includeText

      boolean includeText
      Whether to capture a textual argument as the event's text (e.g. a search query or a note body).

      When true, the interceptor uses the first String parameter that is not already consumed as an entity id.

      Returns:
      true to capture authored text; defaults to false
      Default:
      false