|
|
|
@ -24,7 +24,7 @@ public class RequestReader {
|
|
|
|
|
private String findOrSearchflag = "0";
|
|
|
|
|
private String Tclass = null;
|
|
|
|
|
|
|
|
|
|
public RequestReader(File javaClass) throws IOException {
|
|
|
|
|
public RequestReader(File javaClass) {
|
|
|
|
|
this.javaClass = javaClass;
|
|
|
|
|
importList = new ArrayList<>();
|
|
|
|
|
notesList = new ArrayList<>();
|
|
|
|
@ -35,99 +35,116 @@ public class RequestReader {
|
|
|
|
|
read();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void read() throws IOException {
|
|
|
|
|
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(javaClass), "utf-8"));
|
|
|
|
|
private void read() {
|
|
|
|
|
BufferedReader bufferedReader = null;
|
|
|
|
|
try {
|
|
|
|
|
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(javaClass), "utf-8"));
|
|
|
|
|
|
|
|
|
|
String line = null;
|
|
|
|
|
while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
|
if (line.matches("\\s*package\\s(.*);")) {
|
|
|
|
|
Pattern compile = Pattern.compile("\\s*package\\s(.*)\\.module\\.(.*).req;");
|
|
|
|
|
Matcher matcher = compile.matcher(line);
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
domainName = matcher.group(1);
|
|
|
|
|
moduleName = matcher.group(2);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (line.matches("import\\s.*")) {
|
|
|
|
|
if (line.contains(".ent.")) {
|
|
|
|
|
Pattern compile = Pattern.compile("import\\s+(.*\\.ent\\..*);");
|
|
|
|
|
String line = null;
|
|
|
|
|
while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
|
if (line.matches("\\s*package\\s(.*);")) {
|
|
|
|
|
Pattern compile = Pattern.compile("\\s*package\\s(.*)\\.module\\.(.*).req;");
|
|
|
|
|
Matcher matcher = compile.matcher(line);
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
String group = matcher.group(1);
|
|
|
|
|
deptEntList.add(group);
|
|
|
|
|
domainName = matcher.group(1);
|
|
|
|
|
moduleName = matcher.group(2);
|
|
|
|
|
}
|
|
|
|
|
} else if (line.contains("frame")) {
|
|
|
|
|
|
|
|
|
|
} else if (line.contains("javax.validation")) {
|
|
|
|
|
|
|
|
|
|
} else if (line.contains("org.hibernate.validator")) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
importList.add(line);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ((line.contains("/**") || line.contains("*") || line.contains("*/")) && body.size() == 0) {
|
|
|
|
|
notesList.add(line);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (line.matches("public\\s+class\\s+(.*Request)\\s+extends\\s+(.*)Request\\s*\\{")) {
|
|
|
|
|
Pattern compile = Pattern.compile("public\\s+class\\s+(.*Request)\\s+extends\\s+(.*)Request\\s*\\{");
|
|
|
|
|
Matcher matcher = compile.matcher(line);
|
|
|
|
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
className = matcher.group(1);
|
|
|
|
|
fatherName = matcher.group(2);
|
|
|
|
|
|
|
|
|
|
if (fatherName.contains("BaseFindRequest")) {
|
|
|
|
|
hasList = true;
|
|
|
|
|
findOrSearchflag = "1";
|
|
|
|
|
}
|
|
|
|
|
if (fatherName.contains("BaseGetAllRequest")) {
|
|
|
|
|
hasList = true;
|
|
|
|
|
findOrSearchflag = "2";
|
|
|
|
|
if (line.matches("import\\s.*")) {
|
|
|
|
|
if (line.contains(".ent.")) {
|
|
|
|
|
Pattern compile = Pattern.compile("import\\s+(.*\\.ent\\..*);");
|
|
|
|
|
Matcher matcher = compile.matcher(line);
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
String group = matcher.group(1);
|
|
|
|
|
deptEntList.add(group);
|
|
|
|
|
}
|
|
|
|
|
} else if (line.contains("frame")) {
|
|
|
|
|
|
|
|
|
|
} else if (line.contains("javax.validation")) {
|
|
|
|
|
|
|
|
|
|
} else if (line.contains("org.hibernate.validator")) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
importList.add(line);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if ((line.contains("/**") || line.contains("*") || line.contains("*/")) && body.size() == 0) {
|
|
|
|
|
notesList.add(line);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (className != null) {
|
|
|
|
|
|
|
|
|
|
if (line.matches("\\s*private\\s+(.*Request)\\s+(.*);")) {
|
|
|
|
|
|
|
|
|
|
Pattern compile = Pattern.compile("\\s*private\\s+(.*Request)\\s+(.*);");
|
|
|
|
|
if (line.matches("public\\s+class\\s+(.*Request)\\s+extends\\s+(.*)Request\\s*\\{")) {
|
|
|
|
|
Pattern compile = Pattern.compile("public\\s+class\\s+(.*Request)\\s+extends\\s+(.*)Request\\s*\\{");
|
|
|
|
|
Matcher matcher = compile.matcher(line);
|
|
|
|
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
String group = matcher.group(1);
|
|
|
|
|
deptReqList.add(group);
|
|
|
|
|
className = matcher.group(1);
|
|
|
|
|
fatherName = matcher.group(2);
|
|
|
|
|
|
|
|
|
|
if (fatherName.contains("BaseFindRequest")) {
|
|
|
|
|
hasList = true;
|
|
|
|
|
findOrSearchflag = "1";
|
|
|
|
|
}
|
|
|
|
|
if (fatherName.contains("BaseGetAllRequest")) {
|
|
|
|
|
hasList = true;
|
|
|
|
|
findOrSearchflag = "2";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (line.contains("@ColumnName") ||
|
|
|
|
|
line.contains("@ColumnDescription")
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (className != null) {
|
|
|
|
|
if (line.matches("\\s*private\\s+(.*Request)\\s+(.*);")) {
|
|
|
|
|
Pattern compile = Pattern.compile("\\s*private\\s+(.*Request)\\s+(.*);");
|
|
|
|
|
Matcher matcher = compile.matcher(line);
|
|
|
|
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
String group = matcher.group(1);
|
|
|
|
|
deptReqList.add(group);
|
|
|
|
|
}
|
|
|
|
|
} else if (line.matches("\\s*private\\s+(.*\\.)*([^\\\\.]*)\\s+(.*);")) {
|
|
|
|
|
Pattern compile = Pattern.compile("\\s*private\\s+(.*\\.)*([^\\\\.]*)\\s+(.*);");
|
|
|
|
|
Matcher matcher = compile.matcher(line);
|
|
|
|
|
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
String group = matcher.group(2);
|
|
|
|
|
deptEntList.add(group);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (line.contains("@ColumnName") ||
|
|
|
|
|
line.contains("@ColumnDescription")
|
|
|
|
|
) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
body.add(line);
|
|
|
|
|
body.add(line);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = body.size() - 1; i >= 0; i--) {
|
|
|
|
|
if (body.get(i).contains("}")) {
|
|
|
|
|
body.set(i, body.get(i).replaceAll("}", ""));
|
|
|
|
|
break;
|
|
|
|
|
for (int i = body.size() - 1; i >= 0; i--) {
|
|
|
|
|
if (body.get(i).contains("}")) {
|
|
|
|
|
body.set(i, body.get(i).replaceAll("}", ""));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (body.size() > 1 && "".equals(body.get(0))) {
|
|
|
|
|
body.remove(0);
|
|
|
|
|
}
|
|
|
|
|
if (body.size() > 1 && "".equals(body.get(body.size() - 1))) {
|
|
|
|
|
body.remove(body.size() - 1);
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} finally {
|
|
|
|
|
if (bufferedReader != null) {
|
|
|
|
|
try {
|
|
|
|
|
bufferedReader.close();
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (body.size() > 1 && "".equals(body.get(0))) {
|
|
|
|
|
body.remove(0);
|
|
|
|
|
}
|
|
|
|
|
if (body.size() > 1 && "".equals(body.get(body.size() - 1))) {
|
|
|
|
|
body.remove(body.size() - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bufferedReader.close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getDomainName() {
|
|
|
|
|