示例#1
0
  @Programmatic
  public List<Charge> chargesForCountry(final String applicationTenancyPath) {

    // assert the path (must not be root)
    final String countryPath = ApplicationTenancyLevel.of(applicationTenancyPath).getCountryPath();

    final List<Charge> charges = allInstances();
    return Lists.newArrayList(
        Iterables.filter(
            charges,
            new Predicate<Charge>() {
              @Override
              public boolean apply(final Charge charge) {
                final ApplicationTenancyLevel chargeLevel = ApplicationTenancyLevel.of(charge);
                return chargeLevel.isRoot()
                    || chargeLevel.isCountry()
                        && chargeLevel.getPath().equalsIgnoreCase(countryPath);
              }
            }));
  }
示例#2
0
 @Programmatic
 public List<Charge> chargesForCountry(final ApplicationTenancy countryOrLowerLevel) {
   final ApplicationTenancyLevel level = ApplicationTenancyLevel.of(countryOrLowerLevel);
   final String countryPath = level.getCountryPath();
   return chargesForCountry(countryPath);
 }