]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 24 Apr 2020 01:33:42 +0000 (03:33 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 24 Apr 2020 01:33:42 +0000 (03:33 +0200)
- added utilities method copyBranchOfficeData()

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java

index e37eb97bfa778c08fb83d67e2c2e4f5129eff199..706a3280efd8a0e47e30de6f36ed3a59a73de782 100644 (file)
@@ -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.