java.lang.Object
no.unit.nva.model.associatedartifacts.file.File
All Implemented Interfaces:
no.unit.nva.commons.json.JsonSerializable, AssociatedArtifact
Direct Known Subclasses:
AdministrativeAgreement, PublishedFile, UnpublishedFile

public abstract class File extends Object implements no.unit.nva.commons.json.JsonSerializable, AssociatedArtifact
An object that represents the description of a file.
  • Field Details

  • Constructor Details

    • File

      protected File(UUID identifier, String name, String mimeType, Long size, Object license, boolean administrativeAgreement, boolean publisherAuthority, Instant embargoDate, RightsRetentionStrategy rightsRetentionStrategy, String legalNote)
      Constructor for no.unit.nva.file.model.File objects. A file object is valid if it has a license or is explicitly marked as an administrative agreement.
      Parameters:
      identifier - A UUID that identifies the file in storage
      name - The original name of the file
      mimeType - The mimetype of the file
      size - The size of the file
      license - The license for the file, may be null if and only if the file is an administrative agreement
      administrativeAgreement - True if the file is an administrative agreement
      publisherAuthority - True if the file owner has publisher authority
      embargoDate - The date after which the file may be published
      rightsRetentionStrategy - The rights retention strategy for the file
  • Method Details

    • builder

      public static File.Builder builder()
    • validate

      public void validate()
      Validate the file.
    • getIdentifier

      public UUID getIdentifier()
    • getName

      public String getName()
    • getMimeType

      public String getMimeType()
    • getSize

      public Long getSize()
    • getLegalNote

      public String getLegalNote()
    • getLicense

      public URI getLicense()
    • isAdministrativeAgreement

      public boolean isAdministrativeAgreement()
    • isPublisherAuthority

      public boolean isPublisherAuthority()
    • getEmbargoDate

      public Optional<Instant> getEmbargoDate()
    • getRightsRetentionStrategy

      public RightsRetentionStrategy getRightsRetentionStrategy()
    • fileDoesNotHaveActiveEmbargo

      public boolean fileDoesNotHaveActiveEmbargo()
    • toUnpublishedFile

      public UnpublishedFile toUnpublishedFile()
    • toPublishedFile

      public PublishedFile toPublishedFile()
    • toAdministrativeAgreement

      public final AdministrativeAgreement toAdministrativeAgreement()
    • toUnpublishableFile

      public final AdministrativeAgreement toUnpublishableFile()
    • isVisibleForNonOwner

      public abstract boolean isVisibleForNonOwner()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object