This commit is contained in:
string 2025-04-26 11:15:31 +05:30
parent 3a07d5a501
commit ab1237419c
3 changed files with 30 additions and 23 deletions

View File

@ -116,6 +116,19 @@ public class SureOpsController {
}
@GetMapping("/run")
public ResponseEntity<?> runWorkflow(@RequestParam Integer projId, @RequestParam String workflowId)
throws IOException, InterruptedException {
int status_code = 500;
long Deployment_profile = 2l;
// NOW MAKE SHELLSCRIPT THAT CLONE FROM REPOSITORY
ResponseEntity<?> get = script_serviceMaking.CreateFiles(projId, workflowId, Deployment_profile);
return new ResponseEntity<>(new EntityResponse(get.getBody().toString()), HttpStatus.BAD_REQUEST);
}
@PostMapping("/createFile")
public void createHtmlFiles(@RequestParam Integer projId, @RequestBody Map<String, String> pageHtmlMap)
throws IOException {

View File

@ -50,6 +50,11 @@ public class ScriptSrvice {
JsonObject obj = ar.getAsJsonObject();
JsonElement workflowvalue = obj.get("workflow");
if (workflowvalue == null) {
continue;
}
String value = workflowvalue.getAsString();
String tableid_url = PortConstant.BACKEND_PORTAL_DOMAIN
@ -94,7 +99,8 @@ public class ScriptSrvice {
String value = entry.getValue().getAsString();
keys.add(value);
if (value.equalsIgnoreCase("Shell Script")) {
if (value.equalsIgnoreCase("Shell Script") || value.equalsIgnoreCase("Others")
|| value.equals("Yamel File") || (value.equalsIgnoreCase("Docker File"))) {
System.out.println("script data");
script(prj_id, workflow_model, PRJ_NAME, gitea_url, Deployment_profile);
i++;

View File

@ -40,20 +40,15 @@ public class Script_Making {
// String table_name = tble.replaceAll(" ", "_").toLowerCase();
String prj_url = PortConstant.BACKEND_PORTAL_DOMAIN
+ "/token/fnd1/callingsureops/getproject/" + prj_id;
String prj_url = PortConstant.BACKEND_PORTAL_DOMAIN + "/token/fnd1/callingsureops/getproject/" + prj_id;
// get project
ResponseEntity<Object> prj = GET(prj_url);
Object prj_body = prj.getBody();
List<String> lineList = callforproject(prj_body);
// get workflowline
String line_url = PortConstant.BACKEND_PORTAL_DOMAIN
+ "/token/fnd1/callingsureops/workflowline/" + workflow_id;
String line_url = PortConstant.BACKEND_PORTAL_DOMAIN + "/token/fnd1/callingsureops/workflowline/" + workflow_id;
ResponseEntity<Object> get = GET(line_url);
Object body = get.getBody();
String workflow_model = callforline(body);
@ -61,7 +56,6 @@ public class Script_Making {
String PRJ_NAME = lineList.get(0);
String gitea_url = lineList.get(1);
// Parsing Json data
JsonParser parser1 = new JsonParser();
@ -77,10 +71,10 @@ public class Script_Making {
String key = entry.getKey();
String value1 = entry.getValue().getAsString();
if (value1.equalsIgnoreCase("Shell Script")) {
if (value1.equalsIgnoreCase("Shell Script") || value1.equalsIgnoreCase("Others")
|| value1.equals("Yamel File") || (value1.equalsIgnoreCase("Docker File"))) {
System.out.println("script data");
sureservice.script(prj_id, workflow_model, PRJ_NAME, gitea_url,
Deployment_profile);
sureservice.script(prj_id, workflow_model, PRJ_NAME, gitea_url, Deployment_profile);
i++;
}
}
@ -90,16 +84,10 @@ public class Script_Making {
sureservice.Createonefile(prj_id, lineList, workflow_model, Deployment_profile);
}
return new ResponseEntity<>(new EntityResponse("script file created"), HttpStatus.CREATED);
}
public List<String> callforproject(Object object) throws JsonProcessingException {
List<String> list = new ArrayList<>();