if (!StringUtils.isEmpty(carPlateNumber) && parkingParty.hasCarContainingPlateNumber(carPlateNumber.trim())) { if (StringUtils.isEmpty(nameSearch)) { result.add(parkingParty.getParty()); } else { String[] nameValues = StringNormalizer.normalize(nameSearch).toLowerCase() .split("\\p{Space}+"); if (areNamesPresent(parkingParty.getParty().getName(), nameValues)) {
if (!StringUtils.isEmpty(carPlateNumber)) { if (parkingParty.hasCarContainingPlateNumber(carPlateNumber.trim())) { if (StringUtils.isEmpty(nameSearch)) {
    public List<Party> run(String nameSearch, String carPlateNumber) {        List<Party> result = new ArrayList<Party>();        if (!StringUtils.isEmpty(carPlateNumber) || !StringUtils.isEmpty(nameSearch)) {            List<ParkingParty> parkingParties = rootDomainObject.getParkingParties();            for (ParkingParty parkingParty : parkingParties) {                if (!StringUtils.isEmpty(carPlateNumber)                        && parkingParty.hasCarContainingPlateNumber(carPlateNumber.trim())) {                    if (StringUtils.isEmpty(nameSearch)) {                        result.add(parkingParty.getParty());                    } else {                        String[] nameValues = StringNormalizer.normalize(nameSearch).toLowerCase()                                .split("\\p{Space}+");                        if (areNamesPresent(parkingParty.getParty().getName(), nameValues)) {                            result.add(parkingParty.getParty());                        }                    }                } else { //filled in the name and not the plate number                    String[] nameValues = StringNormalizer.normalize(nameSearch).toLowerCase().split(                            "\\p{Space}+");                    if (areNamesPresent(parkingParty.getParty().getName(), nameValues)) {                        result.add(parkingParty.getParty());                    }                }            }        }        return result;    }