Ejemplo n.º 1
0
 @ResponseBody
 @Security(open = false, role = Role.DEVELOPER)
 @RequestMapping(params = "method=generator.update")
 public GeneratorUpdateResponse update(GeneratorUpdateRequest request) {
   Generator generator = generatorService.update(request);
   return new GeneratorUpdateResponse(generator);
 }
Ejemplo n.º 2
0
 @ResponseBody
 @Security(open = false, role = Role.USER)
 @RequestMapping(params = "method=generator.search")
 public GeneratorSearchResponse search(GeneratorSearchRequest request) {
   PagerResult<Generator> pagerResult = generatorService.search(request);
   return new GeneratorSearchResponse(pagerResult);
 }
Ejemplo n.º 3
0
 @ResponseBody
 @Security(open = false, role = Role.USER)
 @RequestMapping(params = "method=generator.get")
 public GeneratorGetResponse get(GeneratorGetRequest request) {
   Generator generator = generatorService.get(request);
   return new GeneratorGetResponse(generator);
 }
Ejemplo n.º 4
0
 @ResponseBody
 @Security(open = false, role = Role.DEVELOPER)
 @RequestMapping(params = "method=generator.import")
 public GeneratorImportResponse _import(GeneratorImportRequest request) {
   Generator generator = generatorService._import(request);
   return new GeneratorImportResponse(generator);
 }
Ejemplo n.º 5
0
 @ResponseBody
 @Security(open = false, role = Role.USER)
 @RequestMapping(params = "method=generator.authSearch")
 public GeneratorSearchResponse authSearch(GeneratorSearchRequest request) {
   Long userId = request.getAuthentication().getUserId();
   request.setDeveloperId(userId);
   PagerResult<Generator> pagerResult = generatorService.search(request);
   return new GeneratorSearchResponse(pagerResult);
 }
Ejemplo n.º 6
0
 @Security(open = false, role = Role.DEVELOPER)
 @RequestMapping(params = "method=generator.export")
 public ResponseEntity<byte[]> export(GeneratorExportRequest request) throws IOException {
   Long userId = request.getAuthentication().getUserId();
   Generator generator = generatorService.export(request);
   File file =
       new File(
           ConfigProperties.TEMPORARY_PATH
               + ConfigProperties.fileSeparator
               + userId
               + ConfigProperties.fileSeparator
               + generator.getName()
               + "("
               + generator.getId()
               + ").zip");
   HttpHeaders headers = new HttpHeaders();
   String fileName = java.net.URLEncoder.encode(file.getName(), "UTF-8");
   headers.setContentDispositionFormData("attachment", fileName);
   headers.add("filename", fileName);
   headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
   return new ResponseEntity<>(FileUtils.readFileToByteArray(file), headers, HttpStatus.CREATED);
 }