src/com/vehiclerental/presentationLayer/branch/StaffBranchController.java
/**
     * Creates or update a vehicle based on the given properties
     *
     * @param request the request parameters
     * @return the result response
     */
Creates or update a vehicle based on the given properties
@param request the request parameters
@return the result response
Creates or update a vehicle based on the given properties @param request the request parameters @return the result response
public static BranchResponseMessage handleUpdateOrCreateVehicle(BranchRequestMessage<CreateUpdateVehicleContract> request) {
        try {
            VehicleService vehicleService = ServiceFactory.getVehicleService();
            VehicleContract vehicleContract = vehicleService.createOrUpdateVehicle(request.object, NodeConfiguration.Current.nodeBranch);
            return generateSuccessfulResponse(request.operationCode, vehicleContract);
        } catch (InvalidPropertyException e) {
            return generateError(request.operationCode, 400, e.getMessage());
        } catch (RegistrationNumberAlreadyInUseException e) {
            return generateError(request.operationCode, 400, "Registration number already in use");
        } catch (Exception e) {
            System.out.println(e.getMessage());
            e.printStackTrace();
            return generateError(request.operationCode, 500, "Branch error");
        }
    }
public static BranchResponseMessage handleUpdateOrCreateVehicle ( BranchRequestMessage < CreateUpdateVehicleContract > request ) { try { VehicleService vehicleService = ServiceFactory . getVehicleService ( ) ; VehicleContract vehicleContract = vehicleService . createOrUpdateVehicle ( request . object , NodeConfiguration . Current . nodeBranch ) ; return generateSuccessfulResponse ( request . operationCode , vehicleContract ) ; } catch ( InvalidPropertyException e ) { return generateError ( request . operationCode , 400 , e . getMessage ( ) ) ; } catch ( RegistrationNumberAlreadyInUseException e ) { return generateError ( request . operationCode , 400 , "Registration number already in use" ) ; } catch ( Exception e ) { System . out . println ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; return generateError ( request . operationCode , 500 , "Branch error" ) ; } }
Creates or update a vehicle based on the given properties
 @param request the request parameters
 @return the result response
Creates or update a vehicle based on the given properties @param request the request parameters @return the result response