/** Populates the flight extra content */
  @Override
  public void populate(final Object source, final ContentViewData target) {
    // REVISIT:Changed to BasePackage
    final BasePackage packageModel = packageCartService.getBasePackage();
    final FlightExtraFacilityStore flightExtraStore =
        sessionService.getAttribute(SessionObjectKeys.FLIGHT_EXTRA_FACILITY_STORE);
    String flightMealCode = StringUtils.EMPTY;
    if (flightExtraStore != null) {
      String inventoryCode = StringUtils.EMPTY;
      final Map<String, List<ExtraFacility>> validExtraFacilitiesMap =
          flightExtraStore.getExtraFacilityFromAllLegsBasedOnCabinClass(
              packageModel.getId(), PackageUtilityService.getCabinClass(packageModel));
      for (final List<ExtraFacility> eachEntry : validExtraFacilitiesMap.values()) {
        inventoryCode = eachEntry.get(0).getExtraFacilityCategory().getInventoryCode();
        final String extraCode = eachEntry.get(0).getExtraFacilityCode();
        final String corporateCode = eachEntry.get(0).getCorporateCode();
        final List<DynamicContentConfigModel> dynamicContents =
            genericContentService.getDynamicContentConfig(inventoryCode, extraCode, corporateCode);

        getDynamicContents(target, dynamicContents);
      }
      if (StringUtils.equalsIgnoreCase(inventoryCode, "FM")) {
        flightMealCode = inventoryCode;
      }

      final Leg leg = getFlightLeg(packageModel);
      populateContentForShortHaul(target, leg);
      populateMealContent(flightMealCode, target);
    }
  }
  /**
   * Populate.
   *
   * @param source the source
   * @param target the target
   * @throws ConversionException the conversion exception
   */
  public void populate(final BasePackage source, final List<PriceBreakDownViewData> target)
      throws ConversionException {

    final PriceBreakDownViewData basicPrice = new PriceBreakDownViewData();
    final PriceBreakDownViewData extrasPrice = new PriceBreakDownViewData();
    final PriceBreakDownViewData onlineDiscount = new PriceBreakDownViewData();
    final PriceBreakDownViewData totalPrice = new PriceBreakDownViewData();

    BigDecimal viewDataBasicPrice = priceCalculationService.calculateBasicCost(source);

    BigDecimal viewDataOnlineDiscountPrice =
        source.getDiscount().getPrice().getAmount().getAmount();
    if (viewDataOnlineDiscountPrice.signum() == -1) {
      viewDataOnlineDiscountPrice = viewDataOnlineDiscountPrice.negate();
    }
    final String defaultCurrencyCode = currencyResolver.getSiteCurrency();
    basicPrice.setDescription(getDescription("BASICHOLIDAY"));
    if (!PackageUtilityService.isMulticomThirdPartyFlight(
            packageComponentService.getFlightItinerary(source))
        && viewDataOnlineDiscountPrice.compareTo(BigDecimal.ZERO) > 0) {
      viewDataBasicPrice =
          viewDataBasicPrice.add(viewDataOnlineDiscountPrice).setScale(TWO, RoundingMode.HALF_UP);
      onlineDiscount.setDescription(getDescription("ONLINEDISCOUNT"));

      onlineDiscount.setPrice(viewDataOnlineDiscountPrice.setScale(TWO, RoundingMode.HALF_UP));
      onlineDiscount.setCurrencyAppendedPrice(
          "-"
              + " "
              + CurrencyUtils.getCurrencySymbol(defaultCurrencyCode)
              + (viewDataOnlineDiscountPrice.setScale(TWO, RoundingMode.HALF_UP)).toString());
      target.add(onlineDiscount);
    }
    basicPrice.setPrice(viewDataBasicPrice.setScale(TWO, RoundingMode.HALF_UP));
    basicPrice.setCurrencyAppendedPrice(
        CurrencyUtils.getCurrencySymbol(defaultCurrencyCode)
            + viewDataBasicPrice.setScale(TWO, RoundingMode.HALF_UP).toString());
    target.add(basicPrice);
    extrasPrice.setDescription(getDescription("OPTION&EXTRAS"));
    extrasPrice.setPrice(priceCalculationService.calculateExtraFacilitiesTotalCost(source));
    extrasPrice.setCurrencyAppendedPrice(
        CurrencyUtils.getCurrencySymbol(defaultCurrencyCode)
            + extrasPrice.getPrice().setScale(TWO, RoundingMode.HALF_UP));

    totalPrice.setDescription(getDescription("TOTALPRICE"));
    totalPrice.setPrice(
        source.getPrice().getAmount().getAmount().setScale(TWO, RoundingMode.HALF_UP));
    totalPrice.setCurrencyAppendedPrice(
        CurrencyUtils.getCurrencySymbol(defaultCurrencyCode)
            + (source.getPrice().getAmount().getAmount().setScale(TWO, RoundingMode.HALF_UP))
                .toString());
    target.add(extrasPrice);

    populateCardChargesIfApplicable(source.getBookingDetails(), target);
    populatePromotionalChargesIfApplicable(source.getPromotionalDiscount(), target);
    target.add(totalPrice);
  }