new
This commit is contained in:
		
							parent
							
								
									3a07d5a501
								
							
						
					
					
						commit
						ab1237419c
					
				@ -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 {
 | 
			
		||||
 | 
			
		||||
@ -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++;
 | 
			
		||||
 | 
			
		||||
@ -35,25 +35,20 @@ public class Script_Making {
 | 
			
		||||
 | 
			
		||||
//	Creating files like yaml, shell SCript ,docker File
 | 
			
		||||
 | 
			
		||||
	public ResponseEntity<?> CreateFiles(Integer prj_id,String workflow_id,long Deployment_profile)
 | 
			
		||||
	public ResponseEntity<?> CreateFiles(Integer prj_id, String workflow_id, long Deployment_profile)
 | 
			
		||||
			throws IOException {
 | 
			
		||||
		
 | 
			
		||||
 | 
			
		||||
//		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,29 +71,23 @@ 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++;
 | 
			
		||||
				} 
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if (i == 1) {
 | 
			
		||||
 | 
			
		||||
			sureservice.Createonefile(prj_id, lineList, workflow_model,   Deployment_profile);
 | 
			
		||||
			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<>();
 | 
			
		||||
@ -110,7 +98,7 @@ public class Script_Making {
 | 
			
		||||
		JsonElement element = parser.parse(str);
 | 
			
		||||
 | 
			
		||||
		JsonObject obj = element.getAsJsonObject();
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
		String prj_name = obj.get("projectName").getAsString();
 | 
			
		||||
		list.add(prj_name);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user