1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.impex.data;
17
18 import java.util.List;
19
20 import org.kuali.common.impex.data.service.DumpDataContext;
21 import org.kuali.common.impex.data.service.DumpDataService;
22 import org.kuali.common.impex.data.service.impl.DefaultDumpDataService;
23 import org.kuali.common.impex.data.service.impl.DumpTableResult;
24 import org.kuali.common.impex.model.Schema;
25 import org.kuali.common.impex.util.DumpUtils;
26 import org.kuali.common.util.Assert;
27 import org.kuali.common.util.execute.Executable;
28
29 public class DumpDataExecutable implements Executable {
30
31 public static final boolean DEFAULT_SKIP_EXECUTION = false;
32 public static final DumpDataService DEFAULT_SERVICE = new DefaultDumpDataService();
33
34 boolean skip = DEFAULT_SKIP_EXECUTION;
35 DumpDataService service = DEFAULT_SERVICE;
36 DumpDataContext context;
37 Schema schema;
38
39 @Override
40 public void execute() {
41
42
43 if (skip) {
44 return;
45 }
46
47
48 Assert.notNull(schema, "schema is null");
49 Assert.notNull(context, "context is null");
50 Assert.notNull(service, "service is null");
51
52
53 List<DumpTableResult> results = service.dumpTables(context, schema);
54
55
56 DumpUtils.storeTableStatistics(results, context.getTableStatisticsLocation());
57 }
58
59 public DumpDataContext getContext() {
60 return context;
61 }
62
63 public void setContext(DumpDataContext context) {
64 this.context = context;
65 }
66
67 public DumpDataService getService() {
68 return service;
69 }
70
71 public void setService(DumpDataService service) {
72 this.service = service;
73 }
74
75 public Schema getSchema() {
76 return schema;
77 }
78
79 public void setSchema(Schema schema) {
80 this.schema = schema;
81 }
82
83 public boolean getSkip() {
84 return skip;
85 }
86
87 public void setSkip(boolean skip) {
88 this.skip = skip;
89 }
90 }