private void addLinks(UriInfo uriInfo) {
    action.setHref(UriBuilder.fromPath(getPath(uriInfo)).path(action.getId()).build().toString());

    String parentHref = LinkHelper.addLinks(uriInfo, parent).getHref();
    if (parentHref != null) {
      addLink("parent", parentHref);
    }
    addLink("replay", getPath(uriInfo));
  }
示例#2
0
 private void addStatistics(
     VM model, org.ovirt.engine.core.common.businessentities.VM entity, UriInfo ui) {
   model.setStatistics(new Statistics());
   VmStatisticalQuery query = new VmStatisticalQuery(newModel(model.getId()));
   List<Statistic> statistics = query.getStatistics(entity);
   for (Statistic statistic : statistics) {
     LinkHelper.addLinks(ui, statistic, query.getParentType());
   }
   model.getStatistics().getStatistics().addAll(statistics);
 }
 Disk addStatistics(
     Disk model,
     org.ovirt.engine.core.common.businessentities.Disk entity,
     UriInfo ui,
     HttpHeaders httpHeaders) {
   if (DetailHelper.include(httpHeaders, "statistics")) {
     model.setStatistics(new Statistics());
     DiskStatisticalQuery query = new DiskStatisticalQuery(newModel(model.getId()));
     List<Statistic> statistics = query.getStatistics(entity);
     for (Statistic statistic : statistics) {
       LinkHelper.addLinks(ui, statistic, query.getParentType());
     }
     model.getStatistics().getStatistics().addAll(statistics);
   }
   return model;
 }
  @Override
  protected Disk addLinks(Disk model, String... subCollectionMembersToExclude) {
    Snapshot snapshotInfo = model.getSnapshot();
    model.setSnapshot(null);
    super.addLinks(model, subCollectionMembersToExclude);
    if (snapshotInfo != null) {
      org.ovirt.engine.core.common.businessentities.Snapshot snapshot =
          getEntity(
              org.ovirt.engine.core.common.businessentities.Snapshot.class,
              VdcQueryType.GetSnapshotBySnapshotId,
              new IdQueryParameters(asGuid(snapshotInfo.getId())),
              snapshotInfo.getId());
      VM vm = new VM();
      vm.setId(snapshot.getVmId().toString());
      snapshotInfo.setVm(vm);
      model.setSnapshot(snapshotInfo);
      LinkHelper.addLinks(getUriInfo(), snapshotInfo, null, false);
      model.setSnapshot(snapshotInfo);
    }

    return model;
  }
 /**
  * @param model the resource to add actions to
  * @return collection with action links
  */
 protected <C extends ActionableResource> C addActions(C model) {
   LinkHelper.addActions(getUriInfo(), model, this);
   return model;
 }