Skip Navigation

com.sabre.redapp.example3.desktop.pnr Sample

This sample demonstrates access to PNR, refreshing Trip Summary, refreshing profile preferences and displaying graphical PNR.

When you have a PNR present in your workspace you can clik on "Get PNR" button to get contents of current PNR. The result will be displayed in the text area on the bottom.

pnrButton.addSelectionListener(new SelectionAdapter()
        {

            @Override
            public void widgetSelected(SelectionEvent e)
            {
                if (apiVersion > ApiVersion.SRW20)
                {
                    ClientResponse <GetPnrResponse <RedAppTravelItineraryReadRs>> rsp = getPnr();
                    RedAppTravelItineraryReadRs rs =
                        (RedAppTravelItineraryReadRs) rsp.getPayload().getTirResponse();
                    String str = marshal(rs);
                    textArea.setText(str);
                }
                else
                {
                    textArea.setText("this is Get PNR 2.0 fallback logic");
                }
            }
        });

When you need to refresh Trip Summary click on "Refresh Trip Summary" button. You will see the refresh request status in the text area on the bottom.

tripSummaryButton.addSelectionListener(new SelectionAdapter()
        {

            @Override
            public void widgetSelected(SelectionEvent e)
            {
                if (apiVersion > ApiVersion.SRW20)
                {
                    textArea.setText("Refreshing Trip Summary...\n");
                    ClientResponse <TripSummaryResponse> rsp = refreshTripSummary();
                    textArea.append(rsp.isSuccess() ? "SUCCESS" : "FAILURE");
                }
                else
                {
                    textArea.setText("this is Refresh Trip Summary 2.0 fallback logic");
                }
            }
        });

When you have profile with preferences loaded and need to refresh them click on "Refresh Profile Prefs". You will see the refresh request status in the text area on the bottom.

        preferencesButton.addSelectionListener(new SelectionAdapter()
        {

            @Override
            public void widgetSelected(SelectionEvent e)
            {
                if (apiVersion > ApiVersion.SRW20)
                {
                    textArea.setText("Refreshing profile preferences...\n");
                    ClientResponse <ProfilePrefsRefreshRs> rsp = refreshPreferences();
                    textArea.append(rsp.isSuccess() ? "SUCCESS" : "FAILURE");
                }
                else
                {
                    textArea.setText("this is Refresh profile preferences fallback logic");
                }
            }
        });

When you have a PNR present in your workspace, clicking on "Graphical PNR" causes graphical PNR to render. PNR section type can be changed in the combo box below. You will see the refresh request status in the text area on the bottom.

        gpnrButton.addSelectionListener(new SelectionAdapter()
        {

            @Override
            public void widgetSelected(SelectionEvent e)
            {
                if (apiVersion > ApiVersion.SRW20)
                {
                    textArea.setText("Sending graphical PNR request...\n");
                    ClientResponse <DisplayGraphicalPnrResponse> rsp = displayGraphicalPnr();
                    textArea.append(rsp.isSuccess() ? "SUCCESS" : "FAILURE");
                }
                else
                {
                    textArea.setText("Graphical PNR request fallback logic...");
                }
            }
        });
Note
Refreshing Trip Summary and Profile Preferences works only in Sabre Red 360, in SRW 2.0 it has no effect.