Пример #1
0
 public Country(
     Planet parent,
     String iso3166alpha2Code,
     String iso3166alpha3Code,
     Integer iso3166numericCode,
     LocalizedString name,
     LocalizedString nationality,
     Class<AddressPrinter> iAddressPrinter) {
   super();
   setBennu(Bennu.getInstance());
   setUnit(
       Unit.create(
           parent.getUnit(),
           name,
           iso3166alpha3Code,
           getPartyType("País", COUNTRY_PARTYTYPE_NAME),
           getOrCreateAccountabilityType(),
           new LocalDate(),
           null,
           null));
   setIso3166alpha2Code(iso3166alpha2Code);
   setIAddressPrinter(iAddressPrinter);
   setIso3166alpha3Code(iso3166alpha3Code);
   setIso3166numericCode(iso3166numericCode);
   setNationality(nationality);
 }
Пример #2
0
  @Atomic
  public AddressPrinter getAddressPrinter() {
    if (super.getIAddressPrinter() == null) {
      setIAddressPrinter(AddressPrinter.class);
    }

    AddressPrinter ap = null;
    try {
      ap = (AddressPrinter) super.getIAddressPrinter().getConstructor().newInstance();
    } catch (Exception e) {
      throw new GeographyDomainException("error.instance.iaddressprinter", e);
    }

    return ap;
    // try {
    // return (AddressPrinter)
    // super.getIAddressPrinter().getConstructor().newInstance();
    // } catch (Exception e) {
    // setIAddressPrinter(GeneralIAddressPrinter.class);
    // throw new DomainException("error.instance.iaddressprinter", e);
    // }
  }
Пример #3
0
 public void update(
     Planet parent,
     String iso3166alpha2Code,
     String iso3166alpha3Code,
     Integer iso3166numericCode,
     LocalizedString name,
     LocalizedString nationality,
     Class<AddressPrinter> iAddressPrinter) {
   if (!same(getIso3166alpha2Code(), iso3166alpha2Code)
       || !same(getIso3166alpha3Code(), iso3166alpha3Code)
       || !same(getIso3166numericCode(), iso3166numericCode)
       || !same(getName(), name)
       || !same(getNationality(), nationality)
       || !same(getIAddressPrinter(), iAddressPrinter)) {
     final AccountabilityType type = getOrCreateAccountabilityType();
     getUnit()
         .getParentAccountabilityStream()
         .filter(a -> a.getAccountabilityType() == type)
         .forEach(a -> a.editDates(new LocalDate(), null, null));
     setUnit(
         Unit.create(
             parent.getUnit(),
             name,
             iso3166alpha3Code,
             getPartyType("País", COUNTRY_PARTYTYPE_NAME),
             getOrCreateAccountabilityType(),
             new LocalDate(),
             null,
             null));
     setIso3166alpha2Code(iso3166alpha2Code);
     setIAddressPrinter(iAddressPrinter);
     setIso3166alpha3Code(iso3166alpha3Code);
     setIso3166numericCode(iso3166numericCode);
     setNationality(nationality);
   }
 }
Пример #4
0
  public Country(
      Planet parent,
      LocalizedString name,
      String acronym,
      Class iAddressPrinter,
      CountrySubdivisionLevelName... subdivisionNames) {
    super();
    setBennu(Bennu.getInstance());

    setIAddressPrinter(iAddressPrinter);
    setUnit(
        Unit.create(
            parent.getUnit(),
            name,
            acronym,
            getPartyType("País", COUNTRY_PARTYTYPE_NAME),
            getOrCreateAccountabilityType(),
            new LocalDate(),
            null,
            null));
    for (CountrySubdivisionLevelName subdivisionName : subdivisionNames) {
      addLevelName(subdivisionName);
    }
  }