View Javadoc

1   /*
2    * Copyright 2007-2009 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.edl.extract;
17  
18  import java.util.Iterator;
19  
20  import org.kuali.rice.kew.edl.extract.dao.ExtractDAO;
21  
22  
23  public class ExtractServiceImpl implements ExtractService {
24  
25  	private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ExtractServiceImpl.class);
26  
27  	private ExtractDAO extractDAO;
28  
29  	public Dump getDumpByDocumentId(Long noteId) {
30  		return getExtractDAO().getDumpByRouteHeaderId(noteId);
31  	}
32  
33  	public void saveDump(Dump dump) {
34  		try {
35  			getExtractDAO().saveDump(dump);
36  			if (! dump.getFields().isEmpty()){
37  				for (Iterator iter = dump.getFields().iterator(); iter.hasNext();) {
38  					Fields field = (Fields) iter.next();
39  					getExtractDAO().saveField(field);
40  				}
41  			}
42  		} catch (Exception e) {
43  			throw new RuntimeException(e);
44  		}
45  	}
46  
47  	public void setExtractDAO(ExtractDAO extractDAO) {
48  		this.extractDAO = extractDAO;
49  	}
50  
51  
52  	public void deleteDump(Long docId) {
53  		try {
54  			getExtractDAO().deleteDump(docId);
55  		} catch (Exception e) {
56  			throw new RuntimeException(e);
57  		}
58  	}
59  
60  	public ExtractDAO getExtractDAO() {
61  		return extractDAO;
62  	}
63  }