private void addCouponCondition(
     final ConditionsDTO conditionsDto, final BooleanComponentDTO couponConditionDTO) {
   if (couponConditionDTO != null) {
     final BooleanComponentDTO highLevelAndDTO = new AndDTO();
     highLevelAndDTO.setComponents(
         Arrays.asList(couponConditionDTO, conditionsDto.getConditionsComposite()));
     conditionsDto.setConditionsComponent(highLevelAndDTO);
   }
 }
  /**
   * Creates populated ConditionsDTO from Rule eligibilities and conditions.
   *
   * @param source rule containing conditions and eligibilities
   * @return ConditionsDTO containing conditions and eligibilities
   */
  ConditionsDTO createConditionsDTO(final Rule source) {
    final ConditionsDTO conditionsDto = new ConditionsDTO();

    final List<RuleCondition> conditions = new ArrayList<RuleCondition>(source.getConditions());
    final BooleanComponentDTO limitedConditionDTO = retrieveLimitedUsageCondition(conditions);
    final BooleanComponentDTO couponCodeDTO = retrieveCouponCodeCondition(conditions);

    if (!conditions.isEmpty()) {
      final BooleanComponentDTO eligibilitiesAndConditionsDTO = new AndDTO();
      eligibilitiesAndConditionsDTO.setComponents(
          Arrays.asList(createConditionComposition(conditions, source.getConditionOperator())));
      conditionsDto.setConditionsComponent(eligibilitiesAndConditionsDTO);
    }

    addCouponCondition(conditionsDto, couponCodeDTO);
    addLimitedCondition(conditionsDto, limitedConditionDTO);

    return conditionsDto;
  }