View Javadoc

1   package org.kuali.ole.docstore.document;
2   
3   import org.kuali.ole.docstore.OleDocStoreException;
4   import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument;
5   import org.kuali.ole.docstore.model.xmlpojo.ingest.ResponseDocument;
6   import org.kuali.ole.docstore.process.batch.BulkProcessRequest;
7   
8   import javax.jcr.Node;
9   import javax.jcr.Session;
10  import java.util.List;
11  
12  /**
13   * Defines the operations that can be performed on one or more documents.
14   *
15   * @author tirumalesh.b
16   * @version %I%, %G%
17   *          Date: 28/8/12 Time: 12:17 PM
18   */
19  public interface DocumentManager {
20  
21      /**
22       * Ingests (stores and indexes) the given documents.
23       * Either all documents are saved or none.
24       *
25       * @param requestDocuments
26       * @return list of ResponseDocuments, if all RequestDocuments are ingested successfully.
27       * @throws OleDocStoreException
28       */
29      public List<ResponseDocument> ingest(List<RequestDocument> requestDocuments, Session session)
30              throws OleDocStoreException;
31  
32      /**
33       * Ingests (stores and indexes) the given document.
34       *
35       * @param requestDocument
36       * @return
37       * @throws OleDocStoreException
38       */
39      public ResponseDocument ingest(RequestDocument requestDocument, Session session) throws OleDocStoreException;
40  
41      public List<ResponseDocument> checkout(List<RequestDocument> requestDocuments) throws OleDocStoreException;
42  
43      public ResponseDocument checkout(RequestDocument requestDocument, Session session) throws OleDocStoreException;
44  
45      public List<ResponseDocument> checkin(List<RequestDocument> requestDocuments) throws OleDocStoreException;
46  
47      public ResponseDocument checkin(RequestDocument requestDocument, Session session) throws OleDocStoreException;
48  
49      public List<ResponseDocument> delete(List<RequestDocument> requestDocuments) throws OleDocStoreException;
50  
51      public ResponseDocument delete(RequestDocument requestDocument,Session session) throws OleDocStoreException;
52  
53      public ResponseDocument buildResponseDocument(RequestDocument requestDocument);
54  
55      /**
56       * Performs bulk ingest as per the details in the given bulkProcessRequest.
57       *
58       * @param bulkProcessRequest
59       * @param requestDocuments   documents to be processed in the current invocation.
60       */
61      public void bulkIngest(BulkProcessRequest bulkProcessRequest, List<RequestDocument> requestDocuments)
62              throws OleDocStoreException;
63  
64      /**
65       * Stores the given documents in docstore, but does not save(commit) the changes.
66       * Useful in cases (such as bulk ingest) where saving(committing) depends on other conditions.
67       *
68       * @param requestDocuments
69       * @param session
70       * @throws OleDocStoreException
71       */
72      //public void store(List<RequestDocument> requestDocuments, Session session) throws OleDocStoreException;
73  
74      /**
75       * Stores the given document in docstore, but does not save(commit) the changes.
76       * Useful in cases (such as bulk ingest) where saving(committing) depends on other conditions.
77       *
78       * @param requestDocument
79       * @param session
80       * @throws OleDocStoreException
81       */
82      //public void store(RequestDocument requestDocument, Session session) throws OleDocStoreException;
83  
84      /**
85       * Indexes the given documents in discovery.
86       *
87       * @param requestDocuments
88       * @param commit           indicates whether to commit the changes.
89       * @throws OleDocStoreException
90       */
91      public void index(List<RequestDocument> requestDocuments, boolean commit) throws OleDocStoreException;
92  
93      /**
94       * Deletes the given documents, along with linked documents, from the discovery.
95       *
96       * @param requestDocument
97       */
98      //public void deleteIndex(List<RequestDocument> requestDocuments) throws OleDocStoreException;
99  
100     public Node storeDocument(RequestDocument requestDocument, Session session) throws OleDocStoreException;
101 
102 }