1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.edl.impl.extract;
17
18 import java.util.Iterator;
19
20 import org.kuali.rice.edl.framework.extract.DumpDTO;
21 import org.kuali.rice.edl.framework.extract.ExtractService;
22 import org.kuali.rice.edl.impl.extract.dao.ExtractDAO;
23
24
25 public class ExtractServiceImpl implements ExtractService {
26
27 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ExtractServiceImpl.class);
28
29 private ExtractDAO extractDAO;
30
31 public DumpDTO getDumpByDocumentId(String documentId) {
32 return Dump.to(getExtractDAO().getDumpByDocumentId(documentId));
33 }
34
35 public void saveDump(DumpDTO dumpDTO) {
36 try {
37 Dump dump = Dump.from(dumpDTO);
38 getExtractDAO().saveDump(dump);
39 if (! dump.getFields().isEmpty()){
40 for (Iterator iter = dump.getFields().iterator(); iter.hasNext();) {
41 Fields field = (Fields) iter.next();
42 getExtractDAO().saveField(field);
43 }
44 }
45 } catch (Exception e) {
46 throw new RuntimeException(e);
47 }
48 }
49
50 public void setExtractDAO(ExtractDAO extractDAO) {
51 this.extractDAO = extractDAO;
52 }
53
54
55 public void deleteDump(String docId) {
56 try {
57 getExtractDAO().deleteDump(docId);
58 } catch (Exception e) {
59 throw new RuntimeException(e);
60 }
61 }
62
63 public ExtractDAO getExtractDAO() {
64 return extractDAO;
65 }
66 }