Class Derived

java.lang.Object
org.apache.juneau.console.freemarker.Derived

public final class Derived extends Object
Declares a derived data source: transforms run in the browser on each new frame of another source, published on data:<as>.

The built-in transforms are bucket, filter, groupBy and topN; app transforms are registered under dotted names. A string arg that is exactly {token} is filled from params.

Example:

page.data(Derived.from("orgRequests") .transform("groupBy", JsonMap.of("by", List.of("reason"), "measures", List.of("count"))) .as("noqcByReason"));

Since:
10.0.0
  • Method Details

    • from

      public static Derived from(String source)
      Parameters:
      source - The input source id.
      Returns:
      A new declaration.
      Throws:
      IllegalArgumentException - E-40 if the id is not a valid topic key.
    • transform

      public Derived transform(String name, JsonMap args)
      Appends a transform.
      Parameters:
      name - A registered transform (bare built-in or dotted app name).
      args - The transform's arguments, or null. The map is copied one level deep; nested values are shared, so do not mutate them after the call.
      Returns:
      This object.
    • params

      public Derived params(Subscription... subs)
      Parameters:
      subs - Subscriptions with role params. @return This object.
    • as

      public Derived as(String value)
      Names the output.
      Parameters:
      value - The derived source id; the topic is data:<value>.
      Returns:
      This object.
    • id

      public String id()
      Returns:
      The output id, or null before as(String).
    • toMap

      public JsonMap toMap()
      The contract.dataSources[] entry.
      Returns:
      A new map.
      Throws:
      IllegalStateException - If as(String) was not called.