On 02/10/2014 01:28 AM, Thomas Frühbeck wrote:
Hi,
I wanted to work with AngularJS scaffold in Forge and ask for your help.
With Forge2, I did not find the way to install the angularjs-scaffold-x
as addon/plugin.
Is there some guidance available on how to use oldstyle plugins as addons?
Stepping back to Forge 1.4 I successfully created a simple parent/child
application.
On deployment on Wildfly 8.0.0 CR1 I found following issues:
Setup: I created a parent and then a child, the child referencing the
parent.
Issue 1:
- w/o any modifications I got a StackOverflowError in
org.codehaus.jackson.map.ser.BeanSerializer because infinite loop
between parent/child
Hey ! Vineet will certainly give you the right answer but
which
strategy option did you use to generate your REST endpoint ? You have to
make sure to use "--strategy ROOT_AND_NESTED_DTO" this way your
relations will be managed well.
i.e : "
|rest endpoint-from-entity --contentType application/json
org.jboss.aerogear.judconcricket.model.* --strategy ROOT_AND_NESTED_DTO
|
My solution was to:
- import org.codehaus.jackson/jackson-jaxrs maven dependency
(because this is, what Wildfly seems to use per default)
- add @JsonManagedReference/@JsonBackReference on the
parent.children and child.parent properties resp.
Is there some simpler/more obvious fix for the problem?
In Fasterxml Jackson 2.x there is a @JsonIdentityInfo, could this be a
way to solve the issue?
I seem to be unable to activate Fasterxml.Jackson on Wildfly :-/
Issue 2:
- by above @JsonBackReference the child.parent property was not
serialized and so the reference did not show up as selected in the
parents <select> options
My solution was to rewrite the EditChildController to check for
parent.id from the parents side (because child.parent is empty):
for (var idx=0; idx < item.children.length; idx++) {
if (item.children[idx].id === $scope.child.id) {
$scope.parentSelection = labelObject;
$scope.child.parent = wrappedObject;
}
}
Original code:
if($scope.child.parent && item.id ==
$scope.child.parent.id) {
$scope.parentSelection = labelObject;
$scope.child.parent = wrappedObject;
self.original.parent = $scope.child.parent;
}
Again I ask for your expertise, if this is a problem I introduced by
misusing @JsonBackReference or if this needs a fix in the scaffold.
Thank you for your great work on Forge and this incredible AngularJS
plugin :-)
Thomas
_______________________________________________
forge-dev mailing list
forge-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev