Change in ovirt-engine[master]: restapi: Recursively scan models when adding links

juan.hernandez at redhat.com juan.hernandez at redhat.com
Wed Jan 15 21:33:59 UTC 2014


Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: Recursively scan models when adding links
......................................................................


restapi: Recursively scan models when adding links

One of the steps to generate the output document from a model is to add
links to the referenced resources. We do this using reflection to
enumerate the properties of the model, checking which are resources and
adding "href" attributes computed from the identifiers. This works fine
but there are some situations where the referencs to the resources are
not direct children of the model, but grandchildren or potentially
deeper. For example, the work to add template versions will include a
model whose representation will that looks like this:

  <template id="...">
    ...
    <version>
      <base_resource id="..." href=".."/>
      <version_number>3</version_number>
      <version_name>three</version_number>
    </version>
  </template>

In this case the "base_resource" element is a reference to a resource
that isn't a direct child of the template resource, so the method we use
to create the links doesn't add the "href" attribute. This patch changes
the LinkHelper class so that it will recursively scan the model and add
the links in all the levels.

Change-Id: Ibff32c7a2ec65ac2f95bb1dd64361b3c98ef049b
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/interface/common/jaxrs/src/main/java/org/ovirt/engine/api/common/util/LinkHelper.java
1 file changed, 18 insertions(+), 8 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/23254
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibff32c7a2ec65ac2f95bb1dd64361b3c98ef049b
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Alissa Bonas <abonas at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Ori Liel <oliel at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list