@Override public Contact getContact(String id) { for (Contact contact : contactList) { if (id.equals(contact.getId())) { return contact; } } return null; }
@Override public Contact editContact(Contact contact) { for (int i = 0; i < contactList.size(); i++) { if (contact.getId().equals(contactList.get(i).getId())) { contactList.remove(i); contactList.add(i, contact); } } return contact; }
public ContactsApiDummyDataSourceImpl() { Picture picture = new Picture(); picture.setThumbnail("http://siliconvalleyrealtyworld.com/files/2011/09/Crash_Test_Dummy.jpg"); picture.setPicture("http://siliconvalleyrealtyworld.com/files/2011/09/Crash_Test_Dummy.jpg"); Contact contact1 = new Contact(); contact1.setId("1"); contact1.setEmail("*****@*****.**"); contact1.setFirstName("Dummy 1"); contact1.setLastName("Test"); contact1.setCell("999-888-777"); contact1.setDNI("99999999R"); contact1.setDob(new Date()); contact1.setGender("Male"); contact1.setLocation(new Location()); contact1.setPicture(picture); Picture picture2 = new Picture(); picture2.setThumbnail("http://www.autofacil.es/elementosWeb/gestionCajas/AUF/Image/Dummy.jpg"); picture2.setPicture("http://www.autofacil.es/elementosWeb/gestionCajas/AUF/Image/Dummy.jpg"); Contact contact2 = new Contact(); contact2.setId("2"); contact2.setEmail("*****@*****.**"); contact2.setFirstName("Dummy 2"); contact2.setLastName("Test"); contact2.setCell("999-888-777"); contact2.setDNI("99999999R"); contact2.setDob(new Date()); contact2.setGender("Male"); contact2.setLocation(new Location()); contact2.setPicture(picture2); contactList.add(contact1); contactList.add(contact2); }