void onActionFromEditContact(long personNumber) throws RemoteException { for (Contact con : contacts) { if (con.getPersonNumber() == personNumber) { contactEdited = con.clone(); editContactId = contactEdited.getContactId(); break; } } }
Object onSuccessFromContactForm() throws RemoteException { if (isNewContact) { Contact newContact = contactEdited.clone(); // Can only have one legal contact if (newContact.isLegalContact()) { for (Contact con : contacts) { con.setLegalContact(false); } } contacts.add(newContact); } else if (isApplyingContact) { Contact newContact = contactEdited.clone(); for (int i = 0; i < contacts.size(); i++) { if (contacts.get(i).getContactId() == editContactId) { contacts.set(i, newContact); } else { // Can only have one legal contact if (newContact.isLegalContact()) { contacts.get(i).setLegalContact(false); } } } } else if (isDeleteContact) { Contact contactToRemove = null; for (Contact con : contacts) { if (con.getContactId() == editContactId) { contactToRemove = con; break; } } if (contactToRemove != null) { contacts.remove(contactToRemove); } } else if (isApplyingCustomer) { // do nothing } clearContactForm(); return null; }