Examples of ItemDTO


Examples of net.stinfoservices.pacifiq.shared.dto.inner.ItemDTO

    }

    @Override
    public ItemDTO loadItem(Long id) throws Exception {
        ServiceSecurityHelper.hasAuthority(ProfileHelper.ADMINISTRATOR, getSession());
        return new ItemDTO(itemDAO.find(id), DTOPath.ITEM_WITH_DSP5_LINK);
    }
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.ItemDTO

            if (!path.accept(DTOPath.PROGRAM_GC_FOR_LAUNCH)) {
                items = new HashSet<ItemDTO>();
                if (dsp5.getItems() != null) {
                    for (Item item : dsp5.getItems()) {
                        items.add(new ItemDTO(item, path));
                    }
                }
            }
        }

        if (path.accept(DTOPath.DSP5_DOC) || path.accept(DTOPath.ITEM_GC_FOR_LAUNCH)) {
            manufacturer = (dsp5.getManufacturer() == null ? null : new ConcreteBusinessPartnerDTO(dsp5.getManufacturer(), path));
        }

        if (path.accept(DTOPath.PROGRAM_GC_FOR_LAUNCH)) {
            items = new HashSet<ItemDTO>();
            if (dsp5.getItems() != null) {
                for (Item item : dsp5.getItems()) {
                    items.add(new ItemDTO(item, DTOPath.ITEM_GC_FOR_LAUNCH));
                }
            }
        }
        // related document are displayed on board ?
        relatedDocuments = new HashMap<Long, String>();
View Full Code Here

Examples of net.stinfoservices.pacifiq.shared.dto.inner.ItemDTO

            items = new HashSet<ItemDTO>();
            if (taa.getItems() != null) {
                for (Item item : taa.getItems()) {
                    // DTOPath.ITEM_NAME
                    items.add(new ItemDTO(item, DTOPath.NOTHING_TO_SAY));
                }
            }
        }

        if (taa instanceof SpecificTAA) {
View Full Code Here

Examples of org.multibit.mbm.client.interfaces.rest.api.item.ItemDto

      .retrieveBySku("0575088893");

    // Assert
    assertTrue(optionalItem.isPresent());

    ItemDto actualItem = optionalItem.get();

    assertEquals("0575088893",actualItem.getSKU());
    assertEquals("The Quantum Thief",actualItem.getOptionalProperties().get("title"));
  }
View Full Code Here

Examples of org.multibit.mbm.client.interfaces.rest.api.item.ItemDto

    List<ItemDto> clientItems = Lists.newArrayList();
    for (Map.Entry<String, ReadableRepresentation> itemResource : rr.getResources()) {

      List<Link> links = itemResource.getValue().getLinks();

      ItemDto clientItem = ClientItemHandler.buildClientItem(itemResource.getValue().getProperties(), links);

      clientItems.add(clientItem);
    }

    return clientItems;
View Full Code Here

Examples of org.multibit.mbm.client.interfaces.rest.api.item.ItemDto

    ReadableRepresentation rr = unmarshalHal(hal);

    Map<String, Object> properties = rr.getProperties();
    List<Link> links = rr.getLinks();

    ItemDto item = buildClientItem(properties, links);

    return Optional.of(item);
  }
View Full Code Here

Examples of org.multibit.mbm.client.interfaces.rest.api.item.ItemDto

   * @param links      The HAL links
   *
   * @return A PublicItem
   */
  public static ItemDto buildClientItem(Map<String, Object> properties, List<Link> links) {
    ItemDto item = new ItemDto();

    // Mandatory properties (will cause IllegalStateException if not present)
    item.setSKU(getMandatoryPropertyAsString("sku", properties));
    item.setPrice(getMandatoryPropertyAsString("price", properties));
    item.setTaxRate(getMandatoryPropertyAsString("tax_rate", properties));

    // Optional direct properties
    if (properties.containsKey("gtin")) {
      Object gtin = properties.get("gtin");
      if (gtin != null) {
        item.setGTIN((String) gtin);
      }
    }

    // Optional properties
    for (Map.Entry<String, Object> entry : properties.entrySet()) {
      if ("sku".equals(entry.getKey()) ||
        "gtin".equals(entry.getKey()) ||
        "price".equals(entry.getKey()) ||
        "tax_rate".equals(entry.getKey())) {
        continue;
      }
      item.getOptionalProperties().put(entry.getKey(), (String) entry.getValue());
    }

    // Optional links
    for (Link link : links) {
      item.getOptionalProperties().put(link.getRel(), link.getHref());
    }

    return item;
  }
View Full Code Here

Examples of org.multibit.mbm.client.interfaces.rest.api.item.ItemDto

*/
public class CopyItem implements DomainAdapter<ItemDto, Item> {

  @Override
  public ItemDto on(Item item) {
    ItemDto dto = new ItemDto();

    dto.setId(item.getId().toString());

    dto.setGTIN(item.getGTIN());
    dto.setSKU(item.getSKU());

    dto.setPrice(item.getLocalPrice().toString());
    dto.setTaxRate(String.valueOf(item.getTaxRate()));

    for (Map.Entry<ItemField, ItemFieldDetail> entry: item.getItemFieldMap().entrySet()) {

      String name = entry.getKey().getPropertyNameSingular();
      String value = entry.getValue().getPrimaryDetail().getContent();

      dto.getOptionalProperties().put(name,value);

    }

    return dto;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.