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       * @param respDoc
40       * @return
41       * @throws OleDocStoreException
42       */
43      public ResponseDocument ingest(RequestDocument requestDocument, Session session, ResponseDocument respDoc) throws OleDocStoreException;
44  
45      public List<ResponseDocument> checkout(List<RequestDocument> requestDocuments) throws OleDocStoreException;
46  
47      public ResponseDocument checkout(RequestDocument requestDocument, Session session) throws OleDocStoreException;
48  
49      public List<ResponseDocument> checkin(List<RequestDocument> requestDocuments) throws OleDocStoreException;
50  
51      public ResponseDocument checkin(RequestDocument requestDocument, Session session, ResponseDocument respDoc) throws OleDocStoreException;
52  
53      public List<ResponseDocument> delete(List<RequestDocument> requestDocuments) throws OleDocStoreException;
54  
55      public ResponseDocument delete(RequestDocument requestDocument,Session session) throws Exception;
56  
57      public ResponseDocument buildResponseDocument(RequestDocument requestDocument);
58  
59      public void validateInput(RequestDocument requestDocument, Session session, List<String> valuesList)throws OleDocStoreException;
60  
61      /**
62       * Performs bulk ingest as per the details in the given bulkProcessRequest.
63       *
64       * @param bulkProcessRequest
65       * @param requestDocuments   documents to be processed in the current invocation.
66       */
67      public void bulkIngest(BulkProcessRequest bulkProcessRequest, List<RequestDocument> requestDocuments)
68              throws OleDocStoreException;
69  
70      /**
71       * Stores the given documents in docstore, but does not save(commit) the changes.
72       * Useful in cases (such as bulk ingest) where saving(committing) depends on other conditions.
73       *
74       * @param requestDocuments
75       * @param session
76       * @throws OleDocStoreException
77       */
78      //public void store(List<RequestDocument> requestDocuments, Session session) throws OleDocStoreException;
79  
80      /**
81       * Stores the given document in docstore, but does not save(commit) the changes.
82       * Useful in cases (such as bulk ingest) where saving(committing) depends on other conditions.
83       *
84       * @param requestDocument
85       * @param session
86       * @throws OleDocStoreException
87       */
88      //public void store(RequestDocument requestDocument, Session session) throws OleDocStoreException;
89  
90      /**
91       * Indexes the given documents in discovery.
92       *
93       * @param requestDocuments
94       * @param commit           indicates whether to commit the changes.
95       * @throws OleDocStoreException
96       */
97      public void index(List<RequestDocument> requestDocuments, boolean commit) throws OleDocStoreException;
98  
99      /**
100      * Deletes the given documents, along with linked documents, from the discovery.
101      *
102      * @param requestDocument
103      * @param responseDocument
104      */
105     //public void deleteIndex(List<RequestDocument> requestDocuments) throws OleDocStoreException;
106 
107     public Node storeDocument(RequestDocument requestDocument, Session session, ResponseDocument responseDocument) throws OleDocStoreException;
108 
109     ResponseDocument bind(RequestDocument requestDocument, Session session, String operation) throws OleDocStoreException, RepositoryException, OleException, FileNotFoundException;
110     public  ResponseDocument unbind(RequestDocument requestDocument, Session session, String operation) throws OleDocStoreException, RepositoryException, OleException, FileNotFoundException;
111 
112     public List<ResponseDocument> deleteVerify(List<RequestDocument> requestDocument, Session session);
113     public ResponseDocument deleteVerify(RequestDocument requestDocument, Session session) throws Exception;
114 }