Code, JavaEE

Application Design Session – Conference Attendee

SCENARIO:
one has a set of users

users have (id, fname, lname, street num, street, city, postal code,area code, phone num)

staff can query users by full name (fname, lname)

results may return multiple users with same name filter returned data by
– postal code
– phone number

final int LIMIT_USERS_TO_RETURN = 100;

UserQuery query = new UserQueryImpl();

List<User> usersList = query.findAll(LIMIT_USERS_TO_RETURN);

public List<User> filterUsers(String filterKey, String filterValue) {
    List<User> listToReturn = new LinkedList<>();
    if (filterKey.equalsIgnoreCase(POSTAL_CODE)) {
        // filter the list
        listToReturn = filterByPostalCode(filterValue);
    } else if (filterKey.equalsIgnoreCase(PHONE_NUMBER)) {
        listToReturn = filterByPhoneNumber(filterValue);
    }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s