/*
- * Copyright (C) 2017 - 2020 Free Software Foundation
+ * Copyright (C) 2017 - 2022 Free Software Foundation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
throw new IllegalArgumentException(MessageFormat.format("event.addedBranchOffice .branchId={0} is not valid", event.getAddedBranchOffice().getBranchId())); //NOI18N
}
- // Add instance to cache
- this.branchOfficeCache.put(event.getAddedBranchOffice().getBranchId(), event.getAddedBranchOffice());
+ // Uniquely add branch office
this.uniqueAddBranchOffice(event.getAddedBranchOffice());
}
throw new IllegalArgumentException(MessageFormat.format("event.updatedBranchOffice .branchId={0} is not valid", event.getUpdatedBranchOffice().getBranchId())); //NOI18N
}
- // Add instance to cache
- this.branchOfficeCache.put(event.getUpdatedBranchOffice().getBranchId(), event.getUpdatedBranchOffice());
+ // Uniquely update branch office
this.uniqueAddBranchOffice(event.getUpdatedBranchOffice());
}
* @param branchOffice Branch office being added
*/
private void uniqueAddBranchOffice (final BranchOffice branchOffice) {
+ // Add instance to cache
+ this.branchOfficeCache.put(branchOffice.getBranchId(), branchOffice);
+
// Get iterator
final Iterator<BranchOffice> iterator = this.getAllBranchOffices().iterator();