From 459ed5fdbf55c0f42a5f84c589f710ddc21b8d5b Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Date: Wed, 14 May 2025 12:13:29 +0530 Subject: [PATCH] sureops --- .../OpenAi/Controller/SureOpsController.java | 2 -- .../com/realnet/OpenAi/Services/ScriptSrvice.java | 8 +++++++- .../realnet/OpenAi/Services/SureopsService.java | 14 +++++++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Controller/SureOpsController.java b/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Controller/SureOpsController.java index c1aae1b..35a10c4 100644 --- a/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Controller/SureOpsController.java +++ b/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Controller/SureOpsController.java @@ -1,8 +1,6 @@ package com.realnet.OpenAi.Controller; -import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; import java.io.IOException; import java.util.Map; diff --git a/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/ScriptSrvice.java b/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/ScriptSrvice.java index a5803b6..da7ffd0 100644 --- a/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/ScriptSrvice.java +++ b/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/ScriptSrvice.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.Set; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -36,6 +37,9 @@ public class ScriptSrvice { @Value("${projectPath}") private String projectPath; + @Autowired + private SureopsService sureopsService; + public void Createonefile(Integer prj_id, List lineList, String workflow_model, Long Deployment_profile) throws IOException { @@ -126,6 +130,7 @@ public class ScriptSrvice { // ArrayList list = calldeploymentprofile(Deployment_profile); ArrayList list = new ArrayList<>(); String pROTOCOL = PortConstant.PROTOCOL; + Long serverPort = sureopsService.getUpdatedPort(1L); ArrayList getdatafromgiturl = getdatafromgiturl(gitea_url); @@ -234,8 +239,9 @@ public class ScriptSrvice { String replace11 = replace10.replace("", pROTOCOL); String replace12 = replace11.replace("", list.get(6).toString().replace("\"", "")); + String replace13 = replace12.replace("", serverPort.toString()); - String finalreplace_value = replace12.replace("", + String finalreplace_value = replace13.replace("", "\"" + list.get(7).toString().replace("\"", "") + "\""); // for testing diff --git a/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/SureopsService.java b/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/SureopsService.java index d79f846..44a8a64 100644 --- a/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/SureopsService.java +++ b/visaproject-back-b/authsec_springboot/backend/src/main/java/com/realnet/OpenAi/Services/SureopsService.java @@ -43,7 +43,7 @@ public class SureopsService { String index = "\n" + "\n" + "\n" + " Welcome\n" + "\n" + "\n" + "

Welcome to the Web App

\n" + " \n" + "\n" + ""; + + "
  • Home Page
  • \n" + " \n" + "\n" + ""; String filename = "index.html"; fileHelper.createFile(folderPath, filename, index); @@ -58,6 +58,18 @@ public class SureopsService { } } + public Long getUpdatedPort(Long webid) { + + String url = PortConstant.SUREOPS_DOMAIN + "/sureops/resource/port"; + + ResponseEntity get = GET(url); + + Object body = get.getBody(); + Long port = Long.valueOf(body.toString()); + return port; + + } + public ResponseEntity GET(String get) { RestTemplate restTemplate = new RestTemplate();