Examples of withProperty()


Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

    Representation itemList = Representations.newPaginatedList(self, items);

    for (Item item : items.list()) {
      Representation itemRepresentation = customerItemRepresentation.get(item);

      itemRepresentation.withProperty("id", item.getId())
        // End of build
        ;

      itemList.withRepresentation("/item/" + item.getId(), itemRepresentation);
    }
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

      ;

    // Build a sub-Representationrepresenting all the authorities bound to this Role
    Representation authoritiesRepresentation = new DefaultRepresentationFactory().newRepresentation("authorities");
    for (Authority authority : role.getAuthorities()) {
      authoritiesRepresentation.withProperty(authority.name(),Boolean.TRUE);
    }
    roleRepresentation.withRepresentation("authorities", authoritiesRepresentation);

    return roleRepresentation;
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

    Representation purchaseOrderList = Representations.newPaginatedList(self, purchaseOrders);

    for (PurchaseOrder purchaseOrder : purchaseOrders.list()) {
      Representation purchaseOrderRepresentation = new SupplierPurchaseOrderRepresentation().get(purchaseOrder);

      purchaseOrderRepresentation.withProperty("id", purchaseOrder.getId())
      // End of build
      ;

      purchaseOrderList.withRepresentation("/purchase-order/" + purchaseOrder.getId(), purchaseOrderRepresentation);
    }
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

    // Apply restrictions against the more detailed representation
    Preconditions.checkNotNull(user, "user");
    Preconditions.checkNotNull(user.getId(), "id");

    // Add properties
    userRepresentation.withProperty("username", user.getUsername());

    // Convert the ContactMethodDetails map into primary and secondary property entries
    for (Map.Entry<ContactMethod, ContactMethodDetail> entry : user.getContactMethodMap().entrySet()) {
      String propertyName = entry.getKey().getPropertyNameSingular();
      ContactMethodDetail contactMethodDetail = entry.getValue();
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

    for (Map.Entry<ContactMethod, ContactMethodDetail> entry : user.getContactMethodMap().entrySet()) {
      String propertyName = entry.getKey().getPropertyNameSingular();
      ContactMethodDetail contactMethodDetail = entry.getValue();
      String primaryDetail = contactMethodDetail.getPrimaryDetail();

      userRepresentation.withProperty(propertyName, primaryDetail);

      // Determine if secondary details should be included
      if (entry.getKey().isSecondaryDetailSupported()) {
        Set<String> secondaryDetails = contactMethodDetail.getSecondaryDetails();
        // TODO Consider if a 1-based field index is the best representation here: array? sub-resource?
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

      if (entry.getKey().isSecondaryDetailSupported()) {
        Set<String> secondaryDetails = contactMethodDetail.getSecondaryDetails();
        // TODO Consider if a 1-based field index is the best representation here: array? sub-resource?
        int index = 1;
        for (String secondaryDetail : secondaryDetails) {
          userRepresentation.withProperty(propertyName + index, secondaryDetail);
          index++;
        }
      }
    }
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

    Representation cartList = Representations.newPaginatedList(self, carts);

    for (Cart cart : carts.list()) {
      Representation cartRepresentation= publicCartRepresentation.get(cart);

      cartRepresentation.withProperty("id", cart.getId())
      // End of build
      ;

      cartList.withRepresentation("/cart/" + cart.getId(), cartRepresentation);
    }
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

      // TODO Consider how i18n will be transmitted
      // Consider filtering on Locale
      if (isLink) {
        userRepresentation.withLink(propertyName,primaryDetail.getContent());
      } else {
        userRepresentation.withProperty(propertyName, primaryDetail.getContent());
      }
      Set<LocalisedText> secondaryDetails = itemFieldDetail.getSecondaryDetails();
      // TODO Consider if a 1-based field index is the best representation here: array? sub-resource?
      int index = 1;
      for (LocalisedText secondaryDetail : secondaryDetails) {
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

    // Apply restrictions against the more detailed representation
    Preconditions.checkNotNull(user, "user");
    Preconditions.checkNotNull(user.getId(), "id");

    // Add properties
    representation.withProperty("username", user.getUsername());

    // Convert the ContactMethodDetails map into primary and secondary property entries
    for (Map.Entry<ContactMethod, ContactMethodDetail> entry : user.getContactMethodMap().entrySet()) {
      String propertyName = entry.getKey().getPropertyNameSingular();
      ContactMethodDetail contactMethodDetail = entry.getValue();
View Full Code Here

Examples of com.theoryinpractise.halbuilder.api.Representation.withProperty()

    for (Map.Entry<ContactMethod, ContactMethodDetail> entry : user.getContactMethodMap().entrySet()) {
      String propertyName = entry.getKey().getPropertyNameSingular();
      ContactMethodDetail contactMethodDetail = entry.getValue();
      String primaryDetail = contactMethodDetail.getPrimaryDetail();

      representation.withProperty(propertyName, primaryDetail);

      // Determine if secondary details should be included
      if (entry.getKey().isSecondaryDetailSupported()) {
        Set<String> secondaryDetails = contactMethodDetail.getSecondaryDetails();
        // TODO Consider if a 1-based field index is the best representation here: array? sub-resource?
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.