Class EntityFile

  • All Implemented Interfaces:
    java.io.Serializable, ISourceFile

    @Entity(name="File")
    public class EntityFile
    extends java.lang.Object
    implements ISourceFile, java.io.Serializable
    ISourceFile object for base storage implementation
    See Also:
    Serialized Form
    • Constructor Detail

      • EntityFile

        public EntityFile​(EntityArchive archive,
                          java.lang.String filename,
                          java.lang.String extension,
                          java.sql.Timestamp timestamp,
                          long size,
                          int line,
                          int contentLine)
    • Method Detail

      • equals

        public boolean equals​(ISourceFile file)
        Description copied from interface: ISourceFile
        File equality check
        Specified by:
        equals in interface ISourceFile
        Parameters:
        file - file to compare
        Returns:
        equals
      • getArchiveId

        public long getArchiveId()
        Description copied from interface: ISourceFile
        Get the id for the immediate parent submission, this may not be the top level submission seen by the user
        Specified by:
        getArchiveId in interface ISourceFile
        Returns:
        the id for the submission
      • getDisplayFileSize

        public java.lang.String getDisplayFileSize​(boolean si)
        Description copied from interface: ISourceFile
        Fetches the file size in String form with the correct extension
        Specified by:
        getDisplayFileSize in interface ISourceFile
        Parameters:
        si - use SI (1000) or binary (1024) for calculations
        Returns:
        string for the file size
      • getFileContents

        public java.io.InputStream getFileContents()
        Specified by:
        getFileContents in interface ISourceFile
        Returns:
        the content of the file
      • getFileContentsAsString

        public java.lang.String getFileContentsAsString()
        Specified by:
        getFileContentsAsString in interface ISourceFile
        Returns:
        the content of the file as a string
      • getFileContentsAsStringList

        public java.util.List<java.lang.String> getFileContentsAsStringList()
        Specified by:
        getFileContentsAsStringList in interface ISourceFile
        Returns:
        the content of the file as a list of strings
      • getFileDisplayName

        public java.lang.String getFileDisplayName()
        Specified by:
        getFileDisplayName in interface ISourceFile
        Returns:
        string containing display formatted file name
      • getFileDisplayPath

        public java.lang.String getFileDisplayPath()
        Specified by:
        getFileDisplayPath in interface ISourceFile
        Returns:
        string containing display formatted file path
      • getFileIdentifier

        public java.lang.String getFileIdentifier()
        Specified by:
        getFileIdentifier in interface ISourceFile
        Returns:
        a web path safe file identifier
      • getFileSize

        public long getFileSize()
        Description copied from interface: ISourceFile
        Fetches the file size in bytes
        Specified by:
        getFileSize in interface ISourceFile
        Returns:
        file size in bytes
      • getHash

        public java.lang.String getHash()
      • setHash

        public void setHash​(java.lang.String hash)
      • getNonEmptyLineCount

        public int getNonEmptyLineCount()
        Description copied from interface: ISourceFile
        Count of the number of lines in the file containing characters, non empty
        Specified by:
        getNonEmptyLineCount in interface ISourceFile
        Returns:
        count of non empty lines
      • getPersistentId

        public long getPersistentId()
        Specified by:
        getPersistentId in interface ISourceFile
        Returns:
        fetches a unique, persistent id for the file. No other file should EVER be able to take this ID, even if this file is deleted.
      • getSecureParam

        public byte[] getSecureParam()
      • setSecureParam

        public void setSecureParam​(byte[] secure)
      • getSubmission

        public ISubmission getSubmission()
        Description copied from interface: ISourceFile
        Get the top level, "super parent", submission object, this is the submission for this file seen by the user, NOT a sub-directory
        Specified by:
        getSubmission in interface ISourceFile
        Returns:
        the highest level parent submission
      • getTimestamp

        public java.sql.Timestamp getTimestamp()
      • getTotalLineCount

        public int getTotalLineCount()
        Description copied from interface: ISourceFile
        Count of the total number of lines in the file
        Specified by:
        getTotalLineCount in interface ISourceFile
        Returns:
        count of all lines
      • remove

        public void remove()
        Description copied from interface: ISourceFile
        Remove the file
        Specified by:
        remove in interface ISourceFile
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object