Package com.abiquo.model.transport

Examples of com.abiquo.model.transport.LinksDto


   public <R extends HttpRequest> R bindToRequest(final R request, final Object input) {
      checkArgument(checkNotNull(input, "input") instanceof SingleResourceTransportDto[],
            "this binder is only valid for SingleResourceTransportDto arrays");

      SingleResourceTransportDto[] dtos = (SingleResourceTransportDto[]) input;
      LinksDto refs = new LinksDto();

      for (SingleResourceTransportDto dto : dtos) {
         RESTLink editLink = checkNotNull(dto.getEditLink(), "entity must have an edit link");

         // Do not add repeated references
         if (refs.searchLinkByHref(editLink.getHref()) == null) {
            refs.addLink(new RESTLink(getRelToUse(input), editLink.getHref()));
         }
      }

      return super.bindToRequest(request, refs);
   }
View Full Code Here


      checkArgument(checkNotNull(input, "input") instanceof VirtualDatacenterDto,
            "this binder is only valid for VirtualDatacenterDto objects");

      VirtualDatacenterDto vdc = (VirtualDatacenterDto) input;
      RESTLink editLink = checkNotNull(vdc.getEditLink(), "VirtualDatacenterDto must have an edit link");
      LinksDto refs = new LinksDto();
      refs.addLink(new RESTLink("virtualdatacenter", editLink.getHref()));

      return super.bindToRequest(request, refs);
   }
View Full Code Here

            "this binder is only valid for VLANNetworkDto objects");

      VLANNetworkDto network = (VLANNetworkDto) input;
      RESTLink editLink = checkNotNull(network.getEditLink(), "VLANNetworkDto must have an edit link");

      LinksDto refs = new LinksDto();
      switch (network.getType()) {
         case INTERNAL:
            refs.addLink(new RESTLink("internalnetwork", editLink.getHref()));
            break;
         case EXTERNAL:
            refs.addLink(new RESTLink("externalnetwork", editLink.getHref()));
            break;
         case PUBLIC:
            refs.addLink(new RESTLink("publicnetwork", editLink.getHref()));
            break;
         case UNMANAGED:
            refs.addLink(new RESTLink("unmanagednetwork", editLink.getHref()));
            break;
         default:
            // TODO: EXTERNAL_UNMANAGED network type
            throw new IllegalArgumentException("Unsupported network type");
      }
View Full Code Here

      VLANNetworkDto network = (VLANNetworkDto) input;
      checkArgument(network.getType() == NetworkType.UNMANAGED, "this binder is only valid for UNMANAGED networks");

      RESTLink ipsLink = checkNotNull(network.searchLink("ips"), "VLANNetworkDto must have an ips link");

      LinksDto refs = new LinksDto();
      refs.addLink(new RESTLink("unmanagedip", ipsLink.getHref()));

      return super.bindToRequest(request, refs);
   }
View Full Code Here

TOP

Related Classes of com.abiquo.model.transport.LinksDto

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.