Class File
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.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFile(UUID identifier, String name, String mimeType, Long size, Object license, boolean administrativeAgreement, boolean publisherAuthority, Instant embargoDate, RightsRetentionStrategy rightsRetentionStrategy) Constructor for no.unit.nva.file.model.File objects. -
Method Summary
Modifier and TypeMethodDescriptionstatic File.Builderbuilder()booleanbooleangetName()getSize()inthashCode()booleanbooleanabstract booleanfinal AdministrativeAgreementtoString()final AdministrativeAgreementvoidvalidate()Validate the file.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface no.unit.nva.commons.json.JsonSerializable
toJsonString
-
Field Details
-
IDENTIFIER_FIELD
- See Also:
-
NAME_FIELD
- See Also:
-
MIME_TYPE_FIELD
- See Also:
-
SIZE_FIELD
- See Also:
-
LICENSE_FIELD
- See Also:
-
ADMINISTRATIVE_AGREEMENT_FIELD
- See Also:
-
PUBLISHER_AUTHORITY_FIELD
- See Also:
-
EMBARGO_DATE_FIELD
- See Also:
-
RIGTHTS_RETENTION_STRATEGY
- See Also:
-
LICENSE_MAP
-
MISSING_LICENSE
- See Also:
-
CCBY_LICENSE
- See Also:
-
ERROR_MESSAGE
- See Also:
-
-
Constructor Details
-
File
protected File(UUID identifier, String name, String mimeType, Long size, Object license, boolean administrativeAgreement, boolean publisherAuthority, Instant embargoDate, RightsRetentionStrategy rightsRetentionStrategy) 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 storagename- The original name of the filemimeType- The mimetype of the filesize- The size of the filelicense- The license for the file, may be null if and only if the file is an administrative agreementadministrativeAgreement- True if the file is an administrative agreementpublisherAuthority- True if the file owner has publisher authorityembargoDate- The date after which the file may be publishedrightsRetentionStrategy- The rights retention strategy for the file
-
-
Method Details
-
builder
-
validate
public void validate()Validate the file. -
getIdentifier
-
getName
-
getMimeType
-
getSize
-
getLicense
-
isAdministrativeAgreement
public boolean isAdministrativeAgreement() -
isPublisherAuthority
public boolean isPublisherAuthority() -
getEmbargoDate
-
getRightsRetentionStrategy
-
fileDoesNotHaveActiveEmbargo
public boolean fileDoesNotHaveActiveEmbargo() -
toUnpublishedFile
-
toPublishedFile
-
toAdministrativeAgreement
-
toUnpublishableFile
-
isVisibleForNonOwner
public abstract boolean isVisibleForNonOwner() -
hashCode
public int hashCode() -
equals
-
toString
-