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