src/com/vehiclerental/presentationLayer/headOffice/UserHeadOfficeController.java
/**
     * Get the user bookings for the authenticated user in the specified branch
     *
     * @param request the request parameters
     * @return the result response
     */
Get the user bookings for the authenticated user in the specified branch
@param request the request parameters
@return the result response
Get the user bookings for the authenticated user in the specified branch @param request the request parameters @return the result response
public static HeadOfficeResponseMessage HandleGetUserBookings(HeadOfficeRequestMessage request) {
        Branch destBranch = getRequestBranch(request);
        if (destBranch == null) {
            return generateError(request.OperationCode, 404, "Branch not found");
        }
        try {
            User user = doAuthentication(request.getAuthEmail(), request.getAuthPassword(), false);
            ClusterCommunicationObject<String> rawClusterResponse = ForwardRequestToBranch(destBranch, request.OperationCode, null, null, user);
            Type jsonType = new TypeToken<BranchResponseMessage<List<BookingContract>>>() {}.getType();
            BranchResponseMessage<List<BookingContract>> clusterResponse = SerializationUtils.deserialize(rawClusterResponse.object, jsonType);
            if (clusterResponse.Status != 200) {
                return generateError(request.OperationCode, clusterResponse.Status, clusterResponse.Error);
            }
            return generateSuccessfulResponse(request.OperationCode, clusterResponse.Object);
        } catch (ClusterCommunicatorException e) {
            return generateError(request.OperationCode, 500, "Server error");
        } catch (NotAuthorizedException e) {
            return generateError(request.OperationCode, 401, "Unauthorized");
        }
    }
public static HeadOfficeResponseMessage HandleGetUserBookings ( HeadOfficeRequestMessage request ) { Branch destBranch = getRequestBranch ( request ) ; if ( destBranch == null ) { return generateError ( request . OperationCode , 404 , "Branch not found" ) ; } try { User user = doAuthentication ( request . getAuthEmail ( ) , request . getAuthPassword ( ) , false ) ; ClusterCommunicationObject < String > rawClusterResponse = ForwardRequestToBranch ( destBranch , request . OperationCode , null , null , user ) ; Type jsonType = new TypeToken < BranchResponseMessage < List < BookingContract > > > ( ) { } . getType ( ) ; BranchResponseMessage < List < BookingContract > > clusterResponse = SerializationUtils . deserialize ( rawClusterResponse . object , jsonType ) ; if ( clusterResponse . Status != 200 ) { return generateError ( request . OperationCode , clusterResponse . Status , clusterResponse . Error ) ; } return generateSuccessfulResponse ( request . OperationCode , clusterResponse . Object ) ; } catch ( ClusterCommunicatorException e ) { return generateError ( request . OperationCode , 500 , "Server error" ) ; } catch ( NotAuthorizedException e ) { return generateError ( request . OperationCode , 401 , "Unauthorized" ) ; } }
Get the user bookings for the authenticated user in the specified branch
 @param request the request parameters
 @return the result response
Get the user bookings for the authenticated user in the specified branch @param request the request parameters @return the result response
//Parse cluster response //Form socket response