deployment
This commit is contained in:
parent
d5b1b11682
commit
4ed27c9019
@ -0,0 +1,146 @@
|
|||||||
|
package com.realnet.OpenAi.Controller;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.realnet.OpenAi.Services.ScriptRunnerService;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin(origins = "*")
|
||||||
|
@RequestMapping("/openAi")
|
||||||
|
public class ScriptRunnerController {
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectpath;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScriptRunnerService scriptRunnerService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* runScript method by reading file
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// RUN SCRIPT
|
||||||
|
@GetMapping(value = "/runScript")
|
||||||
|
public ResponseEntity<?> runScript(@RequestParam String filepath, @RequestParam String filename)
|
||||||
|
throws IOException {
|
||||||
|
|
||||||
|
System.out.println("runScript method called in ScriptRunnerController");
|
||||||
|
|
||||||
|
ResponseEntity<?> runScript = scriptRunnerService.runScript(filepath, filename);
|
||||||
|
return runScript;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOT IN USE
|
||||||
|
@GetMapping(value = "/runScript1")
|
||||||
|
public ResponseEntity<?> runScript1(@RequestParam String s1, @RequestParam String s2) throws IOException {
|
||||||
|
|
||||||
|
System.out.println("runScript method called in ScriptRunnerController");
|
||||||
|
|
||||||
|
String str = null;
|
||||||
|
|
||||||
|
String path = projectpath + "/ScriptFiles/copy.sh";
|
||||||
|
System.out.println(path);
|
||||||
|
File pathfile = new File(path);
|
||||||
|
String filename = pathfile.getName();
|
||||||
|
|
||||||
|
String line = "";
|
||||||
|
StringBuilder intialize = new StringBuilder();
|
||||||
|
StringBuilder class_name = new StringBuilder();
|
||||||
|
StringBuilder middle = new StringBuilder();
|
||||||
|
StringBuilder end = new StringBuilder();
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader(path));
|
||||||
|
intialize.append("\"");
|
||||||
|
intialize.append("*****************************************\n" + "Below is the script to copy reporsitry\n"
|
||||||
|
+ "*****************************************\n" + "#!/bin/bash\n");
|
||||||
|
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
String[] data = line.split(",");
|
||||||
|
for (String d : data) {
|
||||||
|
if (d.contains("PRJ_NAME=")) {
|
||||||
|
intialize.append("PRJ_NAME=gitclone");
|
||||||
|
intialize.append("\n");
|
||||||
|
} else if (d.contains("GIT_USER=")) {
|
||||||
|
intialize.append("GIT_USER=admin123");
|
||||||
|
intialize.append("\n");
|
||||||
|
} else if (d.contains("GIT_PASS=")) {
|
||||||
|
intialize.append("GIT_PASS=admin123");
|
||||||
|
intialize.append("\n");
|
||||||
|
} else if (d.contains("GIT_URL_FROM=")) {
|
||||||
|
intialize.append("GIT_URL_FROM=http://13.126.217.36:31633/admin123/" + s1 + ".git");
|
||||||
|
intialize.append("\n");
|
||||||
|
} else if (d.contains("GIT_URL_TO=")) {
|
||||||
|
intialize.append("GIT_URL_TO=http://13.126.217.36:31633/admin123/" + s2 + ".git");
|
||||||
|
intialize.append("\n");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intialize.append("docker build .\n" + "echo IMAGE_NAME=$GIT_URL_TO");
|
||||||
|
|
||||||
|
System.out.println(intialize);
|
||||||
|
|
||||||
|
String path1 = projectpath + "/testingfor script/" + filename;
|
||||||
|
System.out.println(path1);
|
||||||
|
|
||||||
|
FileWriter fw = null;
|
||||||
|
BufferedWriter bw = null;
|
||||||
|
|
||||||
|
// FILE NAME SHOULD CHANGE DEPENDS ON TECH_STACK/OBJECT_tYPE/SUB_OBJECT_TYPE
|
||||||
|
File masterBuilderFile = new File(path1);
|
||||||
|
if (!masterBuilderFile.exists()) {
|
||||||
|
masterBuilderFile.createNewFile();
|
||||||
|
}
|
||||||
|
fw = new FileWriter(masterBuilderFile.getAbsoluteFile());
|
||||||
|
bw = new BufferedWriter(fw);
|
||||||
|
bw.write(intialize.toString());
|
||||||
|
bw.close();
|
||||||
|
|
||||||
|
ProcessBuilder pb = new
|
||||||
|
|
||||||
|
ProcessBuilder(path1);
|
||||||
|
|
||||||
|
System.out.println("path taken =" + path1);
|
||||||
|
System.out.println(new File(path1).getAbsoluteFile());
|
||||||
|
|
||||||
|
pb.directory(new File(System.getProperty("user.home")));
|
||||||
|
|
||||||
|
Process process = pb.start();
|
||||||
|
if (process.isAlive()) {
|
||||||
|
|
||||||
|
// Process process = Runtime.getRuntime().exec("where java");
|
||||||
|
|
||||||
|
BufferedReader br2 = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
|
|
||||||
|
System.out.println("file is running");
|
||||||
|
|
||||||
|
while ((str = br2.readLine()) != null) {
|
||||||
|
System.out.println(str);
|
||||||
|
}
|
||||||
|
br2.close();
|
||||||
|
return new ResponseEntity<>("file is running", HttpStatus.OK);
|
||||||
|
} else {
|
||||||
|
return new ResponseEntity<>("bad request", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.realnet.OpenAi.Services.ScriptRunnerService;
|
||||||
import com.realnet.OpenAi.Services.Script_Making;
|
import com.realnet.OpenAi.Services.Script_Making;
|
||||||
import com.realnet.fnd.response.EntityResponse;
|
import com.realnet.fnd.response.EntityResponse;
|
||||||
|
|
||||||
@ -24,16 +26,21 @@ import com.realnet.fnd.response.EntityResponse;
|
|||||||
@RequestMapping("/sureops")
|
@RequestMapping("/sureops")
|
||||||
public class SureOpsController {
|
public class SureOpsController {
|
||||||
|
|
||||||
|
@Value("${projectPath}")
|
||||||
|
private String projectpath;
|
||||||
@Autowired
|
@Autowired
|
||||||
private Script_Making script_serviceMaking;
|
private Script_Making script_serviceMaking;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScriptRunnerService scriptRunnerService;
|
||||||
|
|
||||||
@Value("${projectPath}")
|
@Value("${projectPath}")
|
||||||
private String projectPath;
|
private String projectPath;
|
||||||
|
|
||||||
public ResponseEntity<?> PullScript(@PathVariable Integer projId, @PathVariable String workflow_id)
|
@GetMapping("/deploy")
|
||||||
throws IOException, InterruptedException {
|
public ResponseEntity<?> makeScript(@RequestParam Integer projId) throws IOException, InterruptedException {
|
||||||
|
|
||||||
// String workflow_id = "56"; // pull script
|
String workflow_id = "56"; // pull script
|
||||||
int status_code = 500;
|
int status_code = 500;
|
||||||
|
|
||||||
String responsebody = null;
|
String responsebody = null;
|
||||||
@ -43,13 +50,48 @@ public class SureOpsController {
|
|||||||
ResponseEntity<?> get = script_serviceMaking.CreateFiles(projId, workflow_id, Deployment_profile);
|
ResponseEntity<?> get = script_serviceMaking.CreateFiles(projId, workflow_id, Deployment_profile);
|
||||||
|
|
||||||
status_code = get.getStatusCodeValue();
|
status_code = get.getStatusCodeValue();
|
||||||
|
String filepath = projectPath + File.separator + projId + File.separator + "index";
|
||||||
|
|
||||||
if (status_code <= 209) {
|
if (status_code <= 209) {
|
||||||
|
System.out.println(" pull scriopt make");
|
||||||
|
|
||||||
if (get.getBody() != null) {
|
if (get.getBody() != null) {
|
||||||
|
|
||||||
responsebody = get.getBody().toString().replace("{", "").replace("}", "");
|
responsebody = get.getBody().toString().replace("{", "").replace("}", "");
|
||||||
|
|
||||||
|
}
|
||||||
|
String filename = "git_pull_exec.sh";
|
||||||
|
|
||||||
|
ResponseEntity<?> script = scriptRunnerService.runScript(filepath, filename);
|
||||||
|
|
||||||
|
if (script.getStatusCodeValue() <= 209) {
|
||||||
|
System.out.println(" Run Pull script successfullt now make all file");
|
||||||
|
|
||||||
|
workflow_id = "58";
|
||||||
|
ResponseEntity<?> pushScript = script_serviceMaking.CreateFiles(projId, workflow_id,
|
||||||
|
Deployment_profile);
|
||||||
|
if (pushScript.getStatusCodeValue() <= 209) {
|
||||||
|
|
||||||
|
String pushScriptfilename = "git_push_exec.sh";
|
||||||
|
|
||||||
|
ResponseEntity<?> scr = scriptRunnerService.runScript(filepath, pushScriptfilename);
|
||||||
|
|
||||||
|
if (scr.getStatusCodeValue() <= 209) {
|
||||||
|
System.out.println(" Push Script run successfully");
|
||||||
|
|
||||||
|
System.out.println(" All code successfully push");
|
||||||
|
|
||||||
|
workflow_id = "245";
|
||||||
|
|
||||||
|
ResponseEntity<?> deployScript = script_serviceMaking.CreateFiles(projId, workflow_id,
|
||||||
|
Deployment_profile);
|
||||||
|
|
||||||
|
System.out.println("now deploy script make and run");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ResponseEntity<>(new EntityResponse(responsebody), HttpStatus.OK);
|
return new ResponseEntity<>(new EntityResponse(responsebody), HttpStatus.OK);
|
||||||
@ -69,33 +111,32 @@ public class SureOpsController {
|
|||||||
|
|
||||||
@PostMapping("/createFile")
|
@PostMapping("/createFile")
|
||||||
public void createHtmlFiles(@RequestParam Integer projId, @RequestBody Map<String, String> pageHtmlMap)
|
public void createHtmlFiles(@RequestParam Integer projId, @RequestBody Map<String, String> pageHtmlMap)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
for (Map.Entry<String, String> entry : pageHtmlMap.entrySet()) {
|
for (Map.Entry<String, String> entry : pageHtmlMap.entrySet()) {
|
||||||
String pageName = entry.getKey().trim().replaceAll("\\s+", "_"); // remove spaces from name
|
String pageName = entry.getKey().trim().replaceAll("\\s+", "_"); // remove spaces from name
|
||||||
String htmlContent = entry.getValue();
|
String htmlContent = entry.getValue();
|
||||||
|
|
||||||
String folderPath = projectPath + "/cns-portal/code-extractor/builders/" + projId;
|
String folderPath = projectPath + "/cns-portal/code-extractor/builders/" + projId;
|
||||||
File file = new File(folderPath + "/" + pageName + ".html");
|
File file = new File(folderPath + "/" + pageName + ".html");
|
||||||
|
|
||||||
// Ensure directory exists
|
// Ensure directory exists
|
||||||
File parentDir = file.getParentFile();
|
File parentDir = file.getParentFile();
|
||||||
if (!parentDir.exists()) {
|
if (!parentDir.exists()) {
|
||||||
parentDir.mkdirs();
|
parentDir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new file
|
// Create new file
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
|
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
|
||||||
writer.write(htmlContent);
|
writer.write(htmlContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("✅ File created: " + file.getAbsolutePath());
|
System.out.println("✅ File created: " + file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,49 @@
|
|||||||
|
package com.realnet.OpenAi.Services;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class ScriptRunnerService {
|
||||||
|
|
||||||
|
public ResponseEntity<?> runScript(String filepath, String filename) throws IOException {
|
||||||
|
|
||||||
|
System.out.println("runScript method called in ScriptRunnerController");
|
||||||
|
|
||||||
|
String str = null;
|
||||||
|
|
||||||
|
String path = filepath + "/" + filename;
|
||||||
|
|
||||||
|
ProcessBuilder pb = new
|
||||||
|
|
||||||
|
ProcessBuilder(path);
|
||||||
|
|
||||||
|
System.out.println("file taken =" + new File(path).getAbsoluteFile());
|
||||||
|
|
||||||
|
pb.directory(new File(System.getProperty("user.home")));
|
||||||
|
|
||||||
|
Process process = pb.start();
|
||||||
|
if (process.isAlive()) {
|
||||||
|
|
||||||
|
BufferedReader br2 = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||||
|
|
||||||
|
System.out.println("file is running");
|
||||||
|
|
||||||
|
while ((str = br2.readLine()) != null) {
|
||||||
|
System.out.println(str);
|
||||||
|
}
|
||||||
|
br2.close();
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
} else {
|
||||||
|
return new ResponseEntity<>("bad request", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -254,7 +254,7 @@ public class ScriptSrvice {
|
|||||||
|
|
||||||
// Creating Folder
|
// Creating Folder
|
||||||
|
|
||||||
String Path1 = null;
|
String Path1 = projectPath + File.separator + prj_id;
|
||||||
String ref_path = null;
|
String ref_path = null;
|
||||||
|
|
||||||
// when destination is not empty
|
// when destination is not empty
|
||||||
@ -263,30 +263,12 @@ public class ScriptSrvice {
|
|||||||
|
|
||||||
ref_path = File.separator + sureopspath_name;
|
ref_path = File.separator + sureopspath_name;
|
||||||
|
|
||||||
Path1 = projectPath + File.separator + "cns-portal/code-extractor/builders";
|
|
||||||
|
|
||||||
File builderMainDir1 = new File(Path1);
|
|
||||||
if (!builderMainDir1.exists()) {
|
|
||||||
boolean mkdir = builderMainDir1.mkdir();
|
|
||||||
System.out.println("builder folder " + mkdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
Path1 = Path1 + File.separator + prj_id;
|
|
||||||
|
|
||||||
System.out.println(Path1);
|
|
||||||
|
|
||||||
File staticMainDir1 = new File(Path1);
|
|
||||||
if (!staticMainDir1.exists()) {
|
|
||||||
boolean mkdir = staticMainDir1.mkdir();
|
|
||||||
System.out.println(mkdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
Path1 = Path1 + ref_path;
|
Path1 = Path1 + ref_path;
|
||||||
System.out.println(Path1);
|
System.out.println(Path1);
|
||||||
|
|
||||||
File Dir1 = new File(Path1);
|
File Dir1 = new File(Path1);
|
||||||
if (!Dir1.exists()) {
|
if (!Dir1.exists()) {
|
||||||
boolean mkdir = Dir1.mkdir();
|
boolean mkdir = Dir1.mkdirs();
|
||||||
if (!mkdir) {
|
if (!mkdir) {
|
||||||
System.out.println("folder not created");
|
System.out.println("folder not created");
|
||||||
|
|
||||||
@ -296,22 +278,6 @@ public class ScriptSrvice {
|
|||||||
// when destination is empty
|
// when destination is empty
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Path1 = projectPath + File.separator + "cns-portal/code-extractor/builders";
|
|
||||||
|
|
||||||
File builderMainDir1 = new File(Path1);
|
|
||||||
if (!builderMainDir1.exists()) {
|
|
||||||
boolean mkdir = builderMainDir1.mkdir();
|
|
||||||
System.out.println("builder folder " + mkdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
Path1 = Path1 + File.separator + prj_id;
|
|
||||||
|
|
||||||
File staticMainDir1 = new File(Path1);
|
|
||||||
if (!staticMainDir1.exists()) {
|
|
||||||
boolean mkdir = staticMainDir1.mkdir();
|
|
||||||
System.out.println(mkdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
ref_path = File.separator + "index";
|
ref_path = File.separator + "index";
|
||||||
|
|
||||||
Path1 = Path1 + ref_path;
|
Path1 = Path1 + ref_path;
|
||||||
@ -319,7 +285,7 @@ public class ScriptSrvice {
|
|||||||
|
|
||||||
File Dir2 = new File(Path1);
|
File Dir2 = new File(Path1);
|
||||||
if (!Dir2.exists()) {
|
if (!Dir2.exists()) {
|
||||||
boolean mkdir = Dir2.mkdir();
|
boolean mkdir = Dir2.mkdirs();
|
||||||
if (!mkdir) {
|
if (!mkdir) {
|
||||||
System.out.println("folder not created");
|
System.out.println("folder not created");
|
||||||
|
|
||||||
@ -354,10 +320,12 @@ public class ScriptSrvice {
|
|||||||
String filepath = Path1;
|
String filepath = Path1;
|
||||||
String filename = file_text;
|
String filename = file_text;
|
||||||
|
|
||||||
// INSERT DATA IN JOB PRO FOR RUN SCRIPT
|
if (filename.contains(".sh")) {
|
||||||
// insertin_jobpro(prj_id, filename, filepath);
|
|
||||||
|
|
||||||
// }
|
// INSERT DATA IN JOB PRO FOR RUN SCRIPT
|
||||||
|
insertin_jobpro(prj_id, filename, filepath);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// CALL PROJECT PORTAL
|
// CALL PROJECT PORTAL
|
||||||
@ -537,7 +505,7 @@ public class ScriptSrvice {
|
|||||||
Map<String, String> jobdata = new HashMap<String, String>();
|
Map<String, String> jobdata = new HashMap<String, String>();
|
||||||
// jobdata.put("parameters", builder.toString());
|
// jobdata.put("parameters", builder.toString());
|
||||||
jobdata.put("url",
|
jobdata.put("url",
|
||||||
PortConstant.SUREOPS_DOMAIN + "/sureops/runScript?filepath=" + filepath + "&filename=" + filename);
|
PortConstant.SITE_BUILDER + "/openAi/runScript?filepath=" + filepath + "&filename=" + filename);
|
||||||
jobdata.put("method", "GET");
|
jobdata.put("method", "GET");
|
||||||
jobdata.put("connection_name", "jobprtal");
|
jobdata.put("connection_name", "jobprtal");
|
||||||
jobdata.put("createdBy", "2022");
|
jobdata.put("createdBy", "2022");
|
||||||
|
|||||||
@ -3,11 +3,13 @@ package com.realnet.utils;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
@Component
|
||||||
public class PortConstant {
|
public class PortConstant {
|
||||||
|
|
||||||
public final static String LOCAL_HOST = "43.205.154.152";
|
public static String LOCAL_HOST;
|
||||||
public final static String FRONTEND_PORT_9191 = "30165";
|
public final static String FRONTEND_PORT_9191 = "30165";
|
||||||
|
|
||||||
public final static String GITEA_IP_ADDRESS = "try.gitea";
|
public final static String GITEA_IP_ADDRESS = "try.gitea";
|
||||||
@ -33,6 +35,8 @@ public class PortConstant {
|
|||||||
public static String SURE_VAULT_DOMAIN;
|
public static String SURE_VAULT_DOMAIN;
|
||||||
public static String GITEA_DOMAIN;
|
public static String GITEA_DOMAIN;
|
||||||
public static String GITEA_USERNAME;
|
public static String GITEA_USERNAME;
|
||||||
|
public static String SITE_BUILDER;
|
||||||
|
|
||||||
public static String PROTOCOL;
|
public static String PROTOCOL;
|
||||||
|
|
||||||
// SETTER
|
// SETTER
|
||||||
@ -49,8 +53,6 @@ public class PortConstant {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initializeConstantsFromApi() {
|
public void initializeConstantsFromApi() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (backendPortalDomain != null) {
|
if (backendPortalDomain != null) {
|
||||||
BACKEND_PORTAL_DOMAIN = backendPortalDomain;
|
BACKEND_PORTAL_DOMAIN = backendPortalDomain;
|
||||||
System.out.println("Fetched BACKEND_PORTAL_DOMAIN from properties file: " + backendPortalDomain);
|
System.out.println("Fetched BACKEND_PORTAL_DOMAIN from properties file: " + backendPortalDomain);
|
||||||
@ -75,6 +77,8 @@ public class PortConstant {
|
|||||||
GITEA_DOMAIN = getUrlFromApi(backendPortalDomain, "GITEA_DOMAIN");
|
GITEA_DOMAIN = getUrlFromApi(backendPortalDomain, "GITEA_DOMAIN");
|
||||||
GITEA_USERNAME = getUrlFromApi(backendPortalDomain, "GITEA_USERNAME");
|
GITEA_USERNAME = getUrlFromApi(backendPortalDomain, "GITEA_USERNAME");
|
||||||
PROTOCOL = getUrlFromApi(backendPortalDomain, "PROTOCOL");
|
PROTOCOL = getUrlFromApi(backendPortalDomain, "PROTOCOL");
|
||||||
|
LOCAL_HOST = getUrlFromApi(backendPortalDomain, "LOCAL_HOST");
|
||||||
|
SITE_BUILDER = getUrlFromApi(backendPortalDomain, "SITE_BUILDER");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Error: BACKEND_PORTAL_DOMAIN could not be fetched.");
|
System.out.println("Error: BACKEND_PORTAL_DOMAIN could not be fetched.");
|
||||||
|
|||||||
@ -1,175 +1,55 @@
|
|||||||
package com.realnet.vpspack.Controllers;
|
package com.realnet.vpspack.Controllers;
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import java.util.List;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import com.realnet.config.EmailService;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import com.realnet.users.entity1.AppUser;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import com.realnet.users.service1.AppUserServiceImpl;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
import org.springframework.data.domain.*;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.realnet.fnd.response.EntityResponse;
|
import com.realnet.fnd.response.EntityResponse;
|
||||||
import org.springframework.http.*;
|
|
||||||
import org.springframework.beans.factory.annotation.*;
|
|
||||||
import com.realnet.vpspack.Entity.Visa_application;
|
import com.realnet.vpspack.Entity.Visa_application;
|
||||||
import com.realnet.vpspack.Services.Visa_applicationService ;
|
import com.realnet.vpspack.Services.Visa_applicationService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/Visa_application")
|
@RequestMapping(value = "/Visa_application")
|
||||||
@CrossOrigin("*")
|
@CrossOrigin("*")
|
||||||
@RestController
|
@RestController
|
||||||
public class Visa_applicationController {
|
public class Visa_applicationController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private Visa_applicationService Service;
|
private Visa_applicationService Service;
|
||||||
|
|
||||||
@Value("${projectPath}")
|
@Value("${projectPath}")
|
||||||
private String projectPath;
|
private String projectPath;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/Visa_application")
|
@PostMapping("/Visa_application")
|
||||||
public Visa_application Savedata(@RequestBody Visa_application data) {
|
public Visa_application Savedata(@RequestBody Visa_application data) {
|
||||||
Visa_application save = Service.Savedata(data) ;
|
Visa_application save = Service.Savedata(data);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("data saved..." + save);
|
System.out.println("data saved..." + save);
|
||||||
|
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
@PutMapping("/Visa_application/{id}")
|
|
||||||
public Visa_application update(@RequestBody Visa_application data,@PathVariable Integer id ) {
|
@PutMapping("/Visa_application/{id}")
|
||||||
Visa_application update = Service.update(data,id);
|
public Visa_application update(@RequestBody Visa_application data, @PathVariable Integer id) {
|
||||||
|
Visa_application update = Service.update(data, id);
|
||||||
System.out.println("data update..." + update);
|
System.out.println("data update..." + update);
|
||||||
return update;
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get all with pagination
|
// get all with pagination
|
||||||
@GetMapping("/Visa_application/getall/page")
|
@GetMapping("/Visa_application/getall/page")
|
||||||
public Page<Visa_application> getall(@RequestParam(value = "page", required = false) Integer page,
|
public Page<Visa_application> getall(@RequestParam(value = "page", required = false) Integer page,
|
||||||
@ -179,73 +59,32 @@ public class Visa_applicationController {
|
|||||||
|
|
||||||
return get;
|
return get;
|
||||||
|
|
||||||
}
|
|
||||||
@GetMapping("/Visa_application")
|
|
||||||
public List<Visa_application> getdetails() {
|
|
||||||
List<Visa_application> get = Service.getdetails();
|
|
||||||
return get;
|
|
||||||
}
|
|
||||||
// get all without authentication
|
|
||||||
|
|
||||||
@GetMapping("/token/Visa_application")
|
|
||||||
public List<Visa_application> getallwioutsec() {
|
|
||||||
List<Visa_application> get = Service.getdetails();
|
|
||||||
return get;
|
|
||||||
}
|
|
||||||
@GetMapping("/Visa_application/{id}")
|
|
||||||
public Visa_application getdetailsbyId(@PathVariable Integer id ) {
|
|
||||||
Visa_application get = Service.getdetailsbyId(id);
|
|
||||||
return get;
|
|
||||||
}
|
|
||||||
@DeleteMapping("/Visa_application/{id}")
|
|
||||||
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
|
||||||
Service.delete_by_id(id);
|
|
||||||
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/Visa_application")
|
||||||
|
public List<Visa_application> getdetails() {
|
||||||
|
List<Visa_application> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
// get all without authentication
|
||||||
|
|
||||||
|
@GetMapping("/token/Visa_application")
|
||||||
|
public List<Visa_application> getallwioutsec() {
|
||||||
|
List<Visa_application> get = Service.getdetails();
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/Visa_application/{id}")
|
||||||
|
public Visa_application getdetailsbyId(@PathVariable Integer id) {
|
||||||
|
Visa_application get = Service.getdetailsbyId(id);
|
||||||
|
return get;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/Visa_application/{id}")
|
||||||
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id) {
|
||||||
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -94,8 +94,11 @@ app.auth.tokenExpirationMsec=864000000
|
|||||||
app.oauth2.authorizedRedirectUris=http://localhost:8081/oauth2/redirect,myandroidapp://oauth2/redirect,myiosapp://oauth2/redirect
|
app.oauth2.authorizedRedirectUris=http://localhost:8081/oauth2/redirect,myandroidapp://oauth2/redirect,myiosapp://oauth2/redirect
|
||||||
|
|
||||||
|
|
||||||
projectPath=@project.basedir@
|
#projectPath=@project.basedir@
|
||||||
angularProjectPath=@project.basedir@/webui
|
#angularProjectPath=@project.basedir@/webui
|
||||||
|
|
||||||
|
projectPath=/data
|
||||||
|
angularProjectPath=/data/webui
|
||||||
|
|
||||||
|
|
||||||
BACKEND_PORTAL_DOMAIN=http://157.66.191.31:30166
|
BACKEND_PORTAL_DOMAIN=http://157.66.191.31:30166
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user