Re: ERRest: rename entity node

Pascal Robert <[email protected]>
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <[email protected]>
Le 2013-01-17 à 10:50, Edward Merry <[email protected]> a écrit :

> WO geniuses,
> 
> I am developing an ERRest application to accept orders from one of our clients. The challenge is their data model is much simpler that ours so I have to bridge that gap. I took care of the structure differences by writing a decorator class around the root entity and then using the entity rest delegate to handle primary keys, etc. Works great.
> 
> Where I am stuck now is changing the name of a node (which is an actual entity). In the sample below, I'd like to change
> 
> <OrderItem id="6594930" type="OrderItem">
> 
> to
> 
> <item id="6594930" type="OrderItem">
> 
> (plus, the closing tag as well)
> 
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <SimpleOrder id="2339461" type="SimpleOrder">
>    <attention>John Doe</attention>
>    -- snip --
>    <items type="OrderItem">
>        <OrderItem id="6594930" type="OrderItem">
>            <itemDescription>PEBCCDV8US</itemDescription>
>            <itemTitle>BOS (8) Combo</itemTitle>
>            <quantity type = "integer">1</quantity>
>        </OrderItem>
>    </items>
>    <creationTime type = "datetime">2012-10-22T22:52:11Z</creationTime>
>    <lastModified type = "datetime">2012-10-23T06:58:02Z</lastModified>
> </SimpleOrder>
> 
> 
> I looked around and didn't see a simple solution. setExternalNameForInternalName just changes "type," not the node name.

I'm not aware of a solution, beside maybe creating a item class that would extend from OrderItem and you could use the sub-class. But I must say that in my point of view, when setExternalNameForInternalName is called, it should be change the type and the name. But changing that on a framework that people already use would be problematic.

> Is the solution to write my own format class(es)?
> 
> Edward Merry
> 
> P.S. The ERRest framework is fantastic. Thanks to Pascal, Mike and everyone who has contributed to it.
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> Wonder-disc mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wonder-disc


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.