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 DbaCleanupConfig.class })
35 public abstract class AbstractResetController {
36
37 @Autowired
38 Environment env;
39
40 @Autowired
41 JdbcDataSourceConfig dataSourceConfig;
42
43 @Autowired
44 ResetDbaConfig dbaConfig;
45
46 @Autowired
47 ResetSchemaConfig schemaConfig;
48
49 @Autowired
50 ResetDataConfig dataConfig;
51
52 @Autowired
53 ResetConstraintsConfig constraintsConfig;
54
55 @Autowired
56 ResetOtherConfig otherConfig;
57
58 @Autowired
59 DbaCleanupConfig dbaCleanupConfig;
60
61 protected Executable getResetExecutable() {
62 List<Executable> executables = new ArrayList<Executable>();
63 executables.add(dataSourceConfig.jdbcShowConfigExecutable());
64 executables.add(dbaConfig.jdbcDbaExecutable());
65 executables.add(schemaConfig.jdbcSchemaExecutable());
66 executables.add(dataConfig.jdbcDataConcurrentExecutable());
67 executables.add(dataConfig.jdbcDataSequentialExecutable());
68 executables.add(constraintsConfig.jdbcConstraintsConcurrentExecutable());
69 executables.add(constraintsConfig.jdbcConstraintsSequentialExecutable());
70 executables.add(otherConfig.jdbcOtherConcurrentExecutable());
71 executables.add(otherConfig.jdbcOtherSequentialExecutable());
72 executables.add(dbaCleanupConfig.jdbcDbaCleanupExecutable());
73
74 ExecutablesExecutable exec = new ExecutablesExecutable();
75 exec.setSkip(SpringUtils.getBoolean(env, "jdbc.reset.skip", false));
76 exec.setTimed(SpringUtils.getBoolean(env, "jdbc.reset.timed", true));
77 exec.setExecutables(executables);
78 return exec;
79 }
80
81 }