porting/src/main/java/com/stackroute/pie/controller/PortingRequestController.java
//Method to display outgoing porting requests
Method to display outgoing porting requests
Method to display outgoing porting requests
@GetMapping("/outgoingportingrequest/{insurerName}")
    public ResponseEntity<?> outgoingPortingRequest(@PathVariable("insurerName") String insurerName) {
        if (portingRequestRepository.existsByInsurerName(insurerName) == false) {
            return new ResponseEntity<>("Insurer Not Found",
                    HttpStatus.NOT_FOUND);
        }
        List<PortingRequest> outgoingPortingRequests = requestService.getOutgoingPortingRequest(insurerName);
        List<PortingRequest> outgoingPortingRequests1 = new ArrayList<>();
        for(int i =0 ;i < outgoingPortingRequests.size(); i++) {
            if(outgoingPortingRequests.get(i).getFromApproval() != 1) {
                outgoingPortingRequests1.add(outgoingPortingRequests.get(i));
            }
        }
        return new ResponseEntity<List<PortingRequest>>(outgoingPortingRequests1, HttpStatus.OK);
    }
@ GetMapping ( "/outgoingportingrequest/{insurerName}" ) public ResponseEntity < ? > outgoingPortingRequest ( @ PathVariable ( "insurerName" ) String insurerName ) { if ( portingRequestRepository . existsByInsurerName ( insurerName ) == false ) { return new ResponseEntity < > ( "Insurer Not Found" , HttpStatus . NOT_FOUND ) ; } List < PortingRequest > outgoingPortingRequests = requestService . getOutgoingPortingRequest ( insurerName ) ; List < PortingRequest > outgoingPortingRequests1 = new ArrayList < > ( ) ; for ( int i = 0 ; i < outgoingPortingRequests . size ( ) ; i ++ ) { if ( outgoingPortingRequests . get ( i ) . getFromApproval ( ) != 1 ) { outgoingPortingRequests1 . add ( outgoingPortingRequests . get ( i ) ) ; } } return new ResponseEntity < List < PortingRequest > > ( outgoingPortingRequests1 , HttpStatus . OK ) ; }
Method to display outgoing porting requests
Method to display outgoing porting requests