001package org.kuali.ole.docstore.process.batch;
002
003import java.util.HashSet;
004import java.util.List;
005import java.util.Set;
006import javax.jcr.Session;
007
008import org.kuali.ole.docstore.model.xmlpojo.ingest.RequestDocument;
009import org.kuali.ole.docstore.transaction.TransactionManager;
010import org.kuali.ole.docstore.utility.BulkIngestStatistics;
011
012/**
013 * Contains the information related to a batch process.
014 * User: tirumalesh.b
015 * Date: 14/9/12 Time: 1:29 PM
016 */
017public class BulkProcessRequest {
018
019    public static Set<String> validOperationSet = getValidOperationSet();
020    protected String user;
021    protected BulkProcessOperation operation;
022    protected BulkProcessAction action;
023    protected String docCategory;
024    protected String docType;
025    protected String docFormat;
026    protected BulkIngestDataFormat dataFormat;
027    protected String dataFolder;
028    protected boolean doIndex; // whether to do indexing along with ingesting.
029    protected int commitSize;
030
031    protected TransactionManager transactionManager;
032    protected Session session;
033    protected BulkProcessStatus status;
034    protected BulkIngestStatistics bulkIngestStatistics = BulkIngestStatistics.getInstance();
035    protected List<RequestDocument> previousBatchDocuments;
036
037    protected String bulkIngestFolder;
038
039    public enum BulkIngestDataFormat {
040        DOCSTORE, STANDARD
041    }
042
043    public enum BulkProcessAction {
044        START, STOP, STATUS, CLEAR
045    }
046
047    public enum BulkProcessStatus {
048        STARTED, STOPPED, DONE
049    }
050
051    public enum BulkProcessOperation {
052        INGEST, REINDEX, LINK
053    }
054
055    public String getUser() {
056        return user;
057    }
058
059    public void setUser(String user) {
060        this.user = user;
061    }
062
063    public BulkProcessOperation getOperation() {
064        return operation;
065    }
066
067    public void setOperation(BulkProcessOperation operation) {
068        this.operation = operation;
069    }
070
071    public BulkProcessAction getAction() {
072        return action;
073    }
074
075    public void setAction(BulkProcessAction action) {
076        this.action = action;
077    }
078
079    public String getDocCategory() {
080        return docCategory;
081    }
082
083    public void setDocCategory(String docCategory) {
084        this.docCategory = docCategory;
085    }
086
087    public String getDocType() {
088        return docType;
089    }
090
091    public void setDocType(String docType) {
092        this.docType = docType;
093    }
094
095    public String getDocFormat() {
096        return docFormat;
097    }
098
099    public void setDocFormat(String docFormat) {
100        this.docFormat = docFormat;
101    }
102
103    public BulkIngestDataFormat getDataFormat() {
104        return dataFormat;
105    }
106
107    public void setDataFormat(BulkIngestDataFormat dataFormat) {
108        this.dataFormat = dataFormat;
109    }
110
111    public BulkProcessStatus getStatus() {
112        return status;
113    }
114
115    public void setStatus(BulkProcessStatus status) {
116        this.status = status;
117    }
118
119    public int getCommitSize() {
120        return commitSize;
121    }
122
123    public void setCommitSize(int commitSize) {
124        this.commitSize = commitSize;
125    }
126
127    public boolean isDoIndex() {
128        return doIndex;
129    }
130
131    public void setDoIndex(boolean doIndex) {
132        this.doIndex = doIndex;
133    }
134
135    public BulkIngestStatistics getBulkIngestStatistics() {
136        return bulkIngestStatistics;
137    }
138
139    public void setBulkIngestStatistics(BulkIngestStatistics bulkIngestStatistics) {
140        this.bulkIngestStatistics = bulkIngestStatistics;
141    }
142
143    public String getDataFolder() {
144        return dataFolder;
145    }
146
147    public void setDataFolder(String dataFolder) {
148        this.dataFolder = dataFolder;
149    }
150
151    public Session getSession() {
152        return session;
153    }
154
155    public void setSession(Session session) {
156        this.session = session;
157    }
158
159    public List<RequestDocument> getPreviousBatchDocuments() {
160        return previousBatchDocuments;
161    }
162
163    public void setPreviousBatchDocuments(List<RequestDocument> previousBatchDocuments) {
164        this.previousBatchDocuments = previousBatchDocuments;
165    }
166
167    public TransactionManager getTransactionManager() {
168        return transactionManager;
169    }
170
171    public void setTransactionManager(TransactionManager transactionManager) {
172        this.transactionManager = transactionManager;
173    }
174
175    public String getBulkIngestFolder() {
176        return bulkIngestFolder;
177    }
178
179    public void setBulkIngestFolder(String bulkIngestFolder) {
180        this.bulkIngestFolder = bulkIngestFolder;
181    }
182
183    private static Set<String> getValidOperationSet() {
184        validOperationSet = new HashSet<String>();
185        validOperationSet.add(BulkProcessOperation.INGEST.toString());
186        validOperationSet.add(BulkProcessOperation.REINDEX.toString());
187        validOperationSet.add(BulkProcessOperation.LINK.toString());
188        return validOperationSet;
189    }
190}