gitinfo structure modified
This commit is contained in:
@@ -3,10 +3,11 @@ package com.olympus.apollo.controllers;
|
||||
import java.util.List;
|
||||
|
||||
import com.olympus.apollo.dto.ResultDTO;
|
||||
import com.olympus.apollo.feign.services.JavaParserModuleService;
|
||||
import com.olympus.apollo.feign.services.ParserModuleService;
|
||||
import com.olympus.apollo.models.ParseProcess;
|
||||
import com.olympus.apollo.services.GitService;
|
||||
import com.olympus.dto.JavaParseRequest;
|
||||
import com.olympus.dto.ParseRequest;
|
||||
import com.olympus.feign.JavaParserModule;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -35,6 +36,9 @@ public class TestController {
|
||||
@Autowired
|
||||
JavaParserModule javaParserModule;
|
||||
|
||||
@Autowired
|
||||
ParserModuleService parserModuleService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
|
||||
|
||||
@GetMapping("test/ingestion_loop")
|
||||
@@ -108,8 +112,14 @@ public class TestController {
|
||||
return ResponseEntity.accepted().body("Request to parse the java application is being processed");
|
||||
}
|
||||
|
||||
@PostMapping("/parse")
|
||||
public ResponseEntity<String> ParseApplication(@RequestBody ParseRequest parseRequest){
|
||||
parserModuleService.callParserModules(parseRequest);
|
||||
return ResponseEntity.accepted().body("Request to parse the java application is being processed");
|
||||
}
|
||||
|
||||
@GetMapping("/get-parse-status")
|
||||
public ResponseEntity<Object> getParseStatus(@RequestParam String id){
|
||||
return javaParserModule.getParseStatus(id);
|
||||
return parserModuleService.getJavaParseStatusDetails(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,5 @@ public class GitCloneInput {
|
||||
private int defaultChunkSize;
|
||||
|
||||
private boolean codeParsingToBeDone;
|
||||
//private String parseStatus;
|
||||
//private String reverseEngineeringStatus;
|
||||
//private String codeType;
|
||||
|
||||
private List<CodeTypes> codeTypes= new ArrayList<>();
|
||||
private List<ParseStatuses> parseStatuses= new ArrayList<>();
|
||||
private List<RevEngineeringStatuses> revEngineeringStatuses= new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.olympus.apollo.feign.services;
|
||||
|
||||
import com.olympus.apollo.models.ParseProcess;
|
||||
import com.olympus.feign.JavaParserModule;
|
||||
import com.olympus.dto.JavaParseRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Service
|
||||
public class JavaParserModuleService {
|
||||
@Autowired
|
||||
private JavaParserModule javaParserModule;
|
||||
|
||||
|
||||
public void getJavaParsedDetails(JavaParseRequest javaParseRequest){
|
||||
CompletableFuture.completedFuture(javaParserModule.getJavaParsedDetails(javaParseRequest));
|
||||
}
|
||||
|
||||
public ResponseEntity<Object> getParseStatusDetails(String parseId){
|
||||
return javaParserModule.getParseStatus(parseId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.olympus.apollo.feign.services;
|
||||
|
||||
import com.olympus.apollo.models.KSGitInfo;
|
||||
import com.olympus.apollo.repository.KSGitInfoRepository;
|
||||
import com.olympus.dto.ParseRequest;
|
||||
import com.olympus.feign.JavaParserModule;
|
||||
import com.olympus.dto.JavaParseRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Service
|
||||
public class ParserModuleService {
|
||||
@Autowired
|
||||
private JavaParserModule javaParserModule;
|
||||
|
||||
@Autowired
|
||||
KSGitInfoRepository ksGitInfoRepository;
|
||||
|
||||
public ResponseEntity<Object> getJavaParseStatusDetails(String RepositoryEntityId){
|
||||
KSGitInfo ksGitInfo = ksGitInfoRepository.findById(RepositoryEntityId).get();
|
||||
String parseProcessId=ksGitInfo.getParseStatuses().stream()
|
||||
.filter(statuses -> "Java".equals(statuses.getType()))
|
||||
.findFirst().get().getParseProcessId();
|
||||
|
||||
return javaParserModule.getParseStatus(parseProcessId);
|
||||
}
|
||||
|
||||
public void callParserModules(ParseRequest parseRequest) {
|
||||
Optional<KSGitInfo> ksGitInfo = ksGitInfoRepository.findById(parseRequest.getId());
|
||||
if(ksGitInfo.isPresent()){
|
||||
KSGitInfo gitInfo = ksGitInfo.get();
|
||||
gitInfo.getCodeTypes().forEach(codeType -> {
|
||||
if(codeType.getType().equalsIgnoreCase("java")){
|
||||
JavaParseRequest javaParseRequest = new JavaParseRequest();
|
||||
javaParseRequest.setId(parseRequest.getId());
|
||||
javaParseRequest.setRepositoryPath(gitInfo.getRepoPath());
|
||||
javaParseRequest.setApplicationName(gitInfo.getKsGitIngestionInfo().getMetadata().get("KsApplicationName"));
|
||||
javaParseRequest.setApplicationVersion(gitInfo.getCommitId());
|
||||
javaParseRequest.setDeleteExistingData(parseRequest.isDeleteExistingData());
|
||||
javaParseRequest.setApplicationType(codeType.getType());
|
||||
javaParseRequest.setProjectName(gitInfo.getRepoName());
|
||||
CompletableFuture.completedFuture(javaParserModule.getJavaParsedDetails(javaParseRequest));
|
||||
}
|
||||
if(codeType.getType().equalsIgnoreCase("jsp")) {
|
||||
System.out.println("JSP Parser Module");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.olympus.apollo.models;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter @Setter
|
||||
@AllArgsConstructor
|
||||
public class ParseStatuses {
|
||||
private String type;
|
||||
private String Status;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.olympus.apollo.models;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter @Setter
|
||||
@AllArgsConstructor
|
||||
public class RevEngineeringStatuses {
|
||||
private String type;
|
||||
private String status;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.olympus.apollo.utils;
|
||||
|
||||
import com.olympus.apollo.dto.GitCloneInput;
|
||||
import com.olympus.apollo.models.CodeTypes;
|
||||
import com.olympus.apollo.models.KSGitInfo;
|
||||
import com.olympus.apollo.models.KSGitIngestionInfo;
|
||||
import com.olympus.apollo.models.*;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.slf4j.Logger;
|
||||
@@ -12,6 +10,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -36,8 +35,15 @@ public class GitUtils {
|
||||
info.setCodeParsingToBeDone(gitCloneInput.isCodeParsingToBeDone());
|
||||
|
||||
info.setCodeTypes(gitCloneInput.getCodeTypes());
|
||||
info.setParseStatuses(gitCloneInput.getParseStatuses());
|
||||
info.setRevEngineeringStatuses(gitCloneInput.getRevEngineeringStatuses());
|
||||
|
||||
List<ParseStatuses> parseStatuses = new ArrayList<>();
|
||||
List<RevEngineeringStatuses> revEngineeringStatuses = new ArrayList<>();
|
||||
gitCloneInput.getCodeTypes().forEach(codeType -> {
|
||||
parseStatuses.add(new ParseStatuses(codeType.getType(), "NEW", ""));
|
||||
revEngineeringStatuses.add(new RevEngineeringStatuses(codeType.getType(), "NEW", ""));
|
||||
});
|
||||
info.setParseStatuses(parseStatuses);
|
||||
info.setRevEngineeringStatuses(revEngineeringStatuses);
|
||||
|
||||
logger.info("KSGitInfo Created: {}, {}",info.getRepoName(),info.getBranch());
|
||||
return info;
|
||||
|
||||
Reference in New Issue
Block a user