porting/src/main/java/com/stackroute/pie/controller/PortingRequestController.java
//Method to display incoming porting requests
Method to display incoming porting requests
Method to display incoming porting requests
@GetMapping("/incomingportingrequest/{newInsurerName}")
    public ResponseEntity<?> incomingPortingRequest( @PathVariable("newInsurerName") String newInsurerName) {
        if (portingRequestRepository.existsByNewInsurerName(newInsurerName) == false) {
            return new ResponseEntity<>("Insurer Not Found",
                    HttpStatus.NOT_FOUND);
        }
        List<PortingRequest> incomingPortingRequests = requestService.getIncomingPortingRequest(newInsurerName);
        List<PortingRequest> incomingPortingRequests1 = new ArrayList<>();
        System.out.println("In the incomingportingrequest");
        for(int i = 0;i < incomingPortingRequests.size(); i++) {
            if(incomingPortingRequests.get(i).getFromApproval() == 1 && incomingPortingRequests.get(i).getToApproval() == 0) {
                incomingPortingRequests1.add(incomingPortingRequests.get(i));
            }
        }
        return new ResponseEntity<List<PortingRequest>>(incomingPortingRequests1, HttpStatus.OK);
    }
@ GetMapping ( "/incomingportingrequest/{newInsurerName}" ) public ResponseEntity < ? > incomingPortingRequest ( @ PathVariable ( "newInsurerName" ) String newInsurerName ) { if ( portingRequestRepository . existsByNewInsurerName ( newInsurerName ) == false ) { return new ResponseEntity < > ( "Insurer Not Found" , HttpStatus . NOT_FOUND ) ; } List < PortingRequest > incomingPortingRequests = requestService . getIncomingPortingRequest ( newInsurerName ) ; List < PortingRequest > incomingPortingRequests1 = new ArrayList < > ( ) ; System . out . println ( "In the incomingportingrequest" ) ; for ( int i = 0 ; i < incomingPortingRequests . size ( ) ; i ++ ) { if ( incomingPortingRequests . get ( i ) . getFromApproval ( ) == 1 && incomingPortingRequests . get ( i ) . getToApproval ( ) == 0 ) { incomingPortingRequests1 . add ( incomingPortingRequests . get ( i ) ) ; } } return new ResponseEntity < List < PortingRequest > > ( incomingPortingRequests1 , HttpStatus . OK ) ; }
Method to display incoming porting requests
Method to display incoming porting requests