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); } } } }
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); } }
private List<PositionEntity> populateWithNonCenterRelatedPositions( List<PositionEntity> allCustomerPositions) { List<PositionEntity> nonCenterRelatedPositions = new ArrayList<PositionEntity>(); for (PositionEntity positionEntity : allCustomerPositions) { if (!(positionEntity.getId().equals(Short.valueOf("1")) || positionEntity.getId().equals(Short.valueOf("2")))) { nonCenterRelatedPositions.add(positionEntity); } } return nonCenterRelatedPositions; }