1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.jdbc.spring;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.kuali.common.util.execute.Executable;
22 import org.kuali.common.util.execute.ExecutablesExecutable;
23 import org.kuali.common.util.spring.SpringUtils;
24 import org.springframework.beans.factory.annotation.Autowired;
25 import org.springframework.context.annotation.Configuration;
26 import org.springframework.context.annotation.Import;
27 import org.springframework.core.env.Environment;
28
29
30
31
32 @Configuration
33 @Import({ JdbcCommonConfig.class, JdbcDataSourceConfig.class, ResetDbaConfig.class, ResetSchemaConfig.class, ResetConstraintsConfig.class, ResetOtherConfig.class })
34 public abstract class AbstractResetController {
35
36 @Autowired
37 Environment env;
38
39 @Autowired
40 JdbcDataSourceConfig dataSourceConfig;
41
42 @Autowired
43 ResetDbaConfig dbaConfig;
44
45 @Autowired
46 ResetSchemaConfig schemaConfig;
47
48 @Autowired
49 ResetDataConfig dataConfig;
50
51 @Autowired
52 ResetConstraintsConfig constraintsConfig;
53
54 @Autowired
55 ResetOtherConfig otherConfig;
56
57 protected Executable getResetExecutable() {
58 List<Executable> executables = new ArrayList<Executable>();
59 executables.add(dataSourceConfig.jdbcShowConfigExecutable());
60 executables.add(dbaConfig.jdbcDbaExecutable());
61 executables.add(schemaConfig.jdbcSchemaExecutable());
62 executables.add(dataConfig.jdbcDataConcurrentExecutable());
63 executables.add(dataConfig.jdbcDataSequentialExecutable());
64 executables.add(constraintsConfig.jdbcConstraintsConcurrentExecutable());
65 executables.add(constraintsConfig.jdbcConstraintsSequentialExecutable());
66 executables.add(otherConfig.jdbcOtherConcurrentExecutable());
67 executables.add(otherConfig.jdbcOtherSequentialExecutable());
68
69 ExecutablesExecutable exec = new ExecutablesExecutable();
70 exec.setSkip(SpringUtils.getBoolean(env, "jdbc.reset.skip", false));
71 exec.setTimed(SpringUtils.getBoolean(env, "jdbc.reset.timed", true));
72 exec.setExecutables(executables);
73 return exec;
74 }
75
76 }