1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.test.lifecycles;
17
18 import org.apache.log4j.Logger;
19 import org.kuali.rice.core.api.config.property.ConfigContext;
20 import org.kuali.rice.core.api.lifecycle.BaseLifecycle;
21 import org.kuali.rice.kew.batch.KEWXmlDataLoader;
22
23
24
25
26
27
28
29
30
31 public class KEWXmlDataLoaderLifecycle extends BaseLifecycle {
32 private static final Logger LOG = Logger.getLogger(KEWXmlDataLoaderLifecycle.class);
33
34 private String filename;
35
36
37
38
39
40 public KEWXmlDataLoaderLifecycle(String resource) {
41 this.filename = resource;
42 }
43
44 public void start() throws Exception {
45 String useKewXmlDataLoaderLifecycle = ConfigContext.getCurrentContextConfig().getProperty("use.kewXmlmlDataLoaderLifecycle");
46
47 if (useKewXmlDataLoaderLifecycle != null && !Boolean.valueOf(useKewXmlDataLoaderLifecycle)) {
48 LOG.debug("Skipping KEWXmlDataLoaderLifecycle due to property: use.kewXmlmlDataLoaderLifecycle=" + useKewXmlDataLoaderLifecycle);
49 return;
50 }
51
52 LOG.info("################################");
53 LOG.info("#");
54 LOG.info("# Begin Loading file '" + filename + "'");
55 LOG.info("#");
56 LOG.info("################################");
57 loadData();
58 super.start();
59 }
60
61
62
63
64
65 protected void loadData() throws Exception {
66 KEWXmlDataLoader.loadXmlResource(filename);
67 }
68 }