Class DocumentDAO

java.lang.Object
ru.bgcrm.dao.CommonDAO
ru.bgcrm.plugin.document.dao.DocumentDAO

public class DocumentDAO extends CommonDAO
  • Constructor Details

    • DocumentDAO

      public DocumentDAO(Connection con)
  • Method Details

    • add

      public void add(String objectType, int objectId, byte[] data, String title)
      Adds a document linked to the object
      Parameters:
      objectType - the object type
      objectId - the object ID
      data - the file data
      title - the document title
    • add

      public void add(Document b) throws SQLException
      Adds a document. The file must be uploaded beforehand using FileDataDAO.
      Parameters:
      b - the document
      Throws:
      SQLException
    • delete

      public void delete(Document doc) throws Exception
      Deletes a document and its linked file
      Parameters:
      doc - the document
      Throws:
      Exception
    • getDocumentById

      public Document getDocumentById(int id)
      Returns a document by its ID
      Parameters:
      id - the document ID
      Returns:
      the document, or null if not found
    • searchObjectDocuments

      public void searchObjectDocuments(Pageable<Document> result, String objectType, int objectId)
      Searches documents linked to the object
      Parameters:
      result - the search result
      objectType - the object type
      objectId - the object ID
    • createDocumentFile

      public OutputStream createDocumentFile(Document doc, String title) throws Exception
      Throws:
      Exception
    • getFromRS

      public static Document getFromRS(ResultSet rs, String prefix) throws SQLException
      Throws:
      SQLException