]> git.mxchange.org Git - jcontacts-business-core.git/blobdiff - src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOffices.java
Continued:
[jcontacts-business-core.git] / src / org / mxchange / jcontactsbusiness / model / branchoffice / BranchOffices.java
index e37eb97bfa778c08fb83d67e2c2e4f5129eff199..2742a5e268c7d3b47afcbbec447c4779de5f3e8c 100644 (file)
@@ -58,6 +58,47 @@ 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
+               } else if (Objects.equals(sourceBranchOffice, targetBranchOffice)) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("sourceBranchOffice and targetBranchOffice are the same"); //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.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.