From commits-return-1762-archive-asf-public=cust-asf.ponee.io@fineract.apache.org Mon Jan 22 16:54:01 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id 01246180799 for ; Mon, 22 Jan 2018 16:54:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id E49C6160C4B; Mon, 22 Jan 2018 15:54:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1D7C3160C4E for ; Mon, 22 Jan 2018 16:53:59 +0100 (CET) Received: (qmail 12034 invoked by uid 500); 22 Jan 2018 15:53:59 -0000 Mailing-List: contact commits-help@fineract.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@fineract.apache.org Delivered-To: mailing list commits@fineract.apache.org Received: (qmail 11940 invoked by uid 99); 22 Jan 2018 15:53:59 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jan 2018 15:53:59 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8E3C482094; Mon, 22 Jan 2018 15:53:58 +0000 (UTC) Date: Mon, 22 Jan 2018 15:54:02 +0000 To: "commits@fineract.apache.org" Subject: [fineract-cn-office] 04/05: added branches and employees to external references check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: myrle@apache.org In-Reply-To: <151663643845.12677.18039610816674415544@gitbox.apache.org> References: <151663643845.12677.18039610816674415544@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: fineract-cn-office X-Git-Refname: refs/heads/develop X-Git-Reftype: branch X-Git-Rev: 6984777ab5bf9330cdbd28fa4a7aa6abeaa3e54d X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20180122155358.8E3C482094@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. myrle pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/fineract-cn-office.git commit 6984777ab5bf9330cdbd28fa4a7aa6abeaa3e54d Author: mgeiss AuthorDate: Tue Sep 19 07:16:13 2017 +0200 added branches and employees to external references check --- component-test/src/main/java/io/mifos/office/TestOffice.java | 6 ++++++ .../java/io/mifos/office/internal/service/OfficeService.java | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/component-test/src/main/java/io/mifos/office/TestOffice.java b/component-test/src/main/java/io/mifos/office/TestOffice.java index 8e8ad1d..fba3101 100644 --- a/component-test/src/main/java/io/mifos/office/TestOffice.java +++ b/component-test/src/main/java/io/mifos/office/TestOffice.java @@ -329,6 +329,9 @@ public class TestOffice { this.organizationManager.addBranch(parent.getIdentifier(), branch); this.eventRecorder.wait(EventConstants.OPERATION_POST_OFFICE, branch.getIdentifier()); + final Office fetchedParent = this.organizationManager.findOfficeByIdentifier(parent.getIdentifier()); + Assert.assertTrue(fetchedParent.getExternalReferences()); + this.organizationManager.deleteOffice(parent.getIdentifier()); } @@ -343,6 +346,9 @@ public class TestOffice { this.organizationManager.createEmployee(employee); this.eventRecorder.wait(EventConstants.OPERATION_POST_EMPLOYEE, employee.getIdentifier()); + final Office fetchedOffice = this.organizationManager.findOfficeByIdentifier(office.getIdentifier()); + Assert.assertTrue(fetchedOffice.getExternalReferences()); + this.organizationManager.deleteOffice(office.getIdentifier()); } diff --git a/service/src/main/java/io/mifos/office/internal/service/OfficeService.java b/service/src/main/java/io/mifos/office/internal/service/OfficeService.java index aa36d15..4db1ae9 100644 --- a/service/src/main/java/io/mifos/office/internal/service/OfficeService.java +++ b/service/src/main/java/io/mifos/office/internal/service/OfficeService.java @@ -112,7 +112,11 @@ public class OfficeService { final Optional addressEntityOptional = this.addressRepository.findByOffice(officeEntityOptional.get()); addressEntityOptional.ifPresent(addressEntity -> office.setAddress(AddressMapper.map(addressEntity))); - office.setExternalReferences(this.hasExternalReferences(office.getIdentifier())); + office.setExternalReferences( + this.branchExists(office.getIdentifier()) + || this.hasEmployees(office.getIdentifier()) + || this.hasExternalReferences(office.getIdentifier()) + ); }); return officeOptional; @@ -158,7 +162,11 @@ public class OfficeService { final Optional addressEntityOptional = this.addressRepository.findByOffice(officeEntity); addressEntityOptional.ifPresent(addressEntity -> office.setAddress(AddressMapper.map(addressEntity))); - office.setExternalReferences(this.hasExternalReferences(office.getIdentifier())); + office.setExternalReferences( + this.branchExists(office.getIdentifier()) + || this.hasEmployees(office.getIdentifier()) + || this.hasExternalReferences(office.getIdentifier()) + ); }); return offices; } -- To stop receiving notification emails like this one, please contact myrle@apache.org.