Package com.abiquo.model.rest

Examples of com.abiquo.model.rest.RESTLink


      AbstractIpDto[] ips = (AbstractIpDto[]) input;
      LinksDto refs = new LinksDto();

      for (AbstractIpDto ip : ips) {
         RESTLink selfLink = checkNotNull(LinkUtils.getSelfLink(ip), "AbstractIpDto must have an edit or self link");
         if (refs.searchLinkByHref(selfLink.getHref()) == null) {
            RESTLink ref = new RESTLink(selfLink.getTitle(), selfLink.getHref());
            ref.setType(selfLink.getType());
            refs.addLink(ref);
         }
      }

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


      VLANNetworkDto network = (VLANNetworkDto) input;
      VirtualMachineDto vm = (VirtualMachineDto) Iterables.find(gRequest.getInvocation().getArgs(),
            Predicates.instanceOf(VirtualMachineDto.class));

      RESTLink configLink = checkNotNull(vm.searchLink("configurations"), "missing required link");

      LinksDto dto = new LinksDto();
      dto.addLink(new RESTLink("network_configuration", configLink.getHref() + "/" + network.getId()));

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

   public <R extends HttpRequest> R bindToRequest(final R request, final Object input) {
      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

   }

   public static EnterpriseDto enterprisePut() {
      EnterpriseDto enterprise = enterprisePost();
      enterprise.setId(1);
      enterprise.addLink(new RESTLink("edit", "http://localhost/api/admin/enterprises/1"));
      enterprise.addLink(new RESTLink("limits", "http://localhost/api/admin/enterprises/1/limits"));
      enterprise.addLink(new RESTLink("users", "http://localhost/api/admin/enterprises/1/users"));
      enterprise.addLink(new RESTLink("properties", "http://localhost/api/admin/enterprises/1/properties"));
      enterprise.addLink(new RESTLink("reservedmachines", "http://localhost/api/admin/enterprises/1/reservedmachines"));
      enterprise.addLink(new RESTLink("datacenterrepositories",
            "http://localhost/api/admin/enterprises/1/datacenterrepositories"));
      enterprise.addLink(new RESTLink("externalnetworks",
            "http://localhost/api/admin/enterprises/1/action/externalnetworks"));
      enterprise.addLink(new RESTLink("virtualmachines",
            "http://localhost/api/admin/enterprises/1/action/virtualmachines"));
      enterprise.addLink(new RESTLink("cloud/virtualdatacenters",
            "http://localhost/api/admin/enterprises/1/action/virtualdatacenters"));
      enterprise.addLink(new RESTLink("virtualappliances",
            "http://localhost/api/admin/enterprises/1/action/virtualappliances"));
      enterprise.addLink(new RESTLink("appslib/templateDefinitionLists",
            "http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists"));

      return enterprise;
   }
View Full Code Here

      EnterprisePropertiesDto enterpriseProp = new EnterprisePropertiesDto();
      enterpriseProp.setId(1);
      Map<String, String> props = Maps.newHashMap();
      props.put("key", "value");
      enterpriseProp.setProperties(props);
      enterpriseProp.addLink(new RESTLink("edit", "http://localhost/api/admin/enterprises/1/properties"));
      enterpriseProp.addLink(new RESTLink("enterprise", "http://localhost/api/admin/enterprises/1"));

      return enterpriseProp;
   }
View Full Code Here

      checkNotNull(type, "network service type cannot be null");
      target.setNetworkServiceTypeLink(type.unwrap().getEditLink().getHref());
   }

   public NetworkServiceType getNetworkServiceType() {
      RESTLink link = target.getNetworkServiceTypeLink();

      HttpResponse response = context.getApi().get(link);

      ParseXMLWithJAXB<NetworkServiceTypeDto> parser = new ParseXMLWithJAXB<NetworkServiceTypeDto>(context.utils()
            .xml(), TypeLiteral.get(NetworkServiceTypeDto.class));
View Full Code Here

   }

   public static DatacenterLimitsDto datacenterLimitsPut(final EnterpriseDto enterprise) {
      DatacenterLimitsDto limits = datacenterLimitsPost();
      limits.setId(1);
      limits.addLink(new RESTLink("edit", "http://localhost/api/admin/enterprises/" + enterprise.getId() + "/limits/1"));
      return limits;
   }
View Full Code Here

   }

   public static TemplateDefinitionListDto templateListPut() {
      TemplateDefinitionListDto templateList = templateListPost();
      templateList.setId(1);
      templateList.addLink(new RESTLink("edit",
            "http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1"));
      templateList.addLink(new RESTLink("repositoryStatus",
            "http://localhost/api/admin/enterprises/1/appslib/templateDefinitionLists/1/actions/repositoryStatus"));
      return templateList;
   }
View Full Code Here

      user.setNick("abejo");
      user.setAuthType("ABIQUO");
      user.setLocale("en_US");
      user.setActive(true);
      user.setPassword("c69a39bd64ffb77ea7ee3369dce742f3");
      user.addLink(new RESTLink("role", "http://localhost/api/admin/roles/1"));
      return user;
   }
View Full Code Here

   }

   public static UserDto userPut() {
      UserDto user = userPost();
      user.setId(1);
      user.addLink(new RESTLink("edit", "http://localhost/api/admin/enterprises/1/users/1"));
      user.addLink(new RESTLink("enterprise", "http://localhost/api/admin/enterprises/1"));
      user.addLink(new RESTLink("virtualmachines",
            "http://localhost/api/admin/enterprises/1/users/1/action/virtualmachines"));
      return user;
   }
View Full Code Here

TOP

Related Classes of com.abiquo.model.rest.RESTLink

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.