use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class GroupCustAction method get.
@TransactionDemarcate(saveToken = true)
public ActionForward get(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
logger.debug("In GroupCustAction get method ");
// John W - UserContext object passed because some status' need to be looked up for internationalisation based
// on UserContext info
String groupSystemId = ((GroupCustActionForm) form).getGlobalCustNum();
GroupInformationDto groupInformationDto;
try {
groupInformationDto = this.groupServiceFacade.getGroupInformationDto(groupSystemId);
} catch (MifosRuntimeException e) {
if (e.getCause() instanceof ApplicationException) {
throw (ApplicationException) e.getCause();
}
throw e;
}
SessionUtils.removeThenSetAttribute("groupInformationDto", groupInformationDto, request);
// John W - - not sure whether to leave these rules as is or do something else like bake the logic into the main
// dto and out of the jsp
SessionUtils.setAttribute(GroupConstants.IS_GROUP_LOAN_ALLOWED, ClientRules.getGroupCanApplyLoans(), request);
SessionUtils.setAttribute(GroupConstants.CENTER_HIERARCHY_EXIST, ClientRules.getCenterHierarchyExists(), request);
// John W - 'BusinessKey' attribute linked to GroupBo is still used by other actions (e.g. meeting related)
// further on and also breadcrumb.
GroupBO groupBO = (GroupBO) this.customerDao.findCustomerById(groupInformationDto.getGroupDisplay().getCustomerId());
SessionUtils.removeThenSetAttribute(Constants.BUSINESS_KEY, groupBO, request);
setCurrentPageUrl(request, groupBO);
setQuestionGroupInstances(request, groupBO);
logger.debug("Exiting GroupCustAction get method ");
return mapping.findForward(ActionForwards.get_success.toString());
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class GroupTransferAction method transferToCenter.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward transferToCenter(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupTransferActionForm actionForm = (GroupTransferActionForm) form;
GroupBO groupInSession = (GroupBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CustomerDetailDto groupDetail = this.groupServiceFacade.transferGroupToCenter(groupInSession.getGlobalCustNum(), actionForm.getCenterSystemId(), groupInSession.getVersionNo());
GroupBO group = this.customerDao.findGroupBySystemId(groupDetail.getGlobalCustNum());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, group, request);
return mapping.findForward(ActionForwards.update_success.toString());
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class GroupTransferAction method transferToBranch.
@TransactionDemarcate(validateAndResetToken = true)
@CloseSession
public ActionForward transferToBranch(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
GroupTransferActionForm actionForm = (GroupTransferActionForm) form;
GroupBO groupInSession = (GroupBO) SessionUtils.getAttribute(Constants.BUSINESS_KEY, request);
CustomerDetailDto groupDetail = this.groupServiceFacade.transferGroupToBranch(groupInSession.getGlobalCustNum(), actionForm.getOfficeIdValue(), groupInSession.getVersionNo());
GroupBO group = this.customerDao.findGroupBySystemId(groupDetail.getGlobalCustNum());
SessionUtils.setAttribute(Constants.BUSINESS_KEY, group, request);
return mapping.findForward(ActionForwards.update_success.toString());
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class GroupServiceFacadeWebTierIntegrationTest method shouldTransferGroupFromOfficeToOffice.
@Test
public void shouldTransferGroupFromOfficeToOffice() {
// setup
boolean centerHierarchyExistsOriginal = ClientRules.getCenterHierarchyExists();
ClientRules.setCenterHierarchyExists(false);
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
createOfficeHierarchyUnderHeadOffice(headOffice);
Short officeId1 = branch1.getOfficeId();
CustomerDetailsDto group1Details = createGroup("group1", officeId1);
Short officeId2 = branch2.getOfficeId();
CustomerDetailsDto group2Details = createGroup("group2", officeId2);
CustomerDetailsDto newlyCreatedCustomerDetails = createClient(group1Details.getId().toString());
GroupBO group1 = customerDao.findGroupBySystemId(group1Details.getGlobalCustNum());
groupServiceFacade.transferGroupToBranch(group1Details.getGlobalCustNum(), officeId2, group1.getVersionNo());
ClientRules.setCenterHierarchyExists(centerHierarchyExistsOriginal);
}
use of org.mifos.customers.group.business.GroupBO in project head by mifos.
the class GroupServiceFacadeWebTierIntegrationTest method shouldCreateGroupWithActivationDateInPast.
@Test
public void shouldCreateGroupWithActivationDateInPast() {
// setup
boolean centerHierarchyExistsOriginal = ClientRules.getCenterHierarchyExists();
MeetingBO meeting = new MeetingBuilder().withStartDate(new DateTime().minusWeeks(2)).build();
MeetingDto meetingDto = meeting.toDto();
String displayName = "testGroup";
String externalId = null;
AddressDto addressDto = null;
PersonnelBO user = IntegrationTestObjectMother.findPersonnelById(Short.valueOf("1"));
Short loanOfficerId = user.getPersonnelId();
List<ApplicableAccountFeeDto> feesToApply = new ArrayList<ApplicableAccountFeeDto>();
Short customerStatus = CustomerStatus.GROUP_ACTIVE.getValue();
boolean trained = false;
DateTime trainedOn = null;
String parentSystemId = null;
OfficeBO headOffice = IntegrationTestObjectMother.findOfficeById(Short.valueOf("1"));
// setup
createOfficeHierarchyUnderHeadOffice(headOffice);
Short officeId = branch1.getOfficeId();
DateTime mfiJoiningDate = new DateTime().minusWeeks(2);
DateTime activationDate = new DateTime().minusWeeks(1);
GroupCreationDetail groupCenterDetail = new GroupCreationDetail(displayName, externalId, addressDto, loanOfficerId, feesToApply, customerStatus, trained, trainedOn, parentSystemId, officeId, mfiJoiningDate, activationDate);
// exercise test
ClientRules.setCenterHierarchyExists(false);
CustomerDetailsDto newlyCreatedGroupDetails = groupServiceFacade.createNewGroup(groupCenterDetail, meetingDto);
// verification
ClientRules.setCenterHierarchyExists(centerHierarchyExistsOriginal);
GroupBO group = customerDao.findGroupBySystemId(newlyCreatedGroupDetails.getGlobalCustNum());
Assert.assertThat(new LocalDate(group.getCustomerActivationDate()), is(activationDate.toLocalDate()));
}
Aggregations