From: Roland Häder Date: Fri, 24 Apr 2020 01:33:42 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d52841c15767f6008c66cfdc59765b3f997ed321;p=jcontacts-business-core.git Continued: - added utilities method copyBranchOfficeData() Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java index e37eb97..706a328 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java @@ -58,6 +58,46 @@ public class BranchOffices implements Serializable { return branchOffice1.compareTo(branchOffice2); } + /** + * Copies all fields from source to target branch office instance + *

+ * @param sourceBranchOffice Source BranchOffice instance + * @param targetBranchOffice Target BranchOffice instance + */ + public static void copyBranchOfficeData (final BranchOffice sourceBranchOffice, final BranchOffice targetBranchOffice) { + // Check that both parameters are not null + if (null == sourceBranchOffice) { + // Throw NPE + throw new NullPointerException("sourceBranchOffice is null"); //NOI18N + } else if (null == targetBranchOffice) { + // Throw NPE + throw new NullPointerException("targetBranchOffice is null"); //NOI18N + } + + // Copy all fields + targetBranchOffice.setBranchCity(sourceBranchOffice.getBranchCity()); + targetBranchOffice.setBranchCompany(sourceBranchOffice.getBranchCompany()); + targetBranchOffice.setBranchContactEmployee(sourceBranchOffice.getBranchContactEmployee()); + targetBranchOffice.setBranchCountry(sourceBranchOffice.getBranchCountry()); + targetBranchOffice.setBranchEmailAddress(sourceBranchOffice.getBranchEmailAddress()); + targetBranchOffice.setBranchEntryCreated(sourceBranchOffice.getBranchEntryCreated()); + targetBranchOffice.setBranchEntryUpdated(sourceBranchOffice.getBranchEntryUpdated()); + targetBranchOffice.setBranchFaxNumber(sourceBranchOffice.getBranchFaxNumber()); + targetBranchOffice.setBranchHouseNumber(sourceBranchOffice.getBranchHouseNumber()); + targetBranchOffice.setBranchHouseNumberExtension(sourceBranchOffice.getBranchHouseNumberExtension()); + targetBranchOffice.setBranchId(sourceBranchOffice.getBranchId()); + targetBranchOffice.setBranchLandLineNumber(sourceBranchOffice.getBranchLandLineNumber()); + targetBranchOffice.setBranchLastHouseNumber(sourceBranchOffice.getBranchLastHouseNumber()); + targetBranchOffice.setBranchNumber(sourceBranchOffice.getBranchNumber()); + targetBranchOffice.setBranchOpeningTimes(sourceBranchOffice.getBranchOpeningTimes()); + targetBranchOffice.setBranchOwnerEmployee(sourceBranchOffice.getBranchOwnerEmployee()); + targetBranchOffice.setBranchStore(sourceBranchOffice.getBranchStore()); + targetBranchOffice.setBranchStreet(sourceBranchOffice.getBranchStreet()); + targetBranchOffice.setBranchSuiteNumber(sourceBranchOffice.getBranchSuiteNumber()); + targetBranchOffice.setBranchUserOwner(sourceBranchOffice.getBranchUserOwner()); + targetBranchOffice.setBranchZipCode(sourceBranchOffice.getBranchZipCode()); + } + /** * Checks if both branch offices have same address. This method will throw * an {@code NullPointerException} if one of the instances is null.