NdsBeisEsb/src/main/java/com/northgateps/nds/beis/esb/converter/ToMaintainPartyDetailsRequestConverter.java
/**
     * @param registrationRequest - This is the Nds request that needs transforming for BEIS foundation layer
     *            to understand.
     * @return - the provided details converted to a MaintainPartyDetailsRequest object ready to send to the external
     *         service.
     */
@param registrationRequest - This is the Nds request that needs transforming for BEIS foundation layer
to understand.
@return - the provided details converted to a MaintainPartyDetailsRequest object ready to send to the external
service.
@param registrationRequest - This is the Nds request that needs transforming for BEIS foundation layer to understand . @return - the provided details converted to a MaintainPartyDetailsRequest object ready to send to the external service .
@Converter
    public static MaintainPartyDetailsRequest converting(BeisRegistrationNdsRequest registrationRequest) {
        logger.info("Starting Conversion For Registration Request");
        BeisUserDetails ndsUserDetails = null;
        BeisAccountDetails ndsAccountDetails = null;
        BeisAddressDetail ndsContactAddressDetail = null;
        String userType = null;
        String email = null;
        String userName = null;
        BeisRegistrationDetails ndsRegistrationDetails = registrationRequest.getRegistrationDetails();
        ndsUserDetails = ndsRegistrationDetails.getUserDetails();    
        if (ndsUserDetails != null) {
           if(ndsUserDetails.getUserType()==UserType.LANDLORD){
                userType="Landlord";
            }
            else{
                userType="Agent";
            }
            email = ndsUserDetails.getEmail();
            userName = ndsUserDetails.getUsername();
        }
        ndsAccountDetails = ndsRegistrationDetails.getAccountDetails();
        ndsContactAddressDetail = ndsRegistrationDetails.getContactAddress();
        MaintainPartyDetailsRequest backOfficeMaintainPartyDetailsRequest = convertUserAccountAndAddressToAMaintainPartyDetailsRequest(
                ndsAccountDetails, ndsContactAddressDetail, userName, userType, email);
        logger.info("Finished Conversion For Registration Request");
        return backOfficeMaintainPartyDetailsRequest;
    }
@ Converter public static MaintainPartyDetailsRequest converting ( BeisRegistrationNdsRequest registrationRequest ) { logger . info ( "Starting Conversion For Registration Request" ) ; BeisUserDetails ndsUserDetails = null ; BeisAccountDetails ndsAccountDetails = null ; BeisAddressDetail ndsContactAddressDetail = null ; String userType = null ; String email = null ; String userName = null ; BeisRegistrationDetails ndsRegistrationDetails = registrationRequest . getRegistrationDetails ( ) ; ndsUserDetails = ndsRegistrationDetails . getUserDetails ( ) ; if ( ndsUserDetails != null ) { if ( ndsUserDetails . getUserType ( ) == UserType . LANDLORD ) { userType = "Landlord" ; } else { userType = "Agent" ; } email = ndsUserDetails . getEmail ( ) ; userName = ndsUserDetails . getUsername ( ) ; } ndsAccountDetails = ndsRegistrationDetails . getAccountDetails ( ) ; ndsContactAddressDetail = ndsRegistrationDetails . getContactAddress ( ) ; MaintainPartyDetailsRequest backOfficeMaintainPartyDetailsRequest = convertUserAccountAndAddressToAMaintainPartyDetailsRequest ( ndsAccountDetails , ndsContactAddressDetail , userName , userType , email ) ; logger . info ( "Finished Conversion For Registration Request" ) ; return backOfficeMaintainPartyDetailsRequest ; }
@param registrationRequest - This is the Nds request that needs transforming for BEIS foundation layer
            to understand.
@param registrationRequest - This is the Nds request that needs transforming for BEIS foundation layer to understand .
// Get local references to the objects in the request that we need to use. //back-office require user type in camel case