rave-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Gornstein <...@gornstein.com>
Subject Adding pageId and widgetTitle to RegionWidget Rest Model
Date Fri, 13 Sep 2013 14:15:09 GMT

I put up an earlier patch on JIRA-1045 [1] which added widgetTitle to the
RegionWidget rest model and only added it to the response in the pages for
render endpoint.

This sparked some discussion about adding immutable fields to the Rest
model. While there was some discussion, I don't believe there was a

I was working more on the angular branch adding a RegionWidget controller
which handles the events on a RegionWidget. Whenever you want to save a
RegionWidget with the angular resource, you need to supply the pageId
because it is in the URL path of the endpoint. It does not make sense to
have to pull this information from somewhere else, because you lose the
feature of being able to call .$save() directly on an instance of an
angular RegionWidget resource, without having to supply additional
information such as $.save(pageId).

Similarly, when rendering the chrome of a RegionWidget on the page, you
need to have the title to put in the top bar. It again does not make sense
to have to grab this information separately.

I have created a new patch for both JIRA-1045 [1] and JIRA-1047 [2], which
can be found on the review board [3]

This patch covers a few different things:

1. It adds pageId and widgetTitle to the rest model.

2. It sets the pageId and widgetTitle when hitting' /pages/render' endpoint
or a 'pages/id/regions/id/regionWidget/id' endpoint.

When hitting the '/pages/id' or '/pages/id/regions/id' endpoints those
properties will be null, but this is okay because we plan to make those
endpoints return flat data models in the near future anyways.

3. It fills in the update method for the RegionWidget Rest endpoint, which
now also handles being able to move RegionWidgets between pages, regions,
and render order. All you have to do is change these properties on the
RegionWidget object when saving.

This is where I believe we should 'document' that there are immutable
fields in the form of comprehensive error messages. If you try to change
the widgetTitle when saving to the REST endpoint, it will throw a
BadRequestException with the correct error code and a detailed message
describing the issue.

What still needs to be added in is error messaging for the move feature,
which will describe what went wrong if changing the page, region, or order
properties incorrectly. I believe this can come later when we strengthen
the REST API. It would be nice to have this feature in the api now to
continue with angular development.

If there are no strong reservations or better alternate solutions I plan to
apply this patch to trunk and merge it into the angular branch over the

Dan Gornstein

[1] https://issues.apache.org/jira/browse/RAVE-1045
[2] https://issues.apache.org/jira/browse/RAVE-1047
[3] https://reviews.apache.org/r/14125/

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message