test_class.declarator: mockMvc
test_class.modifier: @Autowired
test_class.original_string: @Autowired
      MockMvc mockMvc;
test_class.type: MockMvc
test_class.var_name: mockMvc
test_class.declarator: paullGenericController
test_class.modifier: @Autowired
test_class.original_string: @Autowired
      PaullGenericController paullGenericController;
test_class.type: PaullGenericController
test_class.var_name: paullGenericController
test_class.declarator: sesileService
test_class.modifier: @MockBean
test_class.original_string: @MockBean
      SesileService sesileService;
test_class.type: SesileService
test_class.var_name: sesileService
test_class.declarator: localAuthorityService
test_class.modifier: @MockBean
test_class.original_string: @MockBean
      LocalAuthorityService localAuthorityService;
test_class.type: LocalAuthorityService
test_class.var_name: localAuthorityService
test_class.declarator: paullService
test_class.modifier: @MockBean
test_class.original_string: @MockBean
      PaullService paullService;
test_class.type: PaullService
test_class.var_name: paullService
test_class.declarator: certUtilService
test_class.modifier: @MockBean
test_class.original_string: @MockBean
      CertUtilService certUtilService;
test_class.type: CertUtilService
test_class.var_name: certUtilService
test_class.declarator: externalRestService
test_class.modifier: @MockBean
test_class.original_string: @MockBean
      ExternalRestService externalRestService;
test_class.type: ExternalRestService
test_class.var_name: externalRestService
test_class.declarator: urlTemplate = "/rest/externalws/SIREN/fr/classic/webservgeneriques/services/api/rest.php/"
test_class.modifier: private
test_class.original_string: private String urlTemplate = "/rest/externalws/SIREN/fr/classic/webservgeneriques/services/api/rest.php/";
test_class.type: String
test_class.var_name: urlTemplate
test_class.declarator: httpHeaders
test_class.modifier: private
test_class.original_string: private HttpHeaders httpHeaders;
test_class.type: HttpHeaders
test_class.var_name: httpHeaders
test_class.declarator: localAuthority
test_class.modifier: private
test_class.original_string: private LocalAuthority localAuthority;
test_class.type: LocalAuthority
test_class.var_name: localAuthority
test_class.file: pes-service/src/test/java/fr/sictiam/stela/pesservice/controller/PaullGenericControllerTest.java
test_class.identifier: PaullGenericControllerTest
test_case.body: @Test
      public void getDocument() throws Exception {
          ResultActions resultActions =
                  mockMvc.perform(
                          get(urlTemplate.replaceFirst("SIREN", "sys250601879") + "/doc/3000")
                                  .headers(httpHeaders));
  
          resultActions
                  .andExpect(matchAll(
                          status().isOk(),
                          jsonPath("$.status").value(200),
                          jsonPath("$.status_message").value("OK"),
                          jsonPath("$.data").hasJsonPath(),
                          jsonPath("$.data.NomDocument").isNotEmpty()))
                  .andDo(print());
      }
test_case.class_method_signature: PaullGenericControllerTest.getDocument()
test_case.full_signature: @Test public void getDocument()
test_case.identifier: getDocument
test_case.invocations: perform headers get replaceFirst andDo andExpect matchAll isOk status value jsonPath value jsonPath hasJsonPath jsonPath isNotEmpty jsonPath print
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getDocument()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(PaullGenericController.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(PaullGenericController.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: sesileService
focal_class.modifier: private final
focal_class.original_string: private final SesileService sesileService;
focal_class.type: SesileService
focal_class.var_name: sesileService
focal_class.declarator: localAuthorityService
focal_class.modifier: private final
focal_class.original_string: private final LocalAuthorityService localAuthorityService;
focal_class.type: LocalAuthorityService
focal_class.var_name: localAuthorityService
focal_class.declarator: paullService
focal_class.modifier: private final
focal_class.original_string: private final PaullService paullService;
focal_class.type: PaullService
focal_class.var_name: paullService
focal_class.declarator: externalRestService
focal_class.modifier: private final
focal_class.original_string: private final ExternalRestService externalRestService;
focal_class.type: ExternalRestService
focal_class.var_name: externalRestService
focal_class.file: pes-service/src/main/java/fr/sictiam/stela/pesservice/controller/PaullGenericController.java
focal_class.identifier: PaullGenericController
focal_class.class_method_signature: PaullGenericController.PaullGenericController(SesileService sesileService, LocalAuthorityService localAuthorityService,
                                    PaullService paullService, ExternalRestService externalRestService)
focal_class.full_signature: public  PaullGenericController(SesileService sesileService, LocalAuthorityService localAuthorityService,
                                    PaullService paullService, ExternalRestService externalRestService)
focal_class.identifier: PaullGenericController
focal_class.modifiers: public
focal_class.parameters: (SesileService sesileService, LocalAuthorityService localAuthorityService,
                                    PaullService paullService, ExternalRestService externalRestService)
focal_class.signature:  PaullGenericController(SesileService sesileService, LocalAuthorityService localAuthorityService,
                                    PaullService paullService, ExternalRestService externalRestService)
focal_class.class_method_signature: PaullGenericController.generatePaullResponse(HttpStatus httpStatus, Object datas)
focal_class.full_signature: private PaullResponse generatePaullResponse(HttpStatus httpStatus, Object datas)
focal_class.identifier: generatePaullResponse
focal_class.modifiers: private
focal_class.parameters: (HttpStatus httpStatus, Object datas)
focal_class.return: PaullResponse
focal_class.signature: PaullResponse generatePaullResponse(HttpStatus httpStatus, Object datas)
focal_class.class_method_signature: PaullGenericController.generatePaullResponse(HttpStatus httpStatus, Object datas, String customMessage)
focal_class.full_signature: private PaullResponse generatePaullResponse(HttpStatus httpStatus, Object datas, String customMessage)
focal_class.identifier: generatePaullResponse
focal_class.modifiers: private
focal_class.parameters: (HttpStatus httpStatus, Object datas, String customMessage)
focal_class.return: PaullResponse
focal_class.signature: PaullResponse generatePaullResponse(HttpStatus httpStatus, Object datas, String customMessage)
focal_class.class_method_signature: PaullGenericController.depotDocument(@PathVariable String siren, MultipartHttpServletRequest request,
              @RequestParam(name = "title", required = false) String title,
              @RequestParam(name = "comment", required = false) String comment,
              @RequestParam(name = "name", required = false) String name,
              @RequestParam(name = "desc", required = false) String desc,
              @RequestParam(name = "validation", required = false) String validation,
              @RequestParam(name = "email", required = false) String email,
              @RequestParam(name = "type", required = false) Integer type,
              @RequestParam(name = "service", required = false) String service,
              @RequestHeader("userid") String userid,
              @RequestHeader("password") String password)
focal_class.full_signature: @PostMapping("/depot") public ResponseEntity<?> depotDocument(@PathVariable String siren, MultipartHttpServletRequest request,
              @RequestParam(name = "title", required = false) String title,
              @RequestParam(name = "comment", required = false) String comment,
              @RequestParam(name = "name", required = false) String name,
              @RequestParam(name = "desc", required = false) String desc,
              @RequestParam(name = "validation", required = false) String validation,
              @RequestParam(name = "email", required = false) String email,
              @RequestParam(name = "type", required = false) Integer type,
              @RequestParam(name = "service", required = false) String service,
              @RequestHeader("userid") String userid,
              @RequestHeader("password") String password)
focal_class.identifier: depotDocument
focal_class.modifiers: @PostMapping("/depot") public
focal_class.parameters: (@PathVariable String siren, MultipartHttpServletRequest request,
              @RequestParam(name = "title", required = false) String title,
              @RequestParam(name = "comment", required = false) String comment,
              @RequestParam(name = "name", required = false) String name,
              @RequestParam(name = "desc", required = false) String desc,
              @RequestParam(name = "validation", required = false) String validation,
              @RequestParam(name = "email", required = false) String email,
              @RequestParam(name = "type", required = false) Integer type,
              @RequestParam(name = "service", required = false) String service,
              @RequestHeader("userid") String userid,
              @RequestHeader("password") String password)
focal_class.return: ResponseEntity<?>
focal_class.signature: ResponseEntity<?> depotDocument(@PathVariable String siren, MultipartHttpServletRequest request,
              @RequestParam(name = "title", required = false) String title,
              @RequestParam(name = "comment", required = false) String comment,
              @RequestParam(name = "name", required = false) String name,
              @RequestParam(name = "desc", required = false) String desc,
              @RequestParam(name = "validation", required = false) String validation,
              @RequestParam(name = "email", required = false) String email,
              @RequestParam(name = "type", required = false) Integer type,
              @RequestParam(name = "service", required = false) String service,
              @RequestHeader("userid") String userid,
              @RequestHeader("password") String password)
focal_class.class_method_signature: PaullGenericController.infosDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.full_signature: @GetMapping("/infosdoc/{idFlux}") public ResponseEntity<?> infosDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.identifier: infosDocument
focal_class.modifiers: @GetMapping("/infosdoc/{idFlux}") public
focal_class.parameters: (@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.return: ResponseEntity<?>
focal_class.signature: ResponseEntity<?> infosDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.class_method_signature: PaullGenericController.getDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.full_signature: @GetMapping("/doc/{idFlux}") public ResponseEntity<?> getDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.identifier: getDocument
focal_class.modifiers: @GetMapping("/doc/{idFlux}") public
focal_class.parameters: (@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.return: ResponseEntity<?>
focal_class.signature: ResponseEntity<?> getDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.class_method_signature: PaullGenericController.getServices(@PathVariable String siren, @PathVariable String email,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.full_signature: @GetMapping("/servicesorganisationnels/{email}") public ResponseEntity<?> getServices(@PathVariable String siren, @PathVariable String email,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.identifier: getServices
focal_class.modifiers: @GetMapping("/servicesorganisationnels/{email}") public
focal_class.parameters: (@PathVariable String siren, @PathVariable String email,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.return: ResponseEntity<?>
focal_class.signature: ResponseEntity<?> getServices(@PathVariable String siren, @PathVariable String email,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_class.class_method_signature: PaullGenericController.notFoundLocalAuthority(Map data)
focal_class.full_signature: private ResponseEntity<Object> notFoundLocalAuthority(Map data)
focal_class.identifier: notFoundLocalAuthority
focal_class.modifiers: private
focal_class.parameters: (Map data)
focal_class.return: ResponseEntity<Object>
focal_class.signature: ResponseEntity<Object> notFoundLocalAuthority(Map data)
focal_class.class_method_signature: PaullGenericController.notFoundClasseur(Map data)
focal_class.full_signature: private ResponseEntity<Object> notFoundClasseur(Map data)
focal_class.identifier: notFoundClasseur
focal_class.modifiers: private
focal_class.parameters: (Map data)
focal_class.return: ResponseEntity<Object>
focal_class.signature: ResponseEntity<Object> notFoundClasseur(Map data)
focal_class.class_method_signature: PaullGenericController.errorWhileSearchingClasseur(Map data)
focal_class.full_signature: private ResponseEntity<Object> errorWhileSearchingClasseur(Map data)
focal_class.identifier: errorWhileSearchingClasseur
focal_class.modifiers: private
focal_class.parameters: (Map data)
focal_class.return: ResponseEntity<Object>
focal_class.signature: ResponseEntity<Object> errorWhileSearchingClasseur(Map data)
focal_class.class_method_signature: PaullGenericController.noDocumentInClasseur(Map data)
focal_class.full_signature: private ResponseEntity<Object> noDocumentInClasseur(Map data)
focal_class.identifier: noDocumentInClasseur
focal_class.modifiers: private
focal_class.parameters: (Map data)
focal_class.return: ResponseEntity<Object>
focal_class.signature: ResponseEntity<Object> noDocumentInClasseur(Map data)
focal_class.class_method_signature: PaullGenericController.authGenericAccountForbidden(Map data)
focal_class.full_signature: private ResponseEntity<Object> authGenericAccountForbidden(Map data)
focal_class.identifier: authGenericAccountForbidden
focal_class.modifiers: private
focal_class.parameters: (Map data)
focal_class.return: ResponseEntity<Object>
focal_class.signature: ResponseEntity<Object> authGenericAccountForbidden(Map data)
focal_method.body: @GetMapping("/doc/{idFlux}")
      public ResponseEntity<?> getDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password) throws IOException {
  
          Map<String, Object> data = new HashMap<>();
  
          if (paullService.emailAuth(userid, password) == null) return this.authGenericAccountForbidden(data);
  
          Optional<LocalAuthority> localAuthority = localAuthorityService.getBySiren(StringUtils.removeStart(siren, "sys"));
  
          if (!localAuthority.isPresent()) return this.notFoundLocalAuthority(data);
  
          ResponseEntity<Classeur> classeurResponse = sesileService.checkClasseurStatus(localAuthority.get(), idFlux);
  
          if (classeurResponse.getStatusCode().isError() && !classeurResponse.hasBody())
              return this.notFoundClasseur(data);
  
          Classeur classeur = classeurResponse.getBody();
  
          if (classeur == null) return this.errorWhileSearchingClasseur(data);
  
          if (classeur.getDocuments().isEmpty()) return this.noDocumentInClasseur(data);
  
          Document document = classeur.getDocuments().get(0);
          data.put("NomDocument", document.getName());
          data.put("Contenu", Base64.encode(sesileService.getDocumentBody(localAuthority.get(), document.getId())));
          data.put("datevalide", classeur.getValidation());
  
          return new ResponseEntity<Object>(generatePaullResponse(HttpStatus.OK, data, "OK"), HttpStatus.OK);
      }
focal_method.class_method_signature: PaullGenericController.getDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_method.full_signature: @GetMapping("/doc/{idFlux}") public ResponseEntity<?> getDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_method.identifier: getDocument
focal_method.invocations: emailAuth authGenericAccountForbidden getBySiren removeStart isPresent notFoundLocalAuthority checkClasseurStatus get isError getStatusCode hasBody notFoundClasseur getBody errorWhileSearchingClasseur isEmpty getDocuments noDocumentInClasseur get getDocuments put getName put encode getDocumentBody get getId put getValidation generatePaullResponse
focal_method.modifiers: @GetMapping("/doc/{idFlux}") public
focal_method.parameters: (@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)
focal_method.return: ResponseEntity<?>
focal_method.signature: ResponseEntity<?> getDocument(@PathVariable String siren, @PathVariable Integer idFlux,
              @RequestHeader("userid") String userid, @RequestHeader("password") String password)