2dbb4d1144f6680ba4f2207df747043ad61c3f57
[vid.git] / vid-app-common / src / main / java / org / onap / vid / controllers / RoleGeneratorController.java
1 package org.onap.vid.controllers;
2
3 import fj.test.Bool;
4 import org.json.JSONObject;
5 import org.onap.portalsdk.core.controller.UnRestrictedBaseController;
6 import org.onap.vid.services.RoleGeneratorService;
7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.http.HttpStatus;
9 import org.springframework.http.MediaType;
10 import org.springframework.http.ResponseEntity;
11 import org.springframework.web.bind.annotation.PathVariable;
12 import org.springframework.web.bind.annotation.RequestMapping;
13 import org.springframework.web.bind.annotation.RequestMethod;
14 import org.springframework.web.bind.annotation.RestController;
15
16 import javax.servlet.http.HttpServletRequest;
17
18 @RestController
19 public class RoleGeneratorController extends UnRestrictedBaseController {
20     @Autowired
21     private RoleGeneratorService roleGeneratorService;
22     public static final String GENERATE_ROLE_SCRIPT = "generateRoleScript";
23     @RequestMapping(value =  GENERATE_ROLE_SCRIPT +"/{firstRun}", method = RequestMethod.GET )
24     public ResponseEntity<String> generateRoleScript (@PathVariable("firstRun") boolean firstRun) throws Exception {
25         ResponseEntity<String> response = null;
26         String query = roleGeneratorService.generateRoleScript(firstRun);
27         response = new ResponseEntity<String>(query, HttpStatus.OK);
28         return response;
29     }
30
31 }