Partial progress on the Betwixt issue
17 February 2008I had two problems yesterday when converting my XML document to a Java bean using Betwixt: 1) the payload description was not coming across, and 2) the approver details were not coming across. With just a little bit of research on the old Internet and a little bit of trial and error, I was able to resolve the first issue by adding this line to the buildRequestForApprovalFromInput() method of the RequestForApprovalServlet:
reader.addBeanPropertySetter("approval:rfa/payload", "description");
That was the easy part! I’m not having quite as much luck with issue #2, the approver’s details. The problem, I believe, stems from the fact that I have this generic “Person” class that I use for authors, approvers, and authenticated users. Because it is used in a number of different roles, the Betwixt mapping file does not have a “name” attribute at the highest level:
<?xml version="1.0" encoding="UTF-8" ?>
<info primitiveTypes="element">
<element property='name'>
<attribute name='id' property='id'/>
<attribute name='xlink:href' property='uri'/>
</element>
</info>
This seems to work just fine when going from Java bean to XML, but when going from XML to Java bean, I’m just not smart enough to get it to work. There are a number of ways that I could reconfigure the XML and/or the Java classes to work around this problem, but before I do that, I am going to attempt to actually solve the problem. Of course, I may not be able to do that, in which case I’ll have to reconfigure some of the data structures that I have already created, but before I start that process, I am going to give it the old college try and see if I can’t come up with a solution.
Now, if you are reading this, and you know what it is that I am doing wrong here, then by all means, please do me the favor of leaving me a comment and setting me in the right direction. I don’t necessarily mind figuring these things out for myself, but I really don’t see the point in all of that trauma if someone out there already has the answer!
Sorry, the comment form is closed at this time.





