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 if (useKewXmlDataLoaderLifecycle != null && !Boolean.valueOf(useKewXmlDataLoaderLifecycle)) {
47 LOG.debug("Skipping KEWXmlDataLoaderLifecycle due to property: use.kewXmlmlDataLoaderLifecycle=" + useKewXmlDataLoaderLifecycle);
48 return;
49 }
50
51 LOG.info("################################");
52 LOG.info("#");
53 LOG.info("# Begin Loading file '" + filename + "'");
54 LOG.info("#");
55 LOG.info("################################");
56 loadData();
57 super.start();
58 }
59
60
61
62
63
64 protected void loadData() throws Exception {
65 KEWXmlDataLoader.loadXmlResource(filename);
66 }
67 }