test_class.declarator: applicationContext
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private ApplicationContext applicationContext;
test_class.type: ApplicationContext
test_class.var_name: applicationContext
test_class.declarator: mockClient
test_class.modifier: private
test_class.original_string: private MockWebServiceClient mockClient;
test_class.type: MockWebServiceClient
test_class.var_name: mockClient
test_class.declarator: paullEndpoint
test_class.modifier: @SpyBean
      private
test_class.original_string: @SpyBean
      private PaullEndpoint paullEndpoint;
test_class.type: PaullEndpoint
test_class.var_name: paullEndpoint
test_class.declarator: pesAllerService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private PesAllerService pesAllerService;
test_class.type: PesAllerService
test_class.var_name: pesAllerService
test_class.declarator: pesRetourService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private PesRetourService pesRetourService;
test_class.type: PesRetourService
test_class.var_name: pesRetourService
test_class.declarator: localAuthorityService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private LocalAuthorityService localAuthorityService;
test_class.type: LocalAuthorityService
test_class.var_name: localAuthorityService
test_class.declarator: externalRestService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private ExternalRestService externalRestService;
test_class.type: ExternalRestService
test_class.var_name: externalRestService
test_class.declarator: sesileService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private SesileService sesileService;
test_class.type: SesileService
test_class.var_name: sesileService
test_class.declarator: dateFormatterWithSeconds = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss")
test_class.modifier: private
test_class.original_string: private DateTimeFormatter dateFormatterWithSeconds = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
test_class.type: DateTimeFormatter
test_class.var_name: dateFormatterWithSeconds
test_class.declarator: dateFormatterWithMinutes = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")
test_class.modifier: private
test_class.original_string: private DateTimeFormatter dateFormatterWithMinutes = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
test_class.type: DateTimeFormatter
test_class.var_name: dateFormatterWithMinutes
test_class.declarator: dateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy")
test_class.modifier: private
test_class.original_string: private DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
test_class.type: DateTimeFormatter
test_class.var_name: dateFormatter
test_class.file: pes-service/src/test/java/fr/sictiam/stela/pesservice/soap/endpoints/PaullEndpointTest.java
test_class.identifier: PaullEndpointTest
test_case.body: @Test
      public void getDetailsPesAller() throws IOException, ParseException {
  
          LocalDateTime now = LocalDateTime.now();
  
          String detailsPesAllerRequest =
              "<getDetailsPESAllerRequest xmlns='http://www.processmaker.com'>" +
                  "<sessionId>sessionid</sessionId>" +
                  "<IdPesAller>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</IdPesAller>" +
              "</getDetailsPESAllerRequest>";
  
          String detailsPesAllerResponse =
              "<ns2:getDetailsPESAllerResponse xmlns:ns2=\"http://www.processmaker.com\">" +
                  "<ns2:statusCode>OK</ns2:statusCode>" +
                  "<ns2:retour>" +
                      "<ns2:message>SUCCESS</ns2:message>" +
                      "<ns2:PESPJ>0</ns2:PESPJ>" +
                      "<ns2:objet>objet</ns2:objet>" +
                      "<ns2:userName>agent@sictiam.fr</ns2:userName>" +
                      "<ns2:nomDocument>pes.xml</ns2:nomDocument>" +
                      "<ns2:dateDepot>" + dateFormatterWithMinutes.format(now) + "</ns2:dateDepot>" +
                      "<ns2:dateAR>" + dateFormatter.format(now) + "</ns2:dateAR>" +
                      "<ns2:dateAnomalie/><ns2:motifAnomalie/>" +
                      "<ns2:motifPlusAnomalie/>" +
                      "<ns2:userNameBannette/>" +
                      "<ns2:dateDepotBannette/>" +
                      "<ns2:statutBannette/>" +
                      "<ns2:etatclasseur>2</ns2:etatclasseur>" +
                      "<ns2:acteurCourant/>" +
                      "<ns2:circuitClasseur/>" +
                      "<ns2:actionsClasseur>" +
                          "<ns2:nomActeur>agent-pes</ns2:nomActeur>" +
                          "<ns2:dateAction>" + dateFormatterWithSeconds.format(now) + "</ns2:dateAction>" +
                          "<ns2:libelleAction>signature</ns2:libelleAction>" +
                      "</ns2:actionsClasseur>" +
                  "</ns2:retour>" +
              "</ns2:getDetailsPESAllerResponse>";
  
          given(paullEndpoint.getToken(any()))
                  .willReturn(new PaullSoapToken());
          given(localAuthorityService.getBySiren(any()))
                  .willReturn(localAuthority());
          given(localAuthorityService.localAuthorityGranted(any(), any()))
                  .willReturn(true);
          given(pesAllerService.getByUuid(any()))
                  .willReturn(pesAller(now));
          given(sesileService.getClasseur(any(), any()))
                  .willReturn(Either.right(classeur(now)));
          given(externalRestService.getProfile(any()))
                  .willReturn(profileNode());
          given(pesAllerService.getPesHistoryByTypes(any(), any()))
                  .willReturn(Collections.singletonList(pesHistory(now)));
  
          mockClient.sendRequest(withPayload(new StringSource(detailsPesAllerRequest)))
                  .andExpect(payload(new StringSource(detailsPesAllerResponse)));
      }
test_case.class_method_signature: PaullEndpointTest.getDetailsPesAller()
test_case.full_signature: @Test public void getDetailsPesAller()
test_case.identifier: getDetailsPesAller
test_case.invocations: now format format format willReturn given getToken any willReturn given getBySiren any localAuthority willReturn given localAuthorityGranted any any willReturn given getByUuid any pesAller willReturn given getClasseur any any right classeur willReturn given getProfile any profileNode willReturn given getPesHistoryByTypes any any singletonList pesHistory andExpect sendRequest withPayload payload
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void getDetailsPesAller()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(PaullEndpoint.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(PaullEndpoint.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: NAMESPACE_URI = "http://www.processmaker.com"
focal_class.modifier: private static final
focal_class.original_string: private static final String NAMESPACE_URI = "http://www.processmaker.com";
focal_class.type: String
focal_class.var_name: NAMESPACE_URI
focal_class.declarator: dateFormatterWithMinutes = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm")
focal_class.modifier: private
focal_class.original_string: private DateTimeFormatter dateFormatterWithMinutes = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
focal_class.type: DateTimeFormatter
focal_class.var_name: dateFormatterWithMinutes
focal_class.declarator: dateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy")
focal_class.modifier: private
focal_class.original_string: private DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
focal_class.type: DateTimeFormatter
focal_class.var_name: dateFormatter
focal_class.declarator: SECRET
focal_class.modifier: @Value("${application.jwt.secret}")
focal_class.original_string: @Value("${application.jwt.secret}")
      String SECRET;
focal_class.type: String
focal_class.var_name: SECRET
focal_class.declarator: pesAllerService
focal_class.modifier: private final
focal_class.original_string: private final PesAllerService pesAllerService;
focal_class.type: PesAllerService
focal_class.var_name: pesAllerService
focal_class.declarator: pesRetourService
focal_class.modifier: private final
focal_class.original_string: private final PesRetourService pesRetourService;
focal_class.type: PesRetourService
focal_class.var_name: pesRetourService
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: 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.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.file: pes-service/src/main/java/fr/sictiam/stela/pesservice/soap/endpoints/PaullEndpoint.java
focal_class.identifier: PaullEndpoint
focal_class.class_method_signature: PaullEndpoint.PaullEndpoint(PesAllerService pesAllerService, LocalAuthorityService localAuthorityService,
              ExternalRestService externalRestService, PesRetourService pesRetourService, SesileService sesileService)
focal_class.full_signature: public  PaullEndpoint(PesAllerService pesAllerService, LocalAuthorityService localAuthorityService,
              ExternalRestService externalRestService, PesRetourService pesRetourService, SesileService sesileService)
focal_class.identifier: PaullEndpoint
focal_class.modifiers: public
focal_class.parameters: (PesAllerService pesAllerService, LocalAuthorityService localAuthorityService,
              ExternalRestService externalRestService, PesRetourService pesRetourService, SesileService sesileService)
focal_class.signature:  PaullEndpoint(PesAllerService pesAllerService, LocalAuthorityService localAuthorityService,
              ExternalRestService externalRestService, PesRetourService pesRetourService, SesileService sesileService)
focal_class.class_method_signature: PaullEndpoint.getToken(String sessionID)
focal_class.full_signature:  PaullSoapToken getToken(String sessionID)
focal_class.identifier: getToken
focal_class.parameters: (String sessionID)
focal_class.return: PaullSoapToken
focal_class.signature: PaullSoapToken getToken(String sessionID)
focal_class.class_method_signature: PaullEndpoint.depotPESAller(@RequestPayload DepotPESAllerRequest depotPesAller)
focal_class.full_signature: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "depotPESAllerRequest") public @ResponsePayload DepotPESAllerResponse depotPESAller(@RequestPayload DepotPESAllerRequest depotPesAller)
focal_class.identifier: depotPESAller
focal_class.modifiers: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "depotPESAllerRequest") public @ResponsePayload
focal_class.parameters: (@RequestPayload DepotPESAllerRequest depotPesAller)
focal_class.return: DepotPESAllerResponse
focal_class.signature: DepotPESAllerResponse depotPESAller(@RequestPayload DepotPESAllerRequest depotPesAller)
focal_class.class_method_signature: PaullEndpoint.getDetailsPESAller(
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)
focal_class.full_signature: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getDetailsPESAllerRequest") public @ResponsePayload GetDetailsPESAllerResponse getDetailsPESAller(
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)
focal_class.identifier: getDetailsPESAller
focal_class.modifiers: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getDetailsPESAllerRequest") public @ResponsePayload
focal_class.parameters: (
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)
focal_class.return: GetDetailsPESAllerResponse
focal_class.signature: GetDetailsPESAllerResponse getDetailsPESAller(
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)
focal_class.class_method_signature: PaullEndpoint.getDetailsPESAllerResponseError(String errorMessage)
focal_class.full_signature: private GetDetailsPESAllerResponse getDetailsPESAllerResponseError(String errorMessage)
focal_class.identifier: getDetailsPESAllerResponseError
focal_class.modifiers: private
focal_class.parameters: (String errorMessage)
focal_class.return: GetDetailsPESAllerResponse
focal_class.signature: GetDetailsPESAllerResponse getDetailsPESAllerResponseError(String errorMessage)
focal_class.class_method_signature: PaullEndpoint.getPESAller(@RequestPayload GetPESAllerRequest getPESAllerRequest)
focal_class.full_signature: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESAllerRequest") public @ResponsePayload GetPESAllerResponse getPESAller(@RequestPayload GetPESAllerRequest getPESAllerRequest)
focal_class.identifier: getPESAller
focal_class.modifiers: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESAllerRequest") public @ResponsePayload
focal_class.parameters: (@RequestPayload GetPESAllerRequest getPESAllerRequest)
focal_class.return: GetPESAllerResponse
focal_class.signature: GetPESAllerResponse getPESAller(@RequestPayload GetPESAllerRequest getPESAllerRequest)
focal_class.class_method_signature: PaullEndpoint.getPESRetour(@RequestPayload GetPESRetourRequest getPESRetourRequest)
focal_class.full_signature: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESRetourRequest") public @ResponsePayload GetPESRetourResponse getPESRetour(@RequestPayload GetPESRetourRequest getPESRetourRequest)
focal_class.identifier: getPESRetour
focal_class.modifiers: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESRetourRequest") public @ResponsePayload
focal_class.parameters: (@RequestPayload GetPESRetourRequest getPESRetourRequest)
focal_class.return: GetPESRetourResponse
focal_class.signature: GetPESRetourResponse getPESRetour(@RequestPayload GetPESRetourRequest getPESRetourRequest)
focal_method.body: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getDetailsPESAllerRequest")
      public @ResponsePayload
      GetDetailsPESAllerResponse getDetailsPESAller(
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest) throws IOException {
  
          PaullSoapToken paullSoapToken = getToken(getDetailsPESAllerRequest.getSessionId());
          if (paullSoapToken == null)
              return getDetailsPESAllerResponseError("SESSION_INVALID_OR_EXPIRED");
  
          GenericAccount genericAccount = externalRestService.getGenericAccount(paullSoapToken.getAccountUuid());
          if (!localAuthorityService.localAuthorityGranted(genericAccount, paullSoapToken.getSiren()))
              return getDetailsPESAllerResponseError("LOCALAUTHORITY_NOT_GRANTED");
  
          GetDetailsPESAllerResponse detailsPESAllerResponse = new GetDetailsPESAllerResponse();
          GetDetailsPESAllerStruct detailsPESAllerStruct = new GetDetailsPESAllerStruct();
  
          PesAller pesAller = pesAllerService.getByUuid(getDetailsPESAllerRequest.getIdPesAller());
          Optional<LocalAuthority> localAuthority = localAuthorityService.getBySiren(paullSoapToken.getSiren());
  
          // PES PJ are not sent to signature, don't bother checking something impossible
          if (!pesAller.isPj() && !pesAllerService.isAPesOrmc(pesAller) && pesAller.getSesileClasseurId() != null) {
              Either<HttpStatus, Classeur> sesileResponse = sesileService.getClasseur(localAuthority.get(),
                      pesAller);
              if (sesileResponse.isLeft()) {
                  return getDetailsPESAllerResponseError(sesileResponse.getLeft() + ": "
                          + sesileResponse.getLeft().getReasonPhrase());
              }
  
              Classeur classeur = sesileResponse.get();
              detailsPESAllerStruct.setNomClasseur(classeur.getNom());
              detailsPESAllerStruct.setEtatclasseur(classeur.getStatus().ordinal() + "");
              if (classeur.getCircuit() != null)
                  detailsPESAllerStruct.setCircuitClasseur(classeur.getCircuit());
              else
                  detailsPESAllerStruct.setCircuitClasseur("");
              classeur.getActions().forEach(action -> {
                  GetDetailsPESAllerStruct1 xmlAction = new GetDetailsPESAllerStruct1();
                  xmlAction.setDateAction(new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(action.getDate()));
                  xmlAction.setLibelleAction(action.getAction());
                  xmlAction.setNomActeur(action.getUsername());
                  detailsPESAllerStruct.getActionsClasseur().add(xmlAction);
              });
          } else {
              detailsPESAllerStruct.setNomClasseur("");
              detailsPESAllerStruct.setEtatclasseur("");
              detailsPESAllerStruct.setCircuitClasseur("");
          }
  
          JsonNode node = externalRestService.getProfile(pesAller.getProfileUuid());
  
          detailsPESAllerStruct.setPESPJ(pesAller.isPj() ? "1" : "0");
          detailsPESAllerStruct.setObjet(pesAller.getObjet());
          detailsPESAllerStruct.setUserName(JsonExtractorUtils.extractEmailFromProfile(node));
          detailsPESAllerStruct.setNomDocument(pesAller.getFileName());
          detailsPESAllerStruct.setDateDepot(dateFormatterWithMinutes.format(pesAller.getCreation()));
          detailsPESAllerStruct.setStatutBannette(pesAller.getLastHistoryStatus().name());
  
          List<PesHistory> fileHistories = pesAllerService.getPesHistoryByTypes(
                  getDetailsPESAllerRequest.getIdPesAller(),
                  Arrays.asList(StatusType.ACK_RECEIVED, StatusType.NACK_RECEIVED));
  
          Optional<PesHistory> peshistory = fileHistories.stream().findFirst();
  
          if (peshistory.isPresent()) {
              detailsPESAllerStruct.setDateAR(dateFormatter.format(peshistory.get().getDate()));
              detailsPESAllerStruct.setDateAnomalie("");
              detailsPESAllerStruct.setMotifAnomalie("");
          } else if (pesAllerService.hasAFatalError(pesAller)) {
              detailsPESAllerStruct.setDateAR("");
              detailsPESAllerStruct.setDateAnomalie(dateFormatterWithMinutes.format(pesAller.getLastHistoryDate()));
              detailsPESAllerStruct.setMotifAnomalie(pesAller.getLastHistoryStatus().name());
          } else {
              detailsPESAllerStruct.setDateAR("");
              detailsPESAllerStruct.setDateAnomalie("");
              detailsPESAllerStruct.setMotifAnomalie("");
          }
  
          // bunch of no longer used properties, set them all to an empty string
          detailsPESAllerStruct.setMotifPlusAnomalie("");
          detailsPESAllerStruct.setDateDepotBannette("");
          detailsPESAllerStruct.setStatutBannette("");
          detailsPESAllerStruct.setUserNameBannette("");
          detailsPESAllerStruct.setActeurCourant("");
  
          detailsPESAllerStruct.setMessage("SUCCESS");
          detailsPESAllerResponse.getRetour().add(detailsPESAllerStruct);
          detailsPESAllerResponse.setStatusCode("OK");
          return detailsPESAllerResponse;
  
      }
focal_method.class_method_signature: PaullEndpoint.getDetailsPESAller(
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)
focal_method.full_signature: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getDetailsPESAllerRequest") public @ResponsePayload GetDetailsPESAllerResponse getDetailsPESAller(
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)
focal_method.identifier: getDetailsPESAller
focal_method.invocations: getToken getSessionId getDetailsPESAllerResponseError getGenericAccount getAccountUuid localAuthorityGranted getSiren getDetailsPESAllerResponseError getByUuid getIdPesAller getBySiren getSiren isPj isAPesOrmc getSesileClasseurId getClasseur get isLeft getDetailsPESAllerResponseError getLeft getReasonPhrase getLeft get setNomClasseur getNom setEtatclasseur ordinal getStatus getCircuit setCircuitClasseur getCircuit setCircuitClasseur forEach getActions setDateAction format getDate setLibelleAction getAction setNomActeur getUsername add getActionsClasseur setNomClasseur setEtatclasseur setCircuitClasseur getProfile getProfileUuid setPESPJ isPj setObjet getObjet setUserName extractEmailFromProfile setNomDocument getFileName setDateDepot format getCreation setStatutBannette name getLastHistoryStatus getPesHistoryByTypes getIdPesAller asList findFirst stream isPresent setDateAR format getDate get setDateAnomalie setMotifAnomalie hasAFatalError setDateAR setDateAnomalie format getLastHistoryDate setMotifAnomalie name getLastHistoryStatus setDateAR setDateAnomalie setMotifAnomalie setMotifPlusAnomalie setDateDepotBannette setStatutBannette setUserNameBannette setActeurCourant setMessage add getRetour setStatusCode
focal_method.modifiers: @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getDetailsPESAllerRequest") public @ResponsePayload
focal_method.parameters: (
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)
focal_method.return: GetDetailsPESAllerResponse
focal_method.signature: GetDetailsPESAllerResponse getDetailsPESAller(
              @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest)