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