@Test public void getDetailsPesAller() throws IOException, ParseException { LocalDateTime now = LocalDateTime.now(); String detailsPesAllerRequest = "<getDetailsPESAllerRequest xmlns='http: "<sessionId>sessionid</sessionId>" + "<IdPesAller>aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee</IdPesAller>" + "</getDetailsPESAllerRequest>"; String detailsPesAllerResponse = "<ns2:getDetailsPESAllerResponse xmlns:ns2=\"http: "<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))); }
@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()); 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(""); } detailsPESAllerStruct.setMotifPlusAnomalie(""); detailsPESAllerStruct.setDateDepotBannette(""); detailsPESAllerStruct.setStatutBannette(""); detailsPESAllerStruct.setUserNameBannette(""); detailsPESAllerStruct.setActeurCourant(""); detailsPESAllerStruct.setMessage("SUCCESS"); detailsPESAllerResponse.getRetour().add(detailsPESAllerStruct); detailsPESAllerResponse.setStatusCode("OK"); return detailsPESAllerResponse; }
PaullEndpoint { @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()); 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(""); } detailsPESAllerStruct.setMotifPlusAnomalie(""); detailsPESAllerStruct.setDateDepotBannette(""); detailsPESAllerStruct.setStatutBannette(""); detailsPESAllerStruct.setUserNameBannette(""); detailsPESAllerStruct.setActeurCourant(""); detailsPESAllerStruct.setMessage("SUCCESS"); detailsPESAllerResponse.getRetour().add(detailsPESAllerStruct); detailsPESAllerResponse.setStatusCode("OK"); return detailsPESAllerResponse; } }
PaullEndpoint { @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()); 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(""); } detailsPESAllerStruct.setMotifPlusAnomalie(""); detailsPESAllerStruct.setDateDepotBannette(""); detailsPESAllerStruct.setStatutBannette(""); detailsPESAllerStruct.setUserNameBannette(""); detailsPESAllerStruct.setActeurCourant(""); detailsPESAllerStruct.setMessage("SUCCESS"); detailsPESAllerResponse.getRetour().add(detailsPESAllerStruct); detailsPESAllerResponse.setStatusCode("OK"); return detailsPESAllerResponse; } PaullEndpoint(PesAllerService pesAllerService, LocalAuthorityService localAuthorityService,
            ExternalRestService externalRestService, PesRetourService pesRetourService, SesileService sesileService); }
PaullEndpoint { @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()); 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(""); } detailsPESAllerStruct.setMotifPlusAnomalie(""); detailsPESAllerStruct.setDateDepotBannette(""); detailsPESAllerStruct.setStatutBannette(""); detailsPESAllerStruct.setUserNameBannette(""); detailsPESAllerStruct.setActeurCourant(""); detailsPESAllerStruct.setMessage("SUCCESS"); detailsPESAllerResponse.getRetour().add(detailsPESAllerStruct); detailsPESAllerResponse.setStatusCode("OK"); return detailsPESAllerResponse; } PaullEndpoint(PesAllerService pesAllerService, LocalAuthorityService localAuthorityService,
            ExternalRestService externalRestService, PesRetourService pesRetourService, SesileService sesileService); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "depotPESAllerRequest") @ResponsePayload DepotPESAllerResponse depotPESAller(@RequestPayload DepotPESAllerRequest depotPesAller); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getDetailsPESAllerRequest") @ResponsePayload GetDetailsPESAllerResponse getDetailsPESAller(
            @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESAllerRequest") @ResponsePayload GetPESAllerResponse getPESAller(@RequestPayload GetPESAllerRequest getPESAllerRequest); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESRetourRequest") @ResponsePayload GetPESRetourResponse getPESRetour(@RequestPayload GetPESRetourRequest getPESRetourRequest); }
PaullEndpoint { @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()); 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(""); } detailsPESAllerStruct.setMotifPlusAnomalie(""); detailsPESAllerStruct.setDateDepotBannette(""); detailsPESAllerStruct.setStatutBannette(""); detailsPESAllerStruct.setUserNameBannette(""); detailsPESAllerStruct.setActeurCourant(""); detailsPESAllerStruct.setMessage("SUCCESS"); detailsPESAllerResponse.getRetour().add(detailsPESAllerStruct); detailsPESAllerResponse.setStatusCode("OK"); return detailsPESAllerResponse; } PaullEndpoint(PesAllerService pesAllerService, LocalAuthorityService localAuthorityService,
            ExternalRestService externalRestService, PesRetourService pesRetourService, SesileService sesileService); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "depotPESAllerRequest") @ResponsePayload DepotPESAllerResponse depotPESAller(@RequestPayload DepotPESAllerRequest depotPesAller); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getDetailsPESAllerRequest") @ResponsePayload GetDetailsPESAllerResponse getDetailsPESAller(
            @RequestPayload GetDetailsPESAllerRequest getDetailsPESAllerRequest); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESAllerRequest") @ResponsePayload GetPESAllerResponse getPESAller(@RequestPayload GetPESAllerRequest getPESAllerRequest); @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getPESRetourRequest") @ResponsePayload GetPESRetourResponse getPESRetour(@RequestPayload GetPESRetourRequest getPESRetourRequest);  }