@Test void profileSearchTwoMatch() { client = new Client(FIRST_NAME, null, FIRST_NAME, LocalDate.of(1970, 1, 1), 1); assertTrue(client.profileSearch(FIRST_NAME)); }
public boolean profileSearch(String searchParam) { String lowerSearch = searchParam.toLowerCase(); String[] splitSearchItems = WHITE_SPACE.split(lowerSearch); Collection<String> searched = new ArrayList<>(Arrays.asList(splitSearchItems)); Collection<String> names = this.splitNames(); Collection<String> lowercaseNames = new ArrayList<>(); for (String name : names) { lowercaseNames.add(name.toLowerCase()); } Collection<String> matchedNames = new ArrayList<>(); for (String searchedParam : searched) { for (String name : lowercaseNames) { if (name.startsWith(searchedParam)) { matchedNames.add(name); break; } } } return matchedNames.size() == searched.size(); }
Client implements ConcurrencyControlledEntity { public boolean profileSearch(String searchParam) { String lowerSearch = searchParam.toLowerCase(); String[] splitSearchItems = WHITE_SPACE.split(lowerSearch); Collection<String> searched = new ArrayList<>(Arrays.asList(splitSearchItems)); Collection<String> names = this.splitNames(); Collection<String> lowercaseNames = new ArrayList<>(); for (String name : names) { lowercaseNames.add(name.toLowerCase()); } Collection<String> matchedNames = new ArrayList<>(); for (String searchedParam : searched) { for (String name : lowercaseNames) { if (name.startsWith(searchedParam)) { matchedNames.add(name); break; } } } return matchedNames.size() == searched.size(); } }
Client implements ConcurrencyControlledEntity { public boolean profileSearch(String searchParam) { String lowerSearch = searchParam.toLowerCase(); String[] splitSearchItems = WHITE_SPACE.split(lowerSearch); Collection<String> searched = new ArrayList<>(Arrays.asList(splitSearchItems)); Collection<String> names = this.splitNames(); Collection<String> lowercaseNames = new ArrayList<>(); for (String name : names) { lowercaseNames.add(name.toLowerCase()); } Collection<String> matchedNames = new ArrayList<>(); for (String searchedParam : searched) { for (String name : lowercaseNames) { if (name.startsWith(searchedParam)) { matchedNames.add(name); break; } } } return matchedNames.size() == searched.size(); } Client();  Client(int uid);  Client(String firstName, String middleName, String lastName, LocalDate dateOfBirth, Integer uid); }
Client implements ConcurrencyControlledEntity { public boolean profileSearch(String searchParam) { String lowerSearch = searchParam.toLowerCase(); String[] splitSearchItems = WHITE_SPACE.split(lowerSearch); Collection<String> searched = new ArrayList<>(Arrays.asList(splitSearchItems)); Collection<String> names = this.splitNames(); Collection<String> lowercaseNames = new ArrayList<>(); for (String name : names) { lowercaseNames.add(name.toLowerCase()); } Collection<String> matchedNames = new ArrayList<>(); for (String searchedParam : searched) { for (String name : lowercaseNames) { if (name.startsWith(searchedParam)) { matchedNames.add(name); break; } } } return matchedNames.size() == searched.size(); } Client();  Client(int uid);  Client(String firstName, String middleName, String lastName, LocalDate dateOfBirth, Integer uid); void setOrganDonationStatus(Organ organ, boolean value); void setMedicationHistory(List<MedicationRecord> medicationHistory); void setIllnessHistory(List<IllnessRecord> illnessHistory); Set<Organ> getCurrentlyDonatedOrgans(); String getOrganStatusString(String type); String getClientOrganStatusString(String type); String getUpdatesString(); String getClientInfoString(); String getFullName(); String getFirstName(); void setFirstName(String firstName); String getLastName(); void setLastName(String lastName); String getMiddleName(); void setMiddleName(String middleName); String getPreferredNameFormatted(); String getPreferredName(); void setPreferredName(String preferredName); LocalDate getDateOfBirth(); void setDateOfBirth(LocalDate dateOfBirth); LocalDate getDateOfDeath(); void setDateOfDeath(LocalDate newDateOfDeath); LocalTime getTimeOfDeath(); void setTimeOfDeath(LocalTime newTimeOfDeath); @JsonIgnore LocalDateTime getDatetimeOfDeath(); String getRegionOfDeath(); void setRegionOfDeath(String regionOfDeath); String getCityOfDeath(); void setCityOfDeath(String cityOfDeath); Country getCountryOfDeath(); void setCountryOfDeath(Country countryOfDeath); @JsonIgnore boolean isAlive(); @JsonIgnore boolean isDead(); Gender getGender(); void setGender(Gender gender); Gender getGenderIdentity(); void setGenderIdentity(Gender genderIdentity); double getHeight(); void setHeight(double height); double getWeight(); void setWeight(double weight); BloodType getBloodType(); void setBloodType(BloodType bloodType); String getCurrentAddress(); void setCurrentAddress(String currentAddress); String getRegion(); void setRegion(String region); Integer getUid(); void setUid(Integer uid); Instant getCreatedTimestamp(); Instant getModifiedTimestamp(); Map<Organ, Boolean> getOrganDonationStatus(); void setOrganDonationStatus(Map<Organ, Boolean> map); Set<Organ> getCurrentlyRequestedOrgans(); List<IllnessRecord> getPastIllnesses(); Map<Organ, Boolean> getOrganRequestStatus(); List<MedicationRecord> getCurrentMedications(); List<MedicationRecord> getPastMedications(); List<HistoryItem> getChangesHistory(); List<MedicationRecord> getMedications(); void addMedicationRecord(MedicationRecord record); void deleteMedicationRecord(MedicationRecord record); MedicationRecord getMedicationRecord(int index); double getBMI(); int getAge(); List<IllnessRecord> getIllnesses(); IllnessRecord getIllnessById(long id); DonatedOrgan getDonatedOrganById(long id); List<IllnessRecord> getCurrentIllnesses(); void addIllnessRecord(IllnessRecord record); void deleteIllnessRecord(IllnessRecord record); List<ProcedureRecord> getProcedures(); void setProcedures(List<ProcedureRecord> procedures); List<ProcedureRecord> getPendingProcedures(); List<ProcedureRecord> getPastProcedures(); List<TransplantRequest> getTransplantRequests(); void setTransplantRequests(List<TransplantRequest> requests); TransplantRequest getTransplantRequest(Organ organ); TransplantRequest getTransplantRequest(long id); void addProcedureRecord(ProcedureRecord record); void deleteProcedureRecord(ProcedureRecord record); List<DonatedOrgan> getDonatedOrgans(); void setDonatedOrgans(Collection<DonatedOrgan> donatedOrgans); List<DonatedOrgan> getReceivedOrgans(); void addToChangesHistory(HistoryItem historyItem); void removeFromChangesHistory(HistoryItem historyItem); boolean nameContains(String searchParam); boolean profileSearch(String searchParam); @Override boolean equals(Object o); @Override int hashCode(); Optional<TransplantRequest> getTransplantRequestById(long id); void addTransplantRequest(TransplantRequest request); void removeTransplantRequest(TransplantRequest request); @JsonIgnore boolean isDonor(); @JsonIgnore boolean getDateOfDeathIsEditable(); @JsonIgnore void updateHasOverriddenOrgans(); @JsonIgnore boolean isReceiver(); void markDead(LocalDate dateOfDeath,
            LocalTime timeOfDeath,
            Country countryOfDeath,
            String regionOfDeath,
            String cityOfDeath); void donateOrgan(Organ organ); void donateOrgan(Organ organ, Long id); void donateOrgan(Organ organ, LocalDateTime timeDonated); void donateOrgan(Organ organ, LocalDateTime timeDonated, Long id); @Override String getETag(); boolean isOfType(ClientType type); Country getCountry(); void setCountry(Country country); Hospital getHospital(); void setHospital(Hospital hospital); }
Client implements ConcurrencyControlledEntity { public boolean profileSearch(String searchParam) { String lowerSearch = searchParam.toLowerCase(); String[] splitSearchItems = WHITE_SPACE.split(lowerSearch); Collection<String> searched = new ArrayList<>(Arrays.asList(splitSearchItems)); Collection<String> names = this.splitNames(); Collection<String> lowercaseNames = new ArrayList<>(); for (String name : names) { lowercaseNames.add(name.toLowerCase()); } Collection<String> matchedNames = new ArrayList<>(); for (String searchedParam : searched) { for (String name : lowercaseNames) { if (name.startsWith(searchedParam)) { matchedNames.add(name); break; } } } return matchedNames.size() == searched.size(); } Client();  Client(int uid);  Client(String firstName, String middleName, String lastName, LocalDate dateOfBirth, Integer uid); void setOrganDonationStatus(Organ organ, boolean value); void setMedicationHistory(List<MedicationRecord> medicationHistory); void setIllnessHistory(List<IllnessRecord> illnessHistory); Set<Organ> getCurrentlyDonatedOrgans(); String getOrganStatusString(String type); String getClientOrganStatusString(String type); String getUpdatesString(); String getClientInfoString(); String getFullName(); String getFirstName(); void setFirstName(String firstName); String getLastName(); void setLastName(String lastName); String getMiddleName(); void setMiddleName(String middleName); String getPreferredNameFormatted(); String getPreferredName(); void setPreferredName(String preferredName); LocalDate getDateOfBirth(); void setDateOfBirth(LocalDate dateOfBirth); LocalDate getDateOfDeath(); void setDateOfDeath(LocalDate newDateOfDeath); LocalTime getTimeOfDeath(); void setTimeOfDeath(LocalTime newTimeOfDeath); @JsonIgnore LocalDateTime getDatetimeOfDeath(); String getRegionOfDeath(); void setRegionOfDeath(String regionOfDeath); String getCityOfDeath(); void setCityOfDeath(String cityOfDeath); Country getCountryOfDeath(); void setCountryOfDeath(Country countryOfDeath); @JsonIgnore boolean isAlive(); @JsonIgnore boolean isDead(); Gender getGender(); void setGender(Gender gender); Gender getGenderIdentity(); void setGenderIdentity(Gender genderIdentity); double getHeight(); void setHeight(double height); double getWeight(); void setWeight(double weight); BloodType getBloodType(); void setBloodType(BloodType bloodType); String getCurrentAddress(); void setCurrentAddress(String currentAddress); String getRegion(); void setRegion(String region); Integer getUid(); void setUid(Integer uid); Instant getCreatedTimestamp(); Instant getModifiedTimestamp(); Map<Organ, Boolean> getOrganDonationStatus(); void setOrganDonationStatus(Map<Organ, Boolean> map); Set<Organ> getCurrentlyRequestedOrgans(); List<IllnessRecord> getPastIllnesses(); Map<Organ, Boolean> getOrganRequestStatus(); List<MedicationRecord> getCurrentMedications(); List<MedicationRecord> getPastMedications(); List<HistoryItem> getChangesHistory(); List<MedicationRecord> getMedications(); void addMedicationRecord(MedicationRecord record); void deleteMedicationRecord(MedicationRecord record); MedicationRecord getMedicationRecord(int index); double getBMI(); int getAge(); List<IllnessRecord> getIllnesses(); IllnessRecord getIllnessById(long id); DonatedOrgan getDonatedOrganById(long id); List<IllnessRecord> getCurrentIllnesses(); void addIllnessRecord(IllnessRecord record); void deleteIllnessRecord(IllnessRecord record); List<ProcedureRecord> getProcedures(); void setProcedures(List<ProcedureRecord> procedures); List<ProcedureRecord> getPendingProcedures(); List<ProcedureRecord> getPastProcedures(); List<TransplantRequest> getTransplantRequests(); void setTransplantRequests(List<TransplantRequest> requests); TransplantRequest getTransplantRequest(Organ organ); TransplantRequest getTransplantRequest(long id); void addProcedureRecord(ProcedureRecord record); void deleteProcedureRecord(ProcedureRecord record); List<DonatedOrgan> getDonatedOrgans(); void setDonatedOrgans(Collection<DonatedOrgan> donatedOrgans); List<DonatedOrgan> getReceivedOrgans(); void addToChangesHistory(HistoryItem historyItem); void removeFromChangesHistory(HistoryItem historyItem); boolean nameContains(String searchParam); boolean profileSearch(String searchParam); @Override boolean equals(Object o); @Override int hashCode(); Optional<TransplantRequest> getTransplantRequestById(long id); void addTransplantRequest(TransplantRequest request); void removeTransplantRequest(TransplantRequest request); @JsonIgnore boolean isDonor(); @JsonIgnore boolean getDateOfDeathIsEditable(); @JsonIgnore void updateHasOverriddenOrgans(); @JsonIgnore boolean isReceiver(); void markDead(LocalDate dateOfDeath,
            LocalTime timeOfDeath,
            Country countryOfDeath,
            String regionOfDeath,
            String cityOfDeath); void donateOrgan(Organ organ); void donateOrgan(Organ organ, Long id); void donateOrgan(Organ organ, LocalDateTime timeDonated); void donateOrgan(Organ organ, LocalDateTime timeDonated, Long id); @Override String getETag(); boolean isOfType(ClientType type); Country getCountry(); void setCountry(Country country); Hospital getHospital(); void setHospital(Hospital hospital);  }