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