001/* 002 * Copyright 2025 devteam@scivicslab.com 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, 011 * software distributed under the License is distributed on an 012 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the 014 * specific language governing permissions and limitations 015 * under the License. 016 */ 017 018package com.scivicslab.actoriac.report; 019 020/** 021 * Report section for workflow metadata. 022 * 023 * <p>Displays workflow file path, name, and optional description. 024 * Returns null title to output content directly without a title line.</p> 025 * 026 * @author devteam@scivicslab.com 027 * @since 2.15.0 028 */ 029public class WorkflowInfoSection implements ReportSection { 030 031 private final String workflowPath; 032 private final String name; 033 private final String description; 034 035 /** 036 * Creates a workflow info section. 037 * 038 * @param workflowPath the workflow file path 039 * @param name the workflow name 040 * @param description the workflow description (may be null) 041 */ 042 public WorkflowInfoSection(String workflowPath, String name, String description) { 043 this.workflowPath = workflowPath; 044 this.name = name; 045 this.description = description; 046 } 047 048 @Override 049 public String getTitle() { 050 return null; // No title - content is output directly 051 } 052 053 @Override 054 public String getContent() { 055 StringBuilder sb = new StringBuilder(); 056 sb.append("[Workflow Info]\n"); 057 sb.append(" File: ").append(workflowPath).append("\n"); 058 if (name != null && !name.isEmpty()) { 059 sb.append(" Name: ").append(name).append("\n"); 060 } 061 if (description != null && !description.isEmpty()) { 062 sb.append("\n[Description]\n"); 063 for (String line : description.split("\n")) { 064 sb.append(" ").append(line.trim()).append("\n"); 065 } 066 } 067 return sb.toString(); 068 } 069}