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:
- Legacy sections - Added via
addWorkflowInfoandaddJsonStateSection - Child actor sections -
SectionBuilderactors created as children
Usage with child actor sections (recommended):
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final Loggerprivate final List<ReportSection> private com.scivicslab.pojoactor.workflow.IIActorRef<?> private com.scivicslab.pojoactor.workflow.IIActorSystem -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate com.scivicslab.pojoactor.core.ActionResultaddJsonStateSection(String args) Adds JsonState section for specified actor.voidaddSection(ReportSection section) Adds a section to the report.private com.scivicslab.pojoactor.core.ActionResultaddWorkflowInfo(String args) Adds workflow info section.private voidappendSection(StringBuilder sb, String title, String content) build()Builds the report string.com.scivicslab.pojoactor.core.ActionResultcallByActionName(String actionName, String args) private Stringprivate com.scivicslab.pojoactor.core.ActionResultBuilds and outputs the report.private voidreportToMultiplexer(String data) voidsetActorSystem(com.scivicslab.pojoactor.workflow.IIActorSystem system) voidsetIIActorRef(com.scivicslab.pojoactor.workflow.IIActorRef<?> actorRef)
-
Field Details
-
CLASS_NAME
-
logger
-
sections
-
system
-
selfRef
-
-
Constructor Details
-
ReportBuilder
public ReportBuilder()Default constructor for use with loader.createChild.
-
-
Method Details
-
setActorSystem
- Specified by:
setActorSystemin interfacecom.scivicslab.pojoactor.workflow.ActorSystemAware
-
setIIActorRef
- Specified by:
setIIActorRefin interfacecom.scivicslab.pojoactor.workflow.IIActorRefAware
-
callByActionName
- Specified by:
callByActionNamein interfacecom.scivicslab.pojoactor.core.CallableByActionName
-
addWorkflowInfo
Adds workflow info section. -
addJsonStateSection
Adds JsonState section for specified actor. -
report
-
addSection
Adds a section to the report.- Parameters:
section- the section to add
-
build
Builds the report string.Collects sections from two sources in order:
- Legacy sections added via
addWorkflowInfoandaddJsonStateSection - Child actor sections implementing
SectionBuilder(in creation order)
- Returns:
- the formatted report string
- Legacy sections added via
-
appendSection
-
getWorkflowPathFromNodeGroup
-
reportToMultiplexer
-