Record Class Document

java.lang.Object
java.lang.Record
net.tangly.core.domain.Document
Record Components:
id - uri is relative to the domain documents root folder. It is unique within the domain.
name - human-readable name of the document
time - time when the document was created
range - date range of the information contained in the document. If the document is a snapshot of a state, the range is the date of the snapshot
text - human-readable AsciiDoc text describing the document
generated - flag indicating if the document was generated by the ERP system. A generated document is not editable and is not subject to retention policies. It can be regenerated at any time.
tags - collection of tags associated with the document
All Implemented Interfaces:
HasDateRange, HasId, HasName, HasTags, HasText

public record Document(@NotNull String id, @NotNull String name, String extension, @NotNull LocalDateTime time, @NotNull DateRange range, String text, boolean generated, @NotNull Collection<Tag> tags) extends Record implements HasId, HasName, HasDateRange, HasText, HasTags
Defines a document and its metadata stored in the system as immutable record. A document is owed by a domain and is part of the domain model. The domain handles the access rights to the document and the retention policies.
  • Constructor Details

    • Document

      public Document(@NotNull @NotNull String id, @NotNull @NotNull String name, String extension, @NotNull @NotNull LocalDateTime time, @NotNull @NotNull DateRange range, String text, boolean generated, @NotNull @NotNull Collection<Tag> tags)
      Creates an instance of a Document record class.
      Parameters:
      id - the value for the id record component
      name - the value for the name record component
      extension - the value for the extension record component
      time - the value for the time record component
      range - the value for the range record component
      text - the value for the text record component
      generated - the value for the generated record component
      tags - the value for the tags record component
  • Method Details

    • update

      public static void update(@NotNull @NotNull Provider<Document> provider, @NotNull @NotNull Document document, @NotNull @NotNull DomainAudit audit)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      @NotNull public @NotNull String id()
      Returns the value of the id record component.
      Specified by:
      id in interface HasId
      Returns:
      the value of the id record component
    • name

      @NotNull public @NotNull String name()
      Returns the value of the name record component.
      Specified by:
      name in interface HasName
      Returns:
      the value of the name record component
    • extension

      public String extension()
      Returns the value of the extension record component.
      Returns:
      the value of the extension record component
    • time

      @NotNull public @NotNull LocalDateTime time()
      Returns the value of the time record component.
      Returns:
      the value of the time record component
    • range

      @NotNull public @NotNull DateRange range()
      Returns the value of the range record component.
      Specified by:
      range in interface HasDateRange
      Returns:
      the value of the range record component
    • text

      public String text()
      Returns the value of the text record component.
      Specified by:
      text in interface HasText
      Returns:
      the value of the text record component
    • generated

      public boolean generated()
      Returns the value of the generated record component.
      Returns:
      the value of the generated record component
    • tags

      @NotNull public @NotNull Collection<Tag> tags()
      Returns the value of the tags record component.
      Specified by:
      tags in interface HasTags
      Returns:
      the value of the tags record component