Class DocumentDAO

  • All Implemented Interfaces:
    IDocumentDAO

    public final class DocumentDAO
    extends java.lang.Object
    implements IDocumentDAO
    This class provides Data Access methods for Document objects
    • Constructor Detail

      • DocumentDAO

        public DocumentDAO()
    • Method Detail

      • newPrimaryKey

        public int newPrimaryKey()
        Generates a new primary key
        Specified by:
        newPrimaryKey in interface IDocumentDAO
        Returns:
        The new primary key
      • insert

        public void insert​(Document document)
        Insert a new record in the table.
        Specified by:
        insert in interface IDocumentDAO
        Parameters:
        document - The document object
      • load

        public Document load​(int nDocumentId)
        Load the data of Document from the table
        Specified by:
        load in interface IDocumentDAO
        Parameters:
        nDocumentId - The identifier of Document
        Returns:
        the instance of the Document
      • loadWithoutBinaries

        public Document loadWithoutBinaries​(int nDocumentId)
        Load the data of Document from the table
        Specified by:
        loadWithoutBinaries in interface IDocumentDAO
        Parameters:
        nDocumentId - The identifier of Document
        Returns:
        the instance of the Document
      • loadFromSpaceId

        public java.util.List<Document> loadFromSpaceId​(int nSpaceId)
        Load from space id.
        Specified by:
        loadFromSpaceId in interface IDocumentDAO
        Parameters:
        nSpaceId - The id of the document space
        Returns:
        the instance of the Document
      • loadAttributes

        public void loadAttributes​(Document document)
        Load the attributes of Document from the table
        Specified by:
        loadAttributes in interface IDocumentDAO
        Parameters:
        document - Document object
      • loadAttributesWithoutBinaries

        public void loadAttributesWithoutBinaries​(Document document,
                                                  boolean bValidated)
        Load the attributes of Document from the table
        Specified by:
        loadAttributesWithoutBinaries in interface IDocumentDAO
        Parameters:
        document - Document object
        bValidated - true if the content of the document must be validated, false otherwise
      • delete

        public void delete​(int nDocumentId)
        Delete a record from the table
        Specified by:
        delete in interface IDocumentDAO
        Parameters:
        nDocumentId - the document identifier
      • validateAttributes

        public void validateAttributes​(int nDocumentId)
        validate a record from the table
        Specified by:
        validateAttributes in interface IDocumentDAO
        Parameters:
        nDocumentId - The Document identifier
      • store

        public void store​(Document document,
                          boolean bUpdateContent)
        Update the record in the table
        Specified by:
        store in interface IDocumentDAO
        Parameters:
        document - The reference of document
        bUpdateContent - the boolean
      • selectPrimaryKeysByFilter

        public java.util.Collection<java.lang.Integer> selectPrimaryKeysByFilter​(DocumentFilter filter)
        Load the list of documents
        Specified by:
        selectPrimaryKeysByFilter in interface IDocumentDAO
        Parameters:
        filter - The DocumentFilter Object
        Returns:
        The Collection of the Document ids
      • selectByFilter

        public java.util.List<Document> selectByFilter​(DocumentFilter filter)
        Load the list of documents
        Specified by:
        selectByFilter in interface IDocumentDAO
        Parameters:
        filter - The DocumentFilter Object
        Returns:
        The Collection of the Documents
      • selectByRelatedCategories

        public java.util.List<Document> selectByRelatedCategories​(Document document)
        Load the list of documents in relation with categories of specified document
        Specified by:
        selectByRelatedCategories in interface IDocumentDAO
        Parameters:
        document - The document with the categories
        Returns:
        The Collection of the Documents
      • loadResource

        public DocumentResource loadResource​(int nDocumentId)
        Load a resource (image, file, ...) corresponding to an attribute of a Document
        Specified by:
        loadResource in interface IDocumentDAO
        Parameters:
        nDocumentId - The Document Id
        Returns:
        the instance of the DocumentResource
      • loadSpecificResource

        public DocumentResource loadSpecificResource​(int nDocumentId,
                                                     int nAttributeId,
                                                     boolean bValidated)
        Load a resource (image, file, ...) corresponding to an attribute of a Document
        Specified by:
        loadSpecificResource in interface IDocumentDAO
        Parameters:
        nDocumentId - The Document Id
        nAttributeId - The Attribute Id
        bValidated - true if we want the validated resource
        Returns:
        the instance of the DocumentResource
      • selectAllPrimaryKeys

        public java.util.Collection<java.lang.Integer> selectAllPrimaryKeys()
        Gets all documents id
        Specified by:
        selectAllPrimaryKeys in interface IDocumentDAO
        Returns:
        A collection of Integer
      • selectAll

        public java.util.List<Document> selectAll()
        Deprecated.
        Gets all documents
        Specified by:
        selectAll in interface IDocumentDAO
        Returns:
        the document list
      • getPageTemplateDocumentPath

        public java.lang.String getPageTemplateDocumentPath​(int nIdPageTemplateDocument)
        Load the path of page template
        Specified by:
        getPageTemplateDocumentPath in interface IDocumentDAO
        Parameters:
        nIdPageTemplateDocument - The identifier of page template
        Returns:
        the page template path
      • loadLastModifiedAttributes

        public Document loadLastModifiedAttributes​(int nIdDocument)
        Load document type and date last modification for HTTP GET conditional request ("If-Modified-Since")
        Specified by:
        loadLastModifiedAttributes in interface IDocumentDAO
        Parameters:
        nIdDocument - The id of the document
        Returns:
        the document
      • loadLastModifiedDocumentFromUser

        public Document loadLastModifiedDocumentFromUser​(java.lang.String strUserName)
        Load the data of last Document the user worked in from the table
        Specified by:
        loadLastModifiedDocumentFromUser in interface IDocumentDAO
        Parameters:
        strUserName - the user name
        Returns:
        the instance of the Document
      • loadLastPublishedDocument

        public Document loadLastPublishedDocument()
        Load the data of last Document the user worked in from the table
        Specified by:
        loadLastPublishedDocument in interface IDocumentDAO
        Returns:
        the instance of the Document