Search in sources :

Example 1 with PositionEntity

use of org.mifos.customers.business.PositionEntity in project head by mifos.

the class CenterServiceFacadeWebTier method generatePositionsFromExistingCustomerPositions.

private void generatePositionsFromExistingCustomerPositions(CustomerBO customer, List<PositionEntity> customerPositions, List<CustomerPositionDto> customerPositionDtos) {
    for (PositionEntity position : customerPositions) {
        for (CustomerPositionEntity entity : customer.getCustomerPositions()) {
            if (position.getId().equals(entity.getPosition().getId())) {
                CustomerPositionDto customerPosition;
                if (entity.getCustomer() != null) {
                    customerPosition = new CustomerPositionDto(entity.getCustomer().getCustomerId(), entity.getPosition().getId(), entity.getPosition().getName());
                } else {
                    customerPosition = new CustomerPositionDto(customer.getCustomerId(), entity.getPosition().getId(), entity.getPosition().getName());
                }
                customerPositionDtos.add(customerPosition);
            }
        }
    }
}
Also used : CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) PositionEntity(org.mifos.customers.business.PositionEntity) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto)

Example 2 with PositionEntity

use of org.mifos.customers.business.PositionEntity in project head by mifos.

the class GroupServiceFacadeWebTier method generatePositionsFromExistingCustomerPositions.

private void generatePositionsFromExistingCustomerPositions(CustomerBO customer, List<PositionEntity> customerPositions, List<CustomerPositionDto> customerPositionDtos) {
    for (PositionEntity position : customerPositions) {
        for (CustomerPositionEntity entity : customer.getCustomerPositions()) {
            if (position.getId().equals(entity.getPosition().getId())) {
                CustomerPositionDto customerPosition;
                if (entity.getCustomer() != null) {
                    customerPosition = new CustomerPositionDto(entity.getCustomer().getCustomerId(), entity.getPosition().getId(), entity.getPosition().getName());
                } else {
                    customerPosition = new CustomerPositionDto(customer.getCustomerId(), entity.getPosition().getId(), entity.getPosition().getName());
                }
                customerPositionDtos.add(customerPosition);
            }
        }
    }
}
Also used : CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) PositionEntity(org.mifos.customers.business.PositionEntity) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto)

Example 3 with PositionEntity

use of org.mifos.customers.business.PositionEntity in project head by mifos.

the class GroupServiceFacadeWebTier method generateNewListOfPositions.

private void generateNewListOfPositions(CustomerBO customer, List<PositionEntity> customerPositions, List<CustomerPositionDto> customerPositionDtos) {
    for (PositionEntity position : customerPositions) {
        CustomerPositionDto customerPosition = new CustomerPositionDto(customer.getCustomerId(), position.getId(), position.getName());
        customerPositionDtos.add(customerPosition);
    }
}
Also used : CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) PositionEntity(org.mifos.customers.business.PositionEntity) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto)

Example 4 with PositionEntity

use of org.mifos.customers.business.PositionEntity in project head by mifos.

the class CustomerServiceImpl method assembleCustomerPostionsFromDto.

private void assembleCustomerPostionsFromDto(List<CustomerPositionDto> customerPositions, CustomerBO customer) {
    for (CustomerPositionDto positionView : customerPositions) {
        boolean isPositionFound = false;
        for (CustomerPositionEntity positionEntity : customer.getCustomerPositions()) {
            if (positionView.getPositionId().equals(positionEntity.getPosition().getId())) {
                CustomerBO customerInPosition = null;
                if (positionView.getCustomerId() != null) {
                    customerInPosition = customerDao.findCustomerById(positionView.getCustomerId());
                }
                positionEntity.setCustomer(customerInPosition);
                isPositionFound = true;
                break;
            }
        }
        if (!isPositionFound) {
            CustomerBO customerInPosition = null;
            if (positionView.getCustomerId() != null) {
                customerInPosition = customerDao.findCustomerById(positionView.getCustomerId());
            }
            CustomerPositionEntity customerPosition = new CustomerPositionEntity(new PositionEntity(positionView.getPositionId()), customerInPosition, customer);
            customer.addCustomerPosition(customerPosition);
        }
    }
}
Also used : CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) PositionEntity(org.mifos.customers.business.PositionEntity) CustomerBO(org.mifos.customers.business.CustomerBO) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto)

Example 5 with PositionEntity

use of org.mifos.customers.business.PositionEntity in project head by mifos.

the class CenterServiceFacadeWebTier method generateNewListOfPositions.

private void generateNewListOfPositions(CustomerBO customer, List<PositionEntity> customerPositions, List<CustomerPositionDto> customerPositionDtos) {
    for (PositionEntity position : customerPositions) {
        CustomerPositionDto customerPosition = new CustomerPositionDto(customer.getCustomerId(), position.getId(), position.getName());
        customerPositionDtos.add(customerPosition);
    }
}
Also used : CustomerPositionEntity(org.mifos.customers.business.CustomerPositionEntity) PositionEntity(org.mifos.customers.business.PositionEntity) CustomerPositionDto(org.mifos.dto.domain.CustomerPositionDto)

Aggregations

CustomerPositionEntity (org.mifos.customers.business.CustomerPositionEntity)9 PositionEntity (org.mifos.customers.business.PositionEntity)9 CustomerPositionDto (org.mifos.dto.domain.CustomerPositionDto)5 Test (org.junit.Test)4 AccountStateEntity (org.mifos.accounts.business.AccountStateEntity)3 CustomerFlagDetailEntity (org.mifos.customers.business.CustomerFlagDetailEntity)3 ArrayList (java.util.ArrayList)2 CustomerDetailDto (org.mifos.dto.domain.CustomerDetailDto)2 CustomerPositionOtherDto (org.mifos.dto.domain.CustomerPositionOtherDto)2 Ignore (org.junit.Ignore)1 CustomerBO (org.mifos.customers.business.CustomerBO)1 GroupInformationDto (org.mifos.dto.screen.GroupInformationDto)1