package gw.account uses gw.api.locale.DisplayKey uses java.lang.IllegalArgumentException @Export class AccountContactMergeableImpl extends AbstractMergeableImpl { construct(mergeable : AccountContact) { super(mergeable) } override function checkSanity(merged : AccountContact) { if (!Survivor.ContactType.equals(merged.ContactType)) { throw new IllegalArgumentException(DisplayKey.get("Java.AccountContact.Error.MergedAccountContactNotSameContactType", merged, merged.ContactType, Survivor, Survivor.ContactType)) } } /** * Merges this AccountContact with the passed in account contact. The passed in contact is considered to be the * "merged" contact, while this AccountContact is the survivor. After the merge: * * * @param merged the AccountContact to merge into this AccountContact */ override function mergeFields(merged : AccountContact) : boolean { // if the merged account contact was the AccountHolder, make sure the survivor is Active if (merged.hasRole(TC_ACCOUNTHOLDER)) { Survivor.Active = true } mergeChildren(Survivor, merged, \ parent -> parent.Roles, \ child, parent -> {child.AccountContact = parent}) return true } }