src/com/vehiclerental/logicLayer/implementations/VehicleServiceImpl.java
/**
     * Returns all the vehicles matching a search criteria in the given branch
     * This is not an available search, only a general vehicle search
     *
     * @param searchCriteria the search criteria
     * @param nodeBranch the given branch
     * @return the list of vehicles matching the criteria in the branch
     * @throws InvalidPropertyException if one of the search criteria properties is invalid
     */
Returns all the vehicles matching a search criteria in the given branch
This is not an available search, only a general vehicle search

@param searchCriteria the search criteria
@param nodeBranch the given branch
@return the list of vehicles matching the criteria in the branch
@throws InvalidPropertyException if one of the search criteria properties is invalid
Returns all the vehicles matching a search criteria in the given branch This is not an available search only a general vehicle search @param searchCriteria the search criteria @param nodeBranch the given branch @return the list of vehicles matching the criteria in the branch @throws InvalidPropertyException if one of the search criteria properties is invalid
@Override
    public List<VehicleContract> searchVehicles(SearchVehicleContract searchCriteria, Branch nodeBranch) throws InvalidPropertyException {
        List<Vehicle> vehicles;
         if (searchCriteria == null) {
            throw new InvalidPropertyException("Invalid criteria");
        }
        if (!searchCriteria.registrationNumber.isEmpty()) {
            vehicles = new ArrayList<>();
            Vehicle vehicle = vehicleDao.getVehicleByRegistrationNumberAndBranch(searchCriteria.registrationNumber, nodeBranch);
            if (vehicle != null) {
                vehicles.add(vehicle);
            }
        } else {
            vehicles = vehicleDao.searchBranchVehiclesByType(searchCriteria.vehicleTypeId, nodeBranch);
        }
        if (vehicles == null) {
            return null;
        }
        List<VehicleContract> contracts = new ArrayList<VehicleContract>();
        for (Vehicle vehicle : vehicles) {
            contracts.add(new VehicleContract(vehicle));
        }
        return contracts;
    }
@ Override public List < VehicleContract > searchVehicles ( SearchVehicleContract searchCriteria , Branch nodeBranch ) throws InvalidPropertyException { List < Vehicle > vehicles ; if ( searchCriteria == null ) { throw new InvalidPropertyException ( "Invalid criteria" ) ; } if ( ! searchCriteria . registrationNumber . isEmpty ( ) ) { vehicles = new ArrayList < > ( ) ; Vehicle vehicle = vehicleDao . getVehicleByRegistrationNumberAndBranch ( searchCriteria . registrationNumber , nodeBranch ) ; if ( vehicle != null ) { vehicles . add ( vehicle ) ; } } else { vehicles = vehicleDao . searchBranchVehiclesByType ( searchCriteria . vehicleTypeId , nodeBranch ) ; } if ( vehicles == null ) { return null ; } List < VehicleContract > contracts = new ArrayList < VehicleContract > ( ) ; for ( Vehicle vehicle : vehicles ) { contracts . add ( new VehicleContract ( vehicle ) ) ; } return contracts ; }
Returns all the vehicles matching a search criteria in the given branch
 This is not an available search, only a general vehicle search
Returns all the vehicles matching a search criteria in the given branch This is not an available search only a general vehicle search
//Search using registration number //Search using type