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