Add REModuleService to TestController for reverse engineering application
This commit is contained in:
@@ -2,6 +2,7 @@ package com.olympus.apollo.controllers;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.olympus.apollo.feign.services.REModuleService;
|
||||||
import com.olympus.dto.ResultDTO;
|
import com.olympus.dto.ResultDTO;
|
||||||
import com.olympus.apollo.feign.services.ParserModuleService;
|
import com.olympus.apollo.feign.services.ParserModuleService;
|
||||||
import com.olympus.apollo.services.GitService;
|
import com.olympus.apollo.services.GitService;
|
||||||
@@ -36,7 +37,10 @@ public class TestController {
|
|||||||
JavaParserModule javaParserModule;
|
JavaParserModule javaParserModule;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ParserModuleService parserModuleService;
|
private ParserModuleService parserModuleService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private REModuleService reModuleService;
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
|
private static final Logger logger = LoggerFactory.getLogger(TestController.class);
|
||||||
|
|
||||||
@@ -114,7 +118,13 @@ public class TestController {
|
|||||||
@PostMapping("/parse")
|
@PostMapping("/parse")
|
||||||
public ResponseEntity<String> ParseApplication(@RequestBody ApolloParseRequestDTO apolloParseRequestDTO){
|
public ResponseEntity<String> ParseApplication(@RequestBody ApolloParseRequestDTO apolloParseRequestDTO){
|
||||||
parserModuleService.callParserModules(apolloParseRequestDTO);
|
parserModuleService.callParserModules(apolloParseRequestDTO);
|
||||||
return ResponseEntity.accepted().body("Request to parse the java application is being processed");
|
return ResponseEntity.accepted().body("Request to parse the application is being processed");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/revenginnerapplication")
|
||||||
|
public ResponseEntity<String> RevEngApplication(@RequestBody ApolloParseRequestDTO apolloParseRequestDTO){
|
||||||
|
reModuleService.callReverseEngModules(apolloParseRequestDTO);
|
||||||
|
return ResponseEntity.accepted().body("Request to reverse engineering application is being processed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/get-parse-status")
|
@GetMapping("/get-parse-status")
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.olympus.apollo.feign.services;
|
||||||
|
|
||||||
|
import com.olympus.apollo.repository.KSGitInfoRepository;
|
||||||
|
import com.olympus.dto.ApolloParseRequestDTO;
|
||||||
|
import com.olympus.dto.CommonReverseEngRequest;
|
||||||
|
import com.olympus.feign.JavaREModule;
|
||||||
|
import com.olympus.model.apollo.KSGitInfo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class REModuleService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JavaREModule javaREModule;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
KSGitInfoRepository ksGitInfoRepository;
|
||||||
|
|
||||||
|
public void callReverseEngModules(ApolloParseRequestDTO apolloParseRequestDTO){
|
||||||
|
Optional<KSGitInfo> ksGitInfoOptional = ksGitInfoRepository.findById(apolloParseRequestDTO.getId());
|
||||||
|
if(ksGitInfoOptional.isPresent()) {
|
||||||
|
KSGitInfo gitInfo = ksGitInfoOptional.get();
|
||||||
|
CommonReverseEngRequest commonReverseEngRequest = new CommonReverseEngRequest();
|
||||||
|
commonReverseEngRequest.setRepositoryEntityId(apolloParseRequestDTO.getId());
|
||||||
|
commonReverseEngRequest.setApplicationName(gitInfo.getRepoName());
|
||||||
|
commonReverseEngRequest.setApplicationProjectName(gitInfo.getProjectName());
|
||||||
|
commonReverseEngRequest.setApplicationVersion(gitInfo.getApplicationVersion());
|
||||||
|
commonReverseEngRequest.setDeleteExistingData(apolloParseRequestDTO.isDeleteExistingData());
|
||||||
|
|
||||||
|
gitInfo.getCodeTypes().forEach(codeType -> {
|
||||||
|
if(codeType.getType().equalsIgnoreCase("java")){
|
||||||
|
commonReverseEngRequest.setApplicationType(codeType.getType());
|
||||||
|
CompletableFuture.completedFuture(javaREModule.revApplication(commonReverseEngRequest));
|
||||||
|
}
|
||||||
|
if(codeType.getType().equalsIgnoreCase("jsp")) {
|
||||||
|
System.out.println("JSP Parser Module");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user