NdsBeisUi/src/main/java/com/northgateps/nds/beis/ui/controller/handler/DashboardEventHandler.java
/**
     * If the user logged in is fully registered then get the details.
     */
If the user logged in is fully registered then get the details.
If the user logged in is fully registered then get the details .
@Override
    public void onAfterResolvedView(NdsFormModel allModel, ControllerState<?> controllerState) {
        String userName;
        final BeisAllModel model = (BeisAllModel) allModel;
        final UiData uiData = (UiData)model.getUiData();
        if (uiData.getRegistrationStatus() != null 
                && uiData.getRegistrationStatus() == RegistrationStatusType.USE_REGISTERED){
            final String serviceEndPoint = ConfigurationFactory.getConfiguration().getString(
                    "esbEndpoint.viewDashboard");
            final UiServiceClient uiSvcClient = controllerState.getController().getUiSvcClientFactory().getInstance(
                    GetPRSAccountExemptionsNdsResponse.class);
            logger.trace("ESB endpoint from configuration is: " + serviceEndPoint);
            GetPRSAccountExemptionsNdsRequest request = new GetPRSAccountExemptionsNdsRequest();
            final PlatformUser user = PlatformUser.getLoggedInUser();
            userName = user.getUsername();
            request.setUsername(userName);
            request.setTenant(user.getTenant());
            if (!controllerState.isSyncController()) {
                uiSvcClient.post(serviceEndPoint, request);
            } else {
                uiSvcClient.postSync(serviceEndPoint, request);
            }
            uiSvcClient.setResponseConsumer(new NdsResponseConsumer() {
                @Override
                public boolean consume(NdsResponse response) {
                    GetPRSAccountExemptionsNdsResponse dashboardResponse = (GetPRSAccountExemptionsNdsResponse) uiSvcClient.getResponse();
                    if (dashboardResponse != null && dashboardResponse.isSuccess()) {
                        model.setDashboardDetails(dashboardResponse.getDashboardDetails());
                        return true;
                    }
                    return false;
                }
            });
            controllerState.registerUiServiceClient(uiSvcClient);
        }else if(uiData.getRegistrationStatus() != null ){
            uiData.setRegistrationStatus(RegistrationStatusType.USE_REGISTERED);
        }
    }
@ Override public void onAfterResolvedView ( NdsFormModel allModel , ControllerState < ? > controllerState ) { String userName ; final BeisAllModel model = ( BeisAllModel ) allModel ; final UiData uiData = ( UiData ) model . getUiData ( ) ; if ( uiData . getRegistrationStatus ( ) != null && uiData . getRegistrationStatus ( ) == RegistrationStatusType . USE_REGISTERED ) { final String serviceEndPoint = ConfigurationFactory . getConfiguration ( ) . getString ( "esbEndpoint.viewDashboard" ) ; final UiServiceClient uiSvcClient = controllerState . getController ( ) . getUiSvcClientFactory ( ) . getInstance ( GetPRSAccountExemptionsNdsResponse . class ) ; logger . trace ( "ESB endpoint from configuration is: " + serviceEndPoint ) ; GetPRSAccountExemptionsNdsRequest request = new GetPRSAccountExemptionsNdsRequest ( ) ; final PlatformUser user = PlatformUser . getLoggedInUser ( ) ; userName = user . getUsername ( ) ; request . setUsername ( userName ) ; request . setTenant ( user . getTenant ( ) ) ; if ( ! controllerState . isSyncController ( ) ) { uiSvcClient . post ( serviceEndPoint , request ) ; } else { uiSvcClient . postSync ( serviceEndPoint , request ) ; } uiSvcClient . setResponseConsumer ( new NdsResponseConsumer ( ) { @ Override public boolean consume ( NdsResponse response ) { GetPRSAccountExemptionsNdsResponse dashboardResponse = ( GetPRSAccountExemptionsNdsResponse ) uiSvcClient . getResponse ( ) ; if ( dashboardResponse != null && dashboardResponse . isSuccess ( ) ) { model . setDashboardDetails ( dashboardResponse . getDashboardDetails ( ) ) ; return true ; } return false ; } } ) ; controllerState . registerUiServiceClient ( uiSvcClient ) ; } else if ( uiData . getRegistrationStatus ( ) != null ) { uiData . setRegistrationStatus ( RegistrationStatusType . USE_REGISTERED ) ; } }
If the user logged in is fully registered then get the details.
If the user logged in is fully registered then get the details .
// get logged in user's details // set the details in the model