View Javadoc

1   /**
2    * 2009, Digitalis Informatica. All rights reserved. Distribuicao e Gestao de Informatica, Lda. Estrada de Paco de Arcos
3    * num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999 http://www.digitalis.pt
4    */
5   
6   package pt.digitalis.dif.utils.extensions.document;
7   
8   import java.util.List;
9   
10  import pt.digitalis.dif.controller.interfaces.IDIFSession;
11  
12  /**
13   * @author Pedro Viegas <a href="mailto:pviegas@digitalis.pt">pviegas@digitalis.pt</a><br/>
14   * @created Jun 5, 2009
15   */
16  public interface IDocumentRepositoryManager {
17  
18      /**
19       * Adds a new document to the repository
20       * 
21       * @param document
22       *            the document to add
23       * @return the added document
24       * @throws DocumentRepositoryException
25       */
26      public DocumentRepositoryEntry addDocument(DocumentRepositoryEntry document) throws DocumentRepositoryException;
27  
28      /**
29       * Adds a new document to the repository
30       * 
31       * @param document
32       *            the document to add
33       * @param ignoreSizeLimit
34       *            ignores the size limit
35       * @return the added document
36       * @throws DocumentRepositoryException
37       */
38      public DocumentRepositoryEntry addDocument(DocumentRepositoryEntry document, Boolean ignoreSizeLimit)
39              throws DocumentRepositoryException;
40  
41      /**
42       * Declares the requested document to be declared as authorized access for the current session scope. If not called
43       * an access to this document will result in an Authorization Exception
44       * 
45       * @param session
46       *            the current session
47       * @param documentID
48       *            the document ID to authorize
49       */
50      public void authorizeDocumentForCurrentSession(IDIFSession session, Long documentID);
51  
52      /**
53       * Deletes an existing document from the repository
54       * 
55       * @param id
56       *            the document to delete
57       * @throws DocumentRepositoryException
58       */
59      public void deleteDocument(Long id) throws DocumentRepositoryException;
60  
61      /**
62       * Searches an existing document by it's unique identifier
63       * 
64       * @param id
65       *            the document id
66       * @return the document
67       * @throws DocumentRepositoryException
68       */
69      public DocumentRepositoryEntry getDocument(Long id) throws DocumentRepositoryException;
70  
71      /**
72       * Searches for a document by it's original file name
73       * 
74       * @param originalFileName
75       *            the file name
76       * @return the document
77       * @throws DocumentRepositoryException
78       */
79      public List<DocumentRepositoryEntry> getDocumentByOriginalFileName(String originalFileName)
80              throws DocumentRepositoryException;
81  
82      /**
83       * Searches an existing document by it's creator
84       * 
85       * @param creatorUserID
86       *            the user id that created the document
87       * @return the document
88       * @throws DocumentRepositoryException
89       */
90      public List<DocumentRepositoryEntry> getDocumentsByCreator(String creatorUserID) throws DocumentRepositoryException;
91  
92      /**
93       * Get {@link DocumentRepositoryEntry} by ids
94       * 
95       * @param documentIds
96       *            the array of document ids
97       * @return List of {@link DocumentRepositoryEntry}
98       * @throws DocumentRepositoryException
99       */
100     public List<DocumentRepositoryEntry> getDocumentsByIds(List<Long> documentIds) throws DocumentRepositoryException;
101 
102     /**
103      * Searches the authorization list in session for the document ID
104      * 
105      * @param session
106      *            the current session
107      * @param documentID
108      *            the document ID to check for authorization
109      * @return T if the document is authorized
110      */
111     public boolean isDocumentAuthorizedInCurrentSession(IDIFSession session, Long documentID);
112 
113     /**
114      * Updates an existing document with the new data
115      * 
116      * @param document
117      *            the document to update in the respository
118      * @return the updated document
119      */
120     public DocumentRepositoryEntry updateDocument(DocumentRepositoryEntry document);
121 }