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));
  }
Esempio n. 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;
  }