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