Search in sources :

Example 71 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class PersonnelBuilder method build.

public PersonnelBO build() {
    final PersonnelBO personnel = new PersonnelBO();
    personnel.setUserName(username);
    personnel.setStatus(status);
    personnel.setPersonnelDetails(null);
    personnel.setPreferredLocale(null);
    personnel.setLevel(new PersonnelLevelEntity(level));
    personnel.setOffice(office);
    personnel.setDisplayName(displayName);
    personnel.setUserContext(userContext);
    personnel.setCreateDetails();
    personnel.setPersonnelRoles(personnelRoles);
    return personnel;
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) PersonnelLevelEntity(org.mifos.customers.personnel.business.PersonnelLevelEntity)

Example 72 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class CustSearchActionStrutsTest method testLoadMainSearchNonLoBoUser.

@Test
public void testLoadMainSearchNonLoBoUser() throws Exception {
    OfficeBO officeBO = TestObjectFactory.getOffice(TestObjectFactory.SAMPLE_BRANCH_OFFICE);
    PersonnelBO personnelBO = TestObjectFactory.createPersonnel(PersonnelLevel.NON_LOAN_OFFICER, officeBO, Integer.valueOf("1"), Short.valueOf("1"), "1234", "raj", null, null, null, new Name("abe", null, null, null), null, new Date(), null, Integer.valueOf("1"), null, null, null, new Date(), new HashSet());
    userContext.setId(personnelBO.getPersonnelId());
    addActionAndMethod(Methods.loadMainSearch.toString());
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(CustomerSearchConstants.LOADFORWARDNONLOANOFFICER_SUCCESS);
    List<PersonnelBO> personnelList = (List<PersonnelBO>) SessionUtils.getAttribute(CustomerSearchConstants.LOANOFFICERSLIST, request);
    Assert.assertNotNull(personnelList);
    Assert.assertEquals(1, personnelList.size());
    Assert.assertEquals(officeBO.getOfficeName(), SessionUtils.getAttribute(CustomerSearchConstants.OFFICE, request));
}
Also used : OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) List(java.util.List) Date(java.util.Date) Name(org.mifos.framework.business.util.Name) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 73 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class TestObjectFactory method getUserContext.

/**
     * Also see {@link TestUtils#makeUser()} which should be faster (this method involves several database accesses).
     */
private static UserContext getUserContext() throws SystemException, ApplicationException {
    byte[] password = EncryptionService.getInstance().createEncryptedPassword("mifos");
    PersonnelBO user = getPersonnel(PersonnelConstants.SYSTEM_USER);
    user.setEncryptedPassword(password);
    updateObject(user);
    user.login("mifos");
    UserContext userContext = new UserContext();
    userContext.setPreferredLocale(Locale.UK);
    userContext.setLocaleId(Localization.ENGLISH_LOCALE_ID);
    userContext.setId(user.getPersonnelId());
    userContext.setName(user.getDisplayName());
    userContext.setLevel(user.getLevelEnum());
    userContext.setRoles(user.getRoles());
    userContext.setLastLogin(user.getLastLogin());
    userContext.setPasswordChanged(user.getPasswordChanged());
    userContext.setBranchId(user.getOffice().getOfficeId());
    userContext.setBranchGlobalNum(user.getOffice().getGlobalOfficeNum());
    userContext.setOfficeLevelId(user.getOffice().getLevel().getId());
    return userContext;
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) UserContext(org.mifos.security.util.UserContext)

Example 74 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class TestObjectFactory method createPersonnel.

public static PersonnelBO createPersonnel(final PersonnelLevel level, final OfficeBO office, final Integer title, final Short preferredLocale, final String password, final String userName, final String emailId, final List<RoleBO> personnelRoles, final List<CustomFieldDto> customFields, final Name name, final String governmentIdNumber, final Date dob, final Integer maritalStatus, final Integer gender, final Date dateOfJoiningMFI, final Date dateOfJoiningBranch, final Address address, Date passwordExpirationDate, Set<PersonnelUsedPasswordEntity> usedPasswords) throws Exception {
    PersonnelBO personnelBO = new PersonnelBO(level, office, title, preferredLocale, password, userName, emailId, personnelRoles, customFields, name, governmentIdNumber, dob, maritalStatus, gender, dateOfJoiningMFI, dateOfJoiningBranch, address, Short.valueOf("1"), passwordExpirationDate, usedPasswords);
    IntegrationTestObjectMother.createPersonnel(personnelBO);
    return IntegrationTestObjectMother.findPersonnelById(personnelBO.getPersonnelId());
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO)

Example 75 with PersonnelBO

use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.

the class TestObjectFactory method createInstanceForTest.

public static GroupBO createInstanceForTest(final UserContext userContext, final GroupTemplate template, final CenterBO center, final Date customerActivationDate) {
    PersonnelBO formedBy = null;
    DateTime mfiJoiningDate = new DateTime().toDateMidnight().toDateTime();
    DateTime activationDate = new DateTime().toDateMidnight().toDateTime();
    GroupBO group = GroupBO.createGroupWithCenterAsParent(userContext, template.getDisplayName(), formedBy, center, template.getAddress(), template.getExternalId(), template.isTrained(), new DateTime(template.getTrainedDate()), template.getCustomerStatus(), mfiJoiningDate, activationDate);
    group.setCustomerActivationDate(customerActivationDate);
    return group;
}
Also used : PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) GroupBO(org.mifos.customers.group.business.GroupBO) DateTime(org.joda.time.DateTime)

Aggregations

PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)239 Test (org.junit.Test)91 UserContext (org.mifos.security.util.UserContext)65 ArrayList (java.util.ArrayList)62 Money (org.mifos.framework.util.helpers.Money)46 MifosRuntimeException (org.mifos.core.MifosRuntimeException)44 OfficeBO (org.mifos.customers.office.business.OfficeBO)44 MifosUser (org.mifos.security.MifosUser)44 PersistenceException (org.mifos.framework.exceptions.PersistenceException)41 Date (java.util.Date)39 LocalDate (org.joda.time.LocalDate)37 AccountException (org.mifos.accounts.exceptions.AccountException)37 DateTime (org.joda.time.DateTime)36 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)34 BusinessRuleException (org.mifos.service.BusinessRuleException)33 PersonnelBuilder (org.mifos.domain.builders.PersonnelBuilder)31 MeetingBO (org.mifos.application.meeting.business.MeetingBO)30 CustomerBO (org.mifos.customers.business.CustomerBO)27 ServiceException (org.mifos.framework.exceptions.ServiceException)27 LoanBO (org.mifos.accounts.loan.business.LoanBO)25