Package org.openbravo.model.common.geography

Examples of org.openbravo.model.common.geography.Country


   * Tests Access Level System Client.
   */
  public void testAccessLevelSC() {
    setUserContext("0");
    final Organization o = OBDal.getInstance().get(Organization.class, "1000001");
    final Country c = OBDal.getInstance().get(Country.class, "100");
    c.setOrganization(o);

    try {
      commitTransaction();
      fail("The organization of a system client may not be set to a non-zero org.");
    } catch (final OBException e) {
View Full Code Here


  /**
   * Builds the testdata, {@link CountryTrl} objects for a specific {@link Country}.
   */
  public void testACreateCountryTrl() {
    setUserContext("0");
    final Country country = getCountry("Norway");
    final OBCriteria<CountryTrl> obc = OBDal.getInstance().createCriteria(CountryTrl.class);
    obc.add(Expression.eq("country", country));
    final List<CountryTrl> countryTrls = obc.list();
    if (countryTrls.size() > 0) {
      return;
    }

    final OBCriteria<Language> languageCriteria = OBDal.getInstance()
        .createCriteria(Language.class);
    final List<Language> languages = languageCriteria.list();
    int created = 0;
    for (final Language l : languages) {
      final CountryTrl countryTrl = OBProvider.getInstance().get(CountryTrl.class);
      countryTrl.setCountry(country);
      countryTrl.setLanguage(l);
      countryTrl.setDescription(country.getDescription());
      countryTrl.setName(country.getName());
      countryTrl.setRegionName(country.getRegionName());
      countryTrl.setAddressPrintFormat("test");
      countryTrl.setActive(true);
      // countryTrl.setDescription(getName())isplaySequence(country.getDisplaySequence());
      OBDal.getInstance().save(countryTrl);
      created++;
View Full Code Here

    addReadWriteAccess(Country.class);
    final List<Country> countries = OBDal.getInstance().createCriteria(Country.class).list();
    assertTrue(countries.size() > 0);
    for (final Country c : countries) {
      // make copy to not interfere with hibernate's auto update mechanism
      final Country copy = (Country) DalUtil.copy(c);
      copy.setId("test");
      final List<BaseOBObject> queried = OBDal.getInstance().findUniqueConstrainedObjects(copy);
      assertEquals(1, queried.size());
      assertEquals(c.getId(), queried.get(0).getId());
    }
  }
View Full Code Here

TOP

Related Classes of org.openbravo.model.common.geography.Country

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.