Package honeycrm.client.dto

Examples of honeycrm.client.dto.Dto


      }
    });   
  }
 
  public void testCreate() throws InterruptedException {
    final Dto d = new Dto(module);
    d.set("name", "Test Name");
    d.set("email", "foo@example.com");
   
    expect(view.getData()).andReturn(d);

    replay(view);
    replay(createService);
View Full Code Here


    this.presenter = new DetailPresenter(eventBus, module, readService, updateService, createService, view);
    presenter.onSave();
  }
 
  public void testUpdate() {
    final Dto d = new Dto(module);
    d.set("name", "Test Name");
    d.set("email", "foo@example.com");
    d.setId(10L);
   
    expect(view.getData()).andReturn(d);

    updateService.update(isA(Dto.class), isA(AsyncCallback.class));
    expectLastCall().andAnswer(new IAnswer<Object>() {
View Full Code Here

   
  public void testOpenEvent() {
    replay(view);
    presenter = new DetailPresenter(eventBus, module, readService, updateService, createService, view);
   
    final Dto d = new Dto("Contact");
    d.setId(23L);
    eventBus.fireEvent(new OpenEvent(d));
  }
View Full Code Here

      return fail(login);
    } else if (login.equals("42")) { // allow creating employees in the first place using the "42" login
      return 42L;
    } else {
      // TODO use real auth framework to check credentials. for now only search an employee with the specified login name.
      final Dto userDto = reader.getByName(Employee.class.getSimpleName(), login);

      if (null == userDto) {
        return fail(login);
      } else {
        return userDto.getId();
      }
    }
  }
View Full Code Here

        id = -1;
      }
      response.setContentType("application/pdf");
      response.setHeader("Content-Disposition", "inline; filename=" + module + ".pdf"); // TODO add more information about the entity into the filename.

      final Dto dto = readService.get(module, id);
      final ModuleDto moduleDto = config.getModuleDtos().get(module);

      document.add(new Paragraph(moduleDto.getTitle(), new Font(FontFamily.HELVETICA, 20, Font.BOLD)));
     
      for (final Entry<String, Serializable> entry : dto.getAllData().entrySet()) {
        if ("id".equals(entry.getKey()) || entry.getKey().endsWith("_resolved")) {
          continue;
        }
        final String label = moduleDto.getFieldById(entry.getKey()).getLabel();
        final String value;
       
        if (dto.getAllData().containsKey(entry.getKey() + "_resolved")) {
          final Dto resolved = (Dto) dto.getAllData().get(entry.getKey() + "_resolved");
          value = String.valueOf(resolved.get("name"));
        } else {
          value = null == entry.getValue() ? "-" : String.valueOf(entry.getValue());
        }

        if (entry.getValue() instanceof List<?>) {
          if (!((List<?>)entry.getValue() ).isEmpty()) {
            final List<Dto> list = (List<Dto>) entry.getValue();
            final ModuleDto listModuleDto = config.getModuleDtos().get(list.get(0).getModule());
           
            PdfPTable table = new PdfPTable(listModuleDto.getListFieldIds().length);
            table.setHeaderRows(1);

            for (final String col: listModuleDto.getListFieldIds()) {
              final String colHeader = listModuleDto.getFieldById(col).getLabel();
              table.addCell(new Phrase(colHeader, new Font(FontFamily.HELVETICA, 12, Font.BOLD)));
            }
           
            for (int i = 0; i < list.size(); i++) {
              for (final String col: listModuleDto.getListFieldIds()) {
                final String colValue;
               
                if (list.get(i).getAllData().containsKey(col + "_resolved")) {
                  final Dto resolved = (Dto) list.get(i).get(col + "_resolved");
                  colValue = String.valueOf(resolved.get("name"));
                } else {
                  colValue = String.valueOf(list.get(i).get(col));
                }

                if ("true".equals(colValue) || "false".equals(colValue)) {
View Full Code Here

    for (int i = 0; i < 50; i++) {
      final int childCountFoo = 2; // r.nextInt(20);
      final int childCountBar = 1; // r.nextInt(20);
      final int childCountBaz = 0; // r.nextInt(20);

      final Dto foo = DemoDataProvider.getOffering(1, childCountFoo);
      final Dto bar = DemoDataProvider.getOffering(2, childCountBar);
      final Dto baz = DemoDataProvider.getOffering(3, childCountBaz);

      final long idFoo = createService.create(foo);
      final long idBar = createService.create(bar);
      final long idBaz = createService.create(baz);

      final Dto dtoFoo = readService.get(Offering.class.getSimpleName(), idFoo);
      final Dto dtoBar = readService.get(Offering.class.getSimpleName(), idBar);
      final Dto dtoBaz = readService.get(Offering.class.getSimpleName(), idBaz);

      assertEquals(childCountFoo, ((List<?>) dtoFoo.get("uniqueServices")).size());
      assertEquals(childCountBar, ((List<?>) dtoBar.get("uniqueServices")).size());
      assertTrue(((List<?>)dtoBaz.get("uniqueServices")).isEmpty());
    }
  }
View Full Code Here

  public void testCreateOfferings() {
    final Set<Long> productIds = createProducts();
   
    for (int i = 0; i < 10; i++) {
      final ArrayList<Dto> services = getServices(productIds);
      final Dto offering = getOffering(services);

      final long id = createService.create(offering);

      final Dto o = readService.get(Offering.class.getSimpleName(), id);
      assertNotNull(o.get("deadline"));
      assertNotNull(o.get("uniqueServices"));
      assertEquals(productIds.size(), ((Collection<Dto>) o.get("uniqueServices")).size());
    }
  }
View Full Code Here

      assertEquals(productIds.size(), ((Collection<Dto>) o.get("uniqueServices")).size());
    }
  }

  private Dto getOffering(final ArrayList<Dto> services) {
    final Dto offering = new Dto();
    offering.setModule(Offering.class.getSimpleName());
    offering.set("deadline", new Date(System.currentTimeMillis()));
    offering.set("uniqueServices", services);
    return offering;
  }
View Full Code Here

  private ArrayList<Dto> getServices(final Set<Long> productIds) {
    final ArrayList<Dto> services = new ArrayList<Dto>();

    for (final Long productId : productIds) {
      final Dto s = new Dto();
      s.setModule(UniqueService.class.getSimpleName());
      s.set("productID", productId);
      services.add(s);
    }

    return services;
  }
View Full Code Here

    if (!"Offering".equals(offering.getModule())) {
      LogConsole.log("This is no offering dto object: '" + offering.getModule() + "'");
      return;
    }
   
    final Dto contract = offering.copy();
    contract.setModule("Contract");
   
    linkOfferingToContract(offering, contract);
  }
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.