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 | 0 | public class ExtractServiceImpl implements ExtractService { |
26 | |
|
27 | 0 | 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 | 0 | return Dump.to(getExtractDAO().getDumpByDocumentId(documentId)); |
33 | |
} |
34 | |
|
35 | |
public void saveDump(DumpDTO dumpDTO) { |
36 | |
try { |
37 | 0 | Dump dump = Dump.from(dumpDTO); |
38 | 0 | getExtractDAO().saveDump(dump); |
39 | 0 | if (! dump.getFields().isEmpty()){ |
40 | 0 | for (Iterator iter = dump.getFields().iterator(); iter.hasNext();) { |
41 | 0 | Fields field = (Fields) iter.next(); |
42 | 0 | getExtractDAO().saveField(field); |
43 | 0 | } |
44 | |
} |
45 | 0 | } catch (Exception e) { |
46 | 0 | throw new RuntimeException(e); |
47 | 0 | } |
48 | 0 | } |
49 | |
|
50 | |
public void setExtractDAO(ExtractDAO extractDAO) { |
51 | 0 | this.extractDAO = extractDAO; |
52 | 0 | } |
53 | |
|
54 | |
|
55 | |
public void deleteDump(String docId) { |
56 | |
try { |
57 | 0 | getExtractDAO().deleteDump(docId); |
58 | 0 | } catch (Exception e) { |
59 | 0 | throw new RuntimeException(e); |
60 | 0 | } |
61 | 0 | } |
62 | |
|
63 | |
public ExtractDAO getExtractDAO() { |
64 | 0 | return extractDAO; |
65 | |
} |
66 | |
} |