Search in sources :

Example 36 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class PersonActionForm method clear.

public void clear() {
    this.personnelId = null;
    this.level = null;
    this.globalPersonnelNum = null;
    this.officeId = null;
    this.title = null;
    this.firstName = null;
    this.middleName = null;
    this.secondLastName = null;
    this.lastName = null;
    this.status = null;
    this.preferredLocale = null;
    this.searchId = null;
    this.loginName = null;
    this.userPassword = null;
    this.emailId = null;
    this.governmentIdNumber = null;
    this.dobDD = null;
    this.dobMM = null;
    this.dobYY = null;
    this.passwordExpirationDateDD = null;
    this.passwordExpirationDateMM = null;
    this.passwordExpirationDateYY = null;
    this.maritalStatus = null;
    this.gender = null;
    this.dateOfJoiningMFIDD = null;
    this.dateOfJoiningMFIMM = null;
    this.dateOfJoiningMFIYY = null;
    this.dateOfJoiningBranch = null;
    this.personnelRoles = new String[10];
    this.input = null;
    this.searchString = null;
    address = new Address();
    customFields = new ArrayList<CustomFieldDto>();
    this.setQuestionGroups(null);
}
Also used : Address(org.mifos.framework.business.util.Address) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto)

Example 37 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class ClientCustActionStrutsTest method createAndSetClientInSession.

private void createAndSetClientInSession() throws Exception {
    OfficeBO office = new OfficePersistence().getOffice(TestObjectFactory.HEAD_OFFICE);
    PersonnelBO personnel = legacyPersonnelDao.getPersonnel(PersonnelConstants.TEST_USER);
    meeting = getMeeting();
    ClientNameDetailDto clientNameDetailDto = new ClientNameDetailDto(NameType.CLIENT.getValue(), 1, "Client", "", "1", "");
    clientNameDetailDto.setNames(ClientRules.getNameSequence());
    ClientNameDetailDto spouseNameDetailView = new ClientNameDetailDto(NameType.SPOUSE.getValue(), 1, "first", "middle", "last", "secondLast");
    spouseNameDetailView.setNames(ClientRules.getNameSequence());
    ClientPersonalDetailDto clientPersonalDetailDto = new ClientPersonalDetailDto(1, 1, 1, 1, 1, 1, Short.valueOf("1"), Short.valueOf("1"), Short.valueOf("41"));
    Calendar dob = new GregorianCalendar();
    dob.set(Calendar.YEAR, 1970);
    client = new ClientBO(TestUtils.makeUser(), clientNameDetailDto.getDisplayName(), CustomerStatus.fromInt(new Short("1")), null, null, new Address(), getCustomFields(), null, null, personnel, office, meeting, personnel, dob.getTime(), null, null, null, YesNoFlag.NO.getValue(), clientNameDetailDto, spouseNameDetailView, clientPersonalDetailDto, null);
    legacyClientDao.saveClient(client);
    StaticHibernateUtil.flushAndClearSession();
    client = TestObjectFactory.getClient(Integer.valueOf(client.getCustomerId()).intValue());
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, client, request);
}
Also used : Address(org.mifos.framework.business.util.Address) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) ClientNameDetailDto(org.mifos.dto.screen.ClientNameDetailDto) ClientPersonalDetailDto(org.mifos.dto.screen.ClientPersonalDetailDto) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) ClientBO(org.mifos.customers.client.business.ClientBO) GregorianCalendar(java.util.GregorianCalendar) OfficePersistence(org.mifos.customers.office.persistence.OfficePersistence)

Example 38 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class TagGeneratorIntegrationTest method createPersonnel.

private PersonnelBO createPersonnel(OfficeBO office, PersonnelLevel personnelLevel) throws Exception {
    List<CustomFieldDto> customFieldDto = new ArrayList<CustomFieldDto>();
    customFieldDto.add(new CustomFieldDto(Short.valueOf("9"), "123456", CustomFieldType.NUMERIC.getValue()));
    Address address = new Address("abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd", "abcd");
    Name name = new Name("XYZ", null, null, null);
    java.util.Date date = new java.util.Date();
    personnel = new PersonnelBO(personnelLevel, office, Integer.valueOf("1"), Short.valueOf("1"), "ABCD", "XYZ", "xyz@yahoo.com", null, customFieldDto, name, "111111", date, Integer.valueOf("1"), Integer.valueOf("1"), date, date, address, userContext.getId(), new Date(), new HashSet());
    IntegrationTestObjectMother.createPersonnel(personnel);
    return IntegrationTestObjectMother.findPersonnelById(personnel.getPersonnelId());
}
Also used : Address(org.mifos.framework.business.util.Address) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) Date(java.util.Date) CustomFieldDto(org.mifos.dto.domain.CustomFieldDto) ArrayList(java.util.ArrayList) Date(java.util.Date) Name(org.mifos.framework.business.util.Name) HashSet(java.util.HashSet)

Example 39 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class CenterUpdateUsingCustomerServiceIntegrationTest method cleanDatabaseTables.

@Before
public void cleanDatabaseTables() {
    databaseCleaner.clean();
    // setup
    String centerName = "Center-IntegrationTest";
    OfficeBO existingBranch = sampleBranchOffice();
    PersonnelBO existingLoanOfficer = testUser();
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    DateTime today = new DateTime();
    Address noAddress = null;
    String noExternalId = null;
    center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(today).with(noAddress).withExternalId(noExternalId).withUserContext().build();
    IntegrationTestObjectMother.createCenter(center, center.getCustomerMeetingValue());
    otherLoanOfficer = new PersonnelBuilder().withUsername("CenterUpdateUsingCustomerServiceIntegrationTest").withDisplayName("otherLoanOfficer").with(existingBranch).build();
    IntegrationTestObjectMother.createPersonnel(otherLoanOfficer);
}
Also used : PersonnelBuilder(org.mifos.domain.builders.PersonnelBuilder) Address(org.mifos.framework.business.util.Address) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Example 40 with Address

use of org.mifos.framework.business.util.Address in project head by mifos.

the class PersonnelServiceFacadeWebTier method updatePersonnel.

@Override
public UserDetailDto updatePersonnel(CreateOrUpdatePersonnelInformation personnel) {
    MifosUser user = (MifosUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    UserContext userContext = new UserContextFactory().create(user);
    PersonnelBO userForUpdate = this.personnelDao.findPersonnelById(personnel.getId().shortValue());
    userForUpdate.updateDetails(userContext);
    AddressDto addressDto = personnel.getAddress();
    Address address = new Address(addressDto.getLine1(), addressDto.getLine2(), addressDto.getLine3(), addressDto.getCity(), addressDto.getState(), addressDto.getCountry(), addressDto.getZip(), addressDto.getPhoneNumber());
    PersonnelStatus status = PersonnelStatus.getPersonnelStatus(personnel.getPersonnelStatusId());
    PersonnelLevel userHierarchyLevel = PersonnelLevel.fromInt(personnel.getPersonnelLevelId().intValue());
    OfficeBO newOffice = this.officeDao.findOfficeById(personnel.getOfficeId());
    validateForUpdate(userForUpdate, status, newOffice, userHierarchyLevel);
    List<RoleBO> selectedRoles = new ArrayList<RoleBO>();
    try {
        List<RoleBO> allRoles = new PersonnelBusinessService().getRoles();
        for (RoleBO role : allRoles) {
            if (isRoleSelected(role, personnel.getRoles())) {
                selectedRoles.add(role);
            }
        }
        PersonnelStatusEntity personnelStatus = legacyMasterDao.getPersistentObject(PersonnelStatusEntity.class, status.getValue());
        PersonnelLevelEntity personnelLevel = legacyMasterDao.getPersistentObject(PersonnelLevelEntity.class, userHierarchyLevel.getValue());
        Short preferredLocaleId = personnel.getPreferredLocale();
        transactionHelper.startTransaction();
        transactionHelper.beginAuditLoggingFor(userForUpdate);
        userForUpdate.updateUserDetails(personnel.getFirstName(), personnel.getMiddleName(), personnel.getSecondLastName(), personnel.getLastName(), personnel.getEmailId(), personnel.getGender(), personnel.getMaritalStatus(), preferredLocaleId, personnelStatus, address, personnel.getTitle(), personnelLevel, selectedRoles, newOffice);
        userForUpdate.getPersonnelDetails().setDob(personnel.getDob().toDate());
        userForUpdate.setPasswordExpirationDate(personnel.getPasswordExpirationDate().toDate());
        if (!StringUtils.isEmpty(personnel.getPassword())) {
            this.personelService.changePassword(userForUpdate, personnel.getPassword(), false);
        }
        this.personnelDao.save(userForUpdate);
        transactionHelper.commitTransaction();
        return userForUpdate.toDto();
    } catch (BusinessRuleException e) {
        transactionHelper.rollbackTransaction();
        throw e;
    } catch (PersistenceException e) {
        transactionHelper.rollbackTransaction();
        throw new MifosRuntimeException(e);
    } catch (Exception e) {
        transactionHelper.rollbackTransaction();
        throw new MifosRuntimeException(e);
    } finally {
        transactionHelper.closeSession();
    }
}
Also used : PersonnelBusinessService(org.mifos.customers.personnel.business.service.PersonnelBusinessService) Address(org.mifos.framework.business.util.Address) UserContext(org.mifos.security.util.UserContext) ArrayList(java.util.ArrayList) MifosUser(org.mifos.security.MifosUser) UserContextFactory(org.mifos.accounts.servicefacade.UserContextFactory) AddressDto(org.mifos.dto.domain.AddressDto) PersonnelLevelEntity(org.mifos.customers.personnel.business.PersonnelLevelEntity) ValidationException(org.mifos.framework.exceptions.ValidationException) BusinessRuleException(org.mifos.service.BusinessRuleException) MifosRuntimeException(org.mifos.core.MifosRuntimeException) PersistenceException(org.mifos.framework.exceptions.PersistenceException) ServiceException(org.mifos.framework.exceptions.ServiceException) MeetingException(org.mifos.application.meeting.exceptions.MeetingException) PersonnelStatusEntity(org.mifos.customers.personnel.business.PersonnelStatusEntity) PersonnelStatus(org.mifos.customers.personnel.util.helpers.PersonnelStatus) BusinessRuleException(org.mifos.service.BusinessRuleException) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersistenceException(org.mifos.framework.exceptions.PersistenceException) PersonnelLevel(org.mifos.customers.personnel.util.helpers.PersonnelLevel) RoleBO(org.mifos.security.rolesandpermission.business.RoleBO) MifosRuntimeException(org.mifos.core.MifosRuntimeException)

Aggregations

Address (org.mifos.framework.business.util.Address)42 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)22 ArrayList (java.util.ArrayList)17 OfficeBO (org.mifos.customers.office.business.OfficeBO)17 AddressDto (org.mifos.dto.domain.AddressDto)16 CustomFieldDto (org.mifos.dto.domain.CustomFieldDto)14 DateTime (org.joda.time.DateTime)11 Date (java.util.Date)10 MifosRuntimeException (org.mifos.core.MifosRuntimeException)10 UserContext (org.mifos.security.util.UserContext)9 MeetingBO (org.mifos.application.meeting.business.MeetingBO)8 ClientNameDetailDto (org.mifos.dto.screen.ClientNameDetailDto)8 MifosUser (org.mifos.security.MifosUser)8 BusinessRuleException (org.mifos.service.BusinessRuleException)8 CustomerException (org.mifos.customers.exceptions.CustomerException)7 Name (org.mifos.framework.business.util.Name)7 HashSet (java.util.HashSet)5 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)5 ClientBO (org.mifos.customers.client.business.ClientBO)5 ApplicableAccountFeeDto (org.mifos.dto.domain.ApplicableAccountFeeDto)5