Package honeycrm.client.dto

Examples of honeycrm.client.dto.Dto


          final Iterable<Key> keys = (Iterable<Key>) entity.getProperty(field);

          if (null != keys) {
            for (final Map.Entry<Key, Entity> entry : db.get(keys).entrySet()) {
              final String kindOfChild = entry.getValue().getKind();
              final Dto child = entityToDto(kindOfChild, entry.getValue(), false);
              children.add(child);
            }
          }

          dto.set(field, children);
View Full Code Here


          log.warning("Expected instance of " + Key.class + ". Found " + entity.getProperty(fieldName).getClass() + ". Skipping field.");
        } else {
          final long id = ((Key) entity.getProperty(fieldName)).getId();

          if (id > 0) {
            /**
             * retrieve the referenced entity and copy its dto representation as an additional field into the originating dto object.
             */
            final Dto relatedEntity = get(relatedEntityName, id, 1 + resolvDepth);

            if (null == relatedEntity) {
              log.warning(dto.getModule() + "/" + dto.getId() + " references a no-longer existing entity " + relatedEntityName + "/" + id);
              dto.set(fieldName, 0);
              // TODO should we persist this change of the Dto object?
            } else {
              dto.set(fieldName, relatedEntity.getId());
              dto.set(fieldName + "_resolved", relatedEntity);
            }
          }
        }
      }
View Full Code Here

// class.
public class DemoDataProvider {
  private final static Random r = new Random();

  public static Dto account() {
    final Dto a = new Dto(Account.class.getSimpleName());

    a.set("name", DemoDataHolder.getRandomName());
    a.set("annualRevenue", r.nextLong() % 1000000000);
    a.set("billingAddress", DemoDataHolder.getRandomAddress());
    a.set("shippingAddress", DemoDataHolder.getRandomAddress());

    return a;
  }
View Full Code Here

    return a;
  }

  public static Dto contact() {
    final Dto c = new Dto(Contact.class.getSimpleName());

    c.set("name", (DemoDataHolder.getRandomName()));
    c.set("email", (DemoDataHolder.getRandomEmail()));
    c.set("city", (DemoDataHolder.getRandomAddress()));
    c.set("phone", (DemoDataHolder.getRandomPhoneNumber()));

    return c;
  }
View Full Code Here

    return str;
  }

  public static List<Dto> getProducts(final int count) {
    final List<Dto> products = new ArrayList<Dto>(count);
    final Dto product = new Dto();
    product.setModule(Product.class.getSimpleName());

    for (int i = 0; i < count; i++) {
      product.set("name", DemoDataHolder.getRandomProductName());
      product.set("price", r.nextDouble());
      products.add(product);
    }

    return products;
  }
View Full Code Here

    return sum;
  }

  public static Dto getService(final int name) {
    final Dto service = new Dto();
    service.setModule(UniqueService.class.getSimpleName());
    service.set("name", "service " + name);
    return service;
  }
View Full Code Here

  }
 
 

  public static Dto getOffering(final int name, final int childCount) {
    final Dto offering = new Dto();
    offering.setModule(Offering.class.getSimpleName());
    offering.set("name", "offering " + name);
    offering.set("uniqueServices", getServices(childCount));
    return offering;
  }
View Full Code Here

    DtoModuleRegistry.create(NewDtoWizard.getConfiguration());
  }

  public void testExport() {
    final List<Dto> list = new LinkedList<Dto>();
    final Dto foo = new Dto();
    foo.setModule("Contact");
    foo.set("name", "Foo");
    final Dto bar = new Dto();
    bar.setModule("Contact");
    bar.set("name", "Bar");
    list.add(foo);
    list.add(bar);

    final CsvExporter exporter = new CsvExporter();
    final String csv = exporter.export(list);
View Full Code Here

  public void testParsing() {
    assertEquals(0, presenter.getDtoArrayFromText("").length);
  }

  public void testImportOne() {
    final Dto contact = new Dto(Contact.class.getSimpleName());
    contact.set("name", "Mike");
    presenter.importDto(new Dto[] { contact }, 0);
  }
View Full Code Here

  public void testImportMore() {
    final int count = 10000;
    final Dto[] contacts = new Dto[count];
    for (int i = 0; i < count; i++) {
      contacts[i] = new Dto(Contact.class.getSimpleName());
      contacts[i].set("name", "Mike" + i);
    }
    presenter.importDto(contacts, 0);
  }
View Full Code Here

TOP

Related Classes of honeycrm.client.dto.Dto

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.