use of org.mifos.dto.domain.CenterInformationDto in project head by mifos.
the class CenterServiceFacadeWebTier method getCenterInformationDto.
@Override
public CenterInformationDto getCenterInformationDto(String globalCustNum) {
MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserContext userContext = toUserContext(user);
CenterBO center = customerDao.findCenterBySystemId(globalCustNum);
if (center == null) {
throw new MifosRuntimeException("Center not found for globalCustNum" + globalCustNum);
}
try {
personnelDao.checkAccessPermission(userContext, center.getOfficeId(), center.getLoanOfficerId());
} catch (AccountException e) {
throw new MifosRuntimeException("Access denied!", e);
}
CenterDisplayDto centerDisplay = customerDao.getCenterDisplayDto(center.getCustomerId(), userContext);
Integer centerId = center.getCustomerId();
String searchId = center.getSearchId();
Short branchId = centerDisplay.getBranchId();
CustomerAccountSummaryDto customerAccountSummary = customerDao.getCustomerAccountSummaryDto(centerId);
CenterPerformanceHistoryDto centerPerformanceHistory = customerDao.getCenterPerformanceHistory(searchId, branchId);
CustomerAddressDto centerAddress = customerDao.getCustomerAddressDto(center);
List<CustomerDetailDto> groups = customerDao.getGroupsOtherThanClosedAndCancelledForGroup(searchId, branchId);
List<CustomerNoteDto> recentCustomerNotes = customerDao.getRecentCustomerNoteDto(centerId);
List<CustomerPositionOtherDto> customerPositions = customerDao.getCustomerPositionDto(centerId, userContext);
List<SavingsDetailDto> savingsDetail = customerDao.getSavingsDetailDto(centerId, userContext);
CustomerMeetingDto customerMeeting = customerDao.getCustomerMeetingDto(center.getCustomerMeeting(), userContext);
List<AccountBO> allClosedLoanAndSavingsAccounts = customerDao.retrieveAllClosedLoanAndSavingsAccounts(centerId);
List<SavingsDetailDto> closedSavingsAccounts = new ArrayList<SavingsDetailDto>();
for (AccountBO closedAccount : allClosedLoanAndSavingsAccounts) {
if (closedAccount.getAccountType().getAccountTypeId() == AccountTypes.SAVINGS_ACCOUNT.getValue().intValue()) {
closedSavingsAccounts.add(new SavingsDetailDto(closedAccount.getGlobalAccountNum(), ((SavingsBO) closedAccount).getSavingsOffering().getPrdOfferingName(), closedAccount.getAccountState().getId(), closedAccount.getAccountState().getName(), ((SavingsBO) closedAccount).getSavingsBalance().toString()));
}
}
//new SurveysPersistence().isActiveSurveysForSurveyType(SurveyType.CENTER);
Boolean activeSurveys = Boolean.FALSE;
List<SurveyDto> customerSurveys = new ArrayList<SurveyDto>();
List<CustomFieldDto> customFields = new ArrayList<CustomFieldDto>();
return new CenterInformationDto(centerDisplay, customerAccountSummary, centerPerformanceHistory, centerAddress, groups, recentCustomerNotes, customerPositions, savingsDetail, customerMeeting, activeSurveys, customerSurveys, customFields, closedSavingsAccounts);
}
use of org.mifos.dto.domain.CenterInformationDto in project head by mifos.
the class CenterCustAction method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
CenterInformationDto centerInformationDto;
try {
centerInformationDto = this.centerServiceFacade.getCenterInformationDto(((CenterCustActionForm) form).getGlobalCustNum());
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
SessionUtils.removeThenSetAttribute("centerInformationDto", centerInformationDto, request);
// John W - 'BusinessKey' attribute used by breadcrumb but is not in associated jsp
CenterBO centerBO = (CenterBO) this.customerDao.findCustomerById(centerInformationDto.getCenterDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, centerBO, request);
setCurrentPageUrl(request, centerBO);
setQuestionGroupInstances(request, centerBO);
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.dto.domain.CenterInformationDto in project head by mifos.
the class ViewCustomerDetailsController method showCenterDetails.
@RequestMapping(value = "/viewCenterDetails", method = RequestMethod.GET)
public ModelAndView showCenterDetails(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
sitePreferenceHelper.resolveSiteType(modelAndView, "viewCenterDetails", request);
modelAndView.addObject("include_page", new IncludePage(request, response));
String centerSystemId = request.getParameter("globalCustNum");
CenterInformationDto centerInformationDto = this.centerServiceFacade.getCenterInformationDto(centerSystemId);
modelAndView.addObject("centerInformationDto", centerInformationDto);
modelAndView.addObject("currentPageUrl", UrlHelper.constructCurrentPageUrl(request));
request.getSession().setAttribute("backPageUrl", request.getAttribute("currentPageUrl"));
centerServiceFacade.putCenterBusinessKeyInSession(centerSystemId, request);
return modelAndView;
}
use of org.mifos.dto.domain.CenterInformationDto in project head by mifos.
the class CenterActionStrutsTest method testGet.
@Test
public void testGet() throws Exception {
setNonLoanOfficerMifosUser();
MeetingBO meeting = TestObjectFactory.createMeeting(TestObjectFactory.getTypicalMeeting());
center = TestObjectFactory.createWeeklyFeeCenter("Center", meeting);
group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group", CustomerStatus.GROUP_ACTIVE, center);
savingsBO = getSavingsAccount("fsaf6", "ads6", center);
StaticHibernateUtil.flushSession();
setRequestPathInfo("/centerCustAction.do");
addRequestParameter("method", "get");
addRequestParameter("globalCustNum", center.getGlobalCustNum());
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
actionPerform();
verifyForward(ActionForwards.get_success.toString());
CustomerBO centerBO = (CenterBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
Assert.assertNotNull(center);
Assert.assertEquals(center.getCustomerId(), centerBO.getCustomerId());
CenterInformationDto centerInformation = (CenterInformationDto) SessionUtils.getAttribute("centerInformationDto", request);
List<CustomerDetailDto> children = centerInformation.getGroupsOtherThanClosedAndCancelled();
Assert.assertNotNull(children);
Assert.assertEquals(1, children.size());
Assert.assertEquals("Size of the active accounts should be 1", 1, centerInformation.getSavingsAccountsInUse().size());
StaticHibernateUtil.flushSession();
center = TestObjectFactory.getCenter(center.getCustomerId());
group = TestObjectFactory.getGroup(group.getCustomerId());
savingsBO = TestObjectFactory.getObject(SavingsBO.class, savingsBO.getAccountId());
}
use of org.mifos.dto.domain.CenterInformationDto in project head by mifos.
the class CenterRESTController method createCenter.
@RequestMapping(value = "/center/create", method = RequestMethod.POST)
@ResponseBody
public Map<String, String> createCenter(@RequestBody String request) throws Throwable {
ObjectMapper om = createCenterMaping();
CreateCenterDetailsDto creationDetail = null;
MeetingBO meetingBO = null;
try {
creationDetail = om.readValue(request, CreateCenterDetailsDto.class);
} catch (JsonMappingException e) {
throw e.getCause();
}
validate(creationDetail);
meetingBO = (MeetingBO) creationDetail.getMeeting().toBO();
CenterCreationDetail center = createCenter(creationDetail);
CustomerDetailsDto details = this.centerServiceFacade.createNewCenter(center, meetingBO.toDto());
CenterInformationDto centerInfo = this.centerServiceFacade.getCenterInformationDto(details.getGlobalCustNum());
Map<String, String> map = new HashMap<String, String>();
map.put("status", "success");
map.put("globalCustNum", centerInfo.getCenterDisplay().getGlobalCustNum());
map.put("accountNum", centerInfo.getCustomerAccountSummary().getGlobalAccountNum());
map.put("name", center.getDisplayName());
map.put("externalId", center.getExternalId());
map.put("mfiDate", center.getMfiJoiningDate().toString());
map.put("address", center.getAddressDto().getDisplayAddress());
map.put("city", center.getAddressDto().getCity());
map.put("state", center.getAddressDto().getState());
map.put("country", center.getAddressDto().getCountry());
map.put("postal code", center.getAddressDto().getZip());
map.put("phone", center.getAddressDto().getPhoneNumber());
return map;
}
Aggregations