Class DiffInfo

java.lang.Object
com.day.cq.commons.DiffInfo
Direct Known Subclasses:
DiffInfo

public class DiffInfo extends Object
The DiffInfo can be used by components to display a diff to a previous version. A component has access to the diff information by calling Adaptable.adaptTo(Class) with this class as the argument.
Since:
5.2
  • Field Details

  • Constructor Details

  • Method Details

    • getContent

      public Resource getContent()
      Return the content to diff.
      Returns:
      The content or null
    • getType

      public DiffInfo.TYPE getType()
      Return the type information.
      Returns:
      The type information.
    • getDiffOutput

      public String getDiffOutput(DiffService service, String current, String oldText, boolean isRichText)
      Helper method to generate the diff output.
      Parameters:
      service - The diff service.
      current - The current text (right).
      oldText - The old text (left).
      isRichText - Is this rich text?
      Returns:
      The complete output or null.
    • getVersionedResource

      public static Resource getVersionedResource(Resource res, String versionLabel)
      Helper method that returns the versioned counterpart of the given resource with the specified version label. The label can be a version name, a version label or a version date.
      Parameters:
      res - the resource
      versionLabel - the version specifier
      Returns:
      the versioned resource or null