Class FullTextResourceUpdate

java.lang.Object
uno.anahata.asi.toolkit.resources.text.AbstractTextResourceWrite
uno.anahata.asi.toolkit.resources.text.FullTextResourceUpdate

public class FullTextResourceUpdate extends AbstractTextResourceWrite
A rich DTO for updating a text file with its full new content. It encapsulates the new content, optimistic locking metadata from the base class, and a set of line-level comments to provide explanations for specific changes.
Author:
anahata
  • Field Details

    • newContent

      private String newContent
      The full new content for the file.
    • lineComments

      private List<LineComment> lineComments
      A list of comments associated with specific lines in the new content.
  • Constructor Details

    • FullTextResourceUpdate

      public FullTextResourceUpdate(String resourceUuid, long lastModified, String newContent, List<LineComment> lineComments)
      Constructs a new FullTextResourceUpdate with explicit properties, utilizing the builder pattern.
      Parameters:
      resourceUuid - The unique identifier of the target text resource.
      lastModified - Optimistic locking: the expected last modified timestamp of the file.
      newContent - The full new content to overwrite the file.
      lineComments - A list of comments associated with specific lines for rendering.
  • Method Details

    • doCalculateResultingContent

      protected String doCalculateResultingContent(Agi agi) throws Exception
      Performs the actual, tool-specific calculation of the resulting content.
      Specified by:
      doCalculateResultingContent in class AbstractTextResourceWrite
      Parameters:
      agi - The parent agi session.
      Returns:
      The calculated resulting content as a String.
      Throws:
      Exception - if the calculation logic fails.
    • validate

      public void validate(Agi agi) throws Exception
      Performs pre-flight validation of the update operation. Note: This method ensures state is captured.
      Overrides:
      validate in class AbstractTextResourceWrite
      Parameters:
      agi - The parent agi session.
      Throws:
      Exception - if validation fails.