From d52841c15767f6008c66cfdc59765b3f997ed321 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org>
Date: Fri, 24 Apr 2020 03:33:42 +0200
Subject: [PATCH] Continued: - added utilities method copyBranchOfficeData()
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

Signed-off-by: Roland Häder <roland@mxchange.org>
---
 .../model/branchoffice/BranchOffices.java     | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)

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
+	 * <p>
+	 * @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.
-- 
2.39.5