Search in sources :

Example 1 with PersonActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonActionForm in project head by mifos.

the class PersonAction method search.

@Override
@TransactionDemarcate(saveToken = true)
public ActionForward search(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    ActionForward actionForward = null;
    UserContext userContext = getUserContext(request);
    PersonnelBO personnel = this.personnelDao.findPersonnelById(userContext.getId());
    String searchString = ((PersonActionForm) form).getSearchString();
    addSeachValues(searchString, personnel.getOffice().getOfficeId().toString(), personnel.getOffice().getOfficeName(), request);
    searchString = org.mifos.framework.util.helpers.SearchUtils.normalizeSearchString(searchString);
    actionForward = super.search(mapping, form, request, response);
    SessionUtils.setQueryResultAttribute(Constants.SEARCH_RESULTS, legacyPersonnelDao.search(searchString, userContext.getId()), request);
    return actionForward;
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserContext(org.mifos.security.util.UserContext) ActionForward(org.apache.struts.action.ActionForward) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 2 with PersonActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonActionForm in project head by mifos.

the class PersonAction method create.

@TransactionDemarcate(validateAndResetToken = true)
public ActionForward create(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception {
    PersonActionForm personActionForm = (PersonActionForm) form;
    CreateOrUpdatePersonnelInformation perosonnelInfo = translateFormToCreatePersonnelInformationDto(request, personActionForm);
    try {
        UserDetailDto userDetails = this.personnelServiceFacade.createPersonnelInformation(perosonnelInfo);
        String globalPersonnelNum = userDetails.getSystemId();
        Name name = new Name(personActionForm.getFirstName(), personActionForm.getMiddleName(), personActionForm.getSecondLastName(), personActionForm.getLastName());
        request.setAttribute("displayName", name.getDisplayName());
        request.setAttribute("globalPersonnelNum", globalPersonnelNum);
        createGroupQuestionnaire.saveResponses(request, personActionForm, userDetails.getId());
        return mapping.findForward(ActionForwards.create_success.toString());
    } catch (BusinessRuleException e) {
        throw new PersonnelException(e.getMessageKey(), e, e.getMessageValues());
    }
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) BusinessRuleException(org.mifos.service.BusinessRuleException) CreateOrUpdatePersonnelInformation(org.mifos.dto.domain.CreateOrUpdatePersonnelInformation) UserDetailDto(org.mifos.dto.domain.UserDetailDto) PersonnelException(org.mifos.customers.personnel.exceptions.PersonnelException) Name(org.mifos.framework.business.util.Name) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 3 with PersonActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonActionForm in project head by mifos.

the class PersonActionStrutsTest method testLoadWithBranchOffice.

@SuppressWarnings("unchecked")
@Test
public void testLoadWithBranchOffice() throws Exception {
    addActionAndMethod(Methods.load.toString());
    addRequestParameter("officeId", "3");
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    OfficeBO office = (OfficeBO) SessionUtils.getAttribute(PersonnelConstants.OFFICE, request);
    Assert.assertNotNull(office);
    Assert.assertEquals(3, office.getOfficeId().intValue());
    verifyMasterData();
    PersonActionForm personActionForm = (PersonActionForm) request.getSession().getAttribute("personActionForm");
    Assert.assertNotNull(personActionForm);
    //        Assert.assertEquals(1, personActionForm.getCustomFields().size());
    Assert.assertNotNull(SessionUtils.getAttribute(PersonnelConstants.PERSONNEL_LEVEL_LIST, request));
    Assert.assertEquals(2, ((List) SessionUtils.getAttribute(PersonnelConstants.PERSONNEL_LEVEL_LIST, request)).size());
    verifyForward(ActionForwards.load_success.toString());
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) OfficeBO(org.mifos.customers.office.business.OfficeBO) Test(org.junit.Test)

Example 4 with PersonActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonActionForm in project head by mifos.

the class PersonAction method previous.

@SuppressWarnings("unused")
@TransactionDemarcate(joinToken = true)
public ActionForward previous(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PersonActionForm personActionForm = (PersonActionForm) form;
    personActionForm.setPersonnelRoles(null);
    return mapping.findForward(ActionForwards.previous_success.toString());
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Example 5 with PersonActionForm

use of org.mifos.customers.personnel.struts.actionforms.PersonActionForm in project head by mifos.

the class PersonAction method previousManage.

@SuppressWarnings("unused")
@TransactionDemarcate(joinToken = true)
public ActionForward previousManage(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
    PersonActionForm personActionForm = (PersonActionForm) form;
    personActionForm.setPersonnelRoles(null);
    return mapping.findForward(ActionForwards.previousManage_success.toString());
}
Also used : PersonActionForm(org.mifos.customers.personnel.struts.actionforms.PersonActionForm) TransactionDemarcate(org.mifos.framework.util.helpers.TransactionDemarcate)

Aggregations

PersonActionForm (org.mifos.customers.personnel.struts.actionforms.PersonActionForm)13 TransactionDemarcate (org.mifos.framework.util.helpers.TransactionDemarcate)11 ArrayList (java.util.ArrayList)5 RoleBO (org.mifos.security.rolesandpermission.business.RoleBO)5 OfficeBO (org.mifos.customers.office.business.OfficeBO)4 ValueListElement (org.mifos.dto.domain.ValueListElement)4 CustomFieldDefinitionEntity (org.mifos.application.master.business.CustomFieldDefinitionEntity)3 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)3 PersonnelLevelEntity (org.mifos.customers.personnel.business.PersonnelLevelEntity)3 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)3 UserContext (org.mifos.security.util.UserContext)3 List (java.util.List)2 Test (org.junit.Test)2 MessageLookup (org.mifos.application.master.MessageLookup)2 PersonnelException (org.mifos.customers.personnel.exceptions.PersonnelException)2 CreateOrUpdatePersonnelInformation (org.mifos.dto.domain.CreateOrUpdatePersonnelInformation)2 UserDetailDto (org.mifos.dto.domain.UserDetailDto)2 Name (org.mifos.framework.business.util.Name)2 BusinessRuleException (org.mifos.service.BusinessRuleException)2 Date (java.util.Date)1