Search in sources :

Example 1 with BranchReportHeaderDTO

use of org.mifos.reports.business.dto.BranchReportHeaderDTO in project head by mifos.

the class BranchReportService method getBranchReportHeaderDTO.

@Override
public BranchReportHeaderDTO getBranchReportHeaderDTO(Integer branchId, String runDate) throws ServiceException {
    Short officeId = convertIntegerToShort(branchId);
    PersonnelBO branchManager = CollectionUtils.first(personnelBusinessService.getActiveBranchManagersUnderOffice(officeId));
    try {
        return new BranchReportHeaderDTO(officeBusinessService.getOffice(officeId), branchManager == null ? null : branchManager.getDisplayName(), ReportUtils.parseReportDate(runDate));
    } catch (ParseException e) {
        throw new ServiceException(e);
    }
}
Also used : BranchReportHeaderDTO(org.mifos.reports.business.dto.BranchReportHeaderDTO) ServiceException(org.mifos.framework.exceptions.ServiceException) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) ParseException(java.text.ParseException) NumberUtils.convertIntegerToShort(org.mifos.framework.util.helpers.NumberUtils.convertIntegerToShort)

Example 2 with BranchReportHeaderDTO

use of org.mifos.reports.business.dto.BranchReportHeaderDTO in project head by mifos.

the class BranchReportServiceIntegrationTest method testServiceReturnsHeaderInformation.

@Test
public void testServiceReturnsHeaderInformation() throws Exception {
    session.save(branchReport);
    OfficeBO office = OfficecFixture.createOffice(BRANCH_ID_SHORT);
    expect(officeBusinessServiceMock.getOffice(BRANCH_ID_SHORT)).andReturn(office);
    replay(officeBusinessServiceMock);
    BranchReportHeaderDTO returnedHeaderDTO = branchReportService.getBranchReportHeaderDTO(BRANCH_ID, RUN_DATE_STR);
    verify(officeBusinessServiceMock);
    Assert.assertEquals(new BranchReportHeaderDTO(office, null, ReportUtils.parseReportDate(RUN_DATE_STR)), returnedHeaderDTO);
}
Also used : BranchReportHeaderDTO(org.mifos.reports.business.dto.BranchReportHeaderDTO) OfficeBO(org.mifos.customers.office.business.OfficeBO) Test(org.junit.Test)

Aggregations

BranchReportHeaderDTO (org.mifos.reports.business.dto.BranchReportHeaderDTO)2 ParseException (java.text.ParseException)1 Test (org.junit.Test)1 OfficeBO (org.mifos.customers.office.business.OfficeBO)1 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)1 ServiceException (org.mifos.framework.exceptions.ServiceException)1 NumberUtils.convertIntegerToShort (org.mifos.framework.util.helpers.NumberUtils.convertIntegerToShort)1