1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.student.admin.ui.mojo;
17
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.apache.maven.plugin.MojoExecutionException;
24 import org.apache.maven.plugin.MojoFailureException;
25 import org.apache.maven.project.MavenProject;
26 import org.kuali.student.common.mojo.AbstractKSMojo;
27 import org.kuali.student.contract.model.ServiceContractModel;
28 import org.kuali.student.contract.model.util.ServicesFilterByKeys;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
31
32
33
34
35
36
37
38
39
40 public class KSCreateAdminUiMojo extends AbstractKSMojo {
41
42 private static final Logger log = LoggerFactory.getLogger(KSCreateAdminUiMojo.class);
43
44 public KSCreateAdminUiMojo() {
45 }
46 public String targetDir;
47
48 public String getTargetDir() {
49 return targetDir;
50 }
51
52 public void setTargetDir(String targetDir) {
53 this.targetDir = targetDir;
54 }
55
56 @Override
57 public void execute() throws MojoExecutionException, MojoFailureException {
58 ServiceContractModel model = getModel();
59 validate(model);
60 if (targetDir == null) {
61 targetDir = "target/generated-sources/admin-ui";
62 }
63
64 List<String> servKeys = new ArrayList<String>();
65 servKeys.add("Atp");
66
67
68
69 servKeys.add("Organization");
70 ServicesFilterByKeys filter = new ServicesFilterByKeys(servKeys);
71
72 AdminUiWriter instance =
73 new AdminUiWriter(model,
74 targetDir,
75 AdminUiWriter.DEFAULT_ROOT_PACKAGE,
76
77 filter);
78 instance.write();
79
80 }
81 private static final String CORE_DIRECTORY = "D:/svn/org-fixer/ks-api/ks-core-api/src/main";
82
83 private static final String COMMON_DIRECTORY = "D:/svn/org-fixer/ks-api/ks-common-api/src/main/java";
84 private static final String ENROLL_DIRECTORY = "D:/svn/org-fixer/ks-api/ks-enroll-api/src/main/java";
85 private static final String LUM_DIRECTORY = "D:/svn/org-fixer/ks-api/ks-lum-api/src/main/java";
86 private static final String RICE_CORE_API_DIRECTORY = "D:/svn/rice/rice-2.2.0-M3/core/api/src/main/java";
87 private static final String RICE_KIM_API_DIRECTORY = "D:/svn/rice/rice-2.2.0-M3/kim/kim-api/src/main/java";
88 private static final String TEST_SOURCE_DIRECTORY =
89 "src/test/java/org/kuali/student/contract/model/test/source";
90 private static final String TARGET_GENERATED_SOURCES = "target/generated-sources";
91 private static final String STANDALONE_MAIN_DIRECTORY = "D:/svn/ks/ks-standalone-admin-app/src/main";
92 private static final String ORG_FIXER_CORE_UI_MAIN_DIRECTORY = "D:/svn/org-fixer/ks-core/ks-core-ui/src/main";
93
94 public static void main(String[] args) {
95 log.info("execute");
96 List<String> srcDirs = new ArrayList<String>();
97 srcDirs.add(COMMON_DIRECTORY);
98 srcDirs.add(CORE_DIRECTORY);
99 srcDirs.add(LUM_DIRECTORY);
100 srcDirs.add(ENROLL_DIRECTORY);
101
102
103 KSCreateAdminUiMojo instance = new KSCreateAdminUiMojo();
104 Map pluginContext = new HashMap();
105 MavenProject project = new MavenProject();
106 pluginContext.put("project", project);
107 instance.setPluginContext(pluginContext);
108 instance.setSourceDirs(srcDirs);
109 instance.setTargetDir(ORG_FIXER_CORE_UI_MAIN_DIRECTORY);
110 try {
111 instance.execute();
112
113 } catch (MojoExecutionException ex) {
114 throw new RuntimeException(ex);
115 } catch (MojoFailureException ex) {
116 throw new RuntimeException(ex);
117 }
118 }
119 }