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