Class ReportBuilder

java.lang.Object
com.scivicslab.actoriac.report.ReportBuilder
All Implemented Interfaces:
com.scivicslab.pojoactor.core.CallableByActionName, com.scivicslab.pojoactor.workflow.ActorSystemAware, com.scivicslab.pojoactor.workflow.IIActorRefAware

public class ReportBuilder extends Object implements com.scivicslab.pojoactor.core.CallableByActionName, com.scivicslab.pojoactor.workflow.ActorSystemAware, com.scivicslab.pojoactor.workflow.IIActorRefAware
Section-based workflow report builder.

Assembles report sections from two sources:

  1. Legacy sections - Added via addWorkflowInfo and addJsonStateSection
  2. Child actor sections - SectionBuilder actors created as children
steps:
  - states: ["0", "1"]
    actions:
      - actor: loader
        method: createChild
        arguments: ["ROOT", "reportBuilder", "...ReportBuilder"]
      - actor: loader
        method: createChild
        arguments: ["reportBuilder", "wfName", "...WorkflowNameSection"]
      - actor: loader
        method: createChild
        arguments: ["reportBuilder", "wfDesc", "...WorkflowDescriptionSection"]

  - states: ["1", "end"]
    actions:
      - actor: reportBuilder
        method: report

Legacy usage:

steps:
  - states: ["0", "1"]
    actions:
      - actor: loader
        method: createChild
        arguments: ["ROOT", "reportBuilder", "...ReportBuilder"]
      - actor: reportBuilder
        method: addWorkflowInfo

  - states: ["1", "end"]
    actions:
      - actor: reportBuilder
        method: report

Actions:

  • addWorkflowInfo - Add workflow metadata section (legacy)
  • addJsonStateSection - Add actor's JsonState as YAML (legacy)
  • report - Build and output the report to outputMultiplexer
Since:
2.15.0
Author:
devteam@scivicslab.com
  • Field Details

  • Constructor Details

    • ReportBuilder

      public ReportBuilder()
      Default constructor for use with loader.createChild.
  • Method Details

    • setActorSystem

      public void setActorSystem(com.scivicslab.pojoactor.workflow.IIActorSystem system)
      Specified by:
      setActorSystem in interface com.scivicslab.pojoactor.workflow.ActorSystemAware
    • setIIActorRef

      public void setIIActorRef(com.scivicslab.pojoactor.workflow.IIActorRef<?> actorRef)
      Specified by:
      setIIActorRef in interface com.scivicslab.pojoactor.workflow.IIActorRefAware
    • callByActionName

      public com.scivicslab.pojoactor.core.ActionResult callByActionName(String actionName, String args)
      Specified by:
      callByActionName in interface com.scivicslab.pojoactor.core.CallableByActionName
    • addWorkflowInfo

      private com.scivicslab.pojoactor.core.ActionResult addWorkflowInfo(String args)
      Adds workflow info section.
    • addJsonStateSection

      private com.scivicslab.pojoactor.core.ActionResult addJsonStateSection(String args)
      Adds JsonState section for specified actor.
    • report

      private com.scivicslab.pojoactor.core.ActionResult report(String args)
      Builds and outputs the report.
    • addSection

      public void addSection(ReportSection section)
      Adds a section to the report.
      Parameters:
      section - the section to add
    • build

      public String build()
      Builds the report string.

      Collects sections from two sources in order:

      1. Legacy sections added via addWorkflowInfo and addJsonStateSection
      2. Child actor sections implementing SectionBuilder (in creation order)
      Returns:
      the formatted report string
    • appendSection

      private void appendSection(StringBuilder sb, String title, String content)
    • getWorkflowPathFromNodeGroup

    • reportToMultiplexer

      private void reportToMultiplexer(String data)