• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Inheritance ERRest
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Inheritance ERRest


  • Subject: Inheritance ERRest
  • From: Elizio Marcelino <email@hidden>
  • Date: Mon, 02 Dec 2013 22:41:34 -0200

Hi,


I'm having trouble working with ERRest and EO with inheritance.

I have the following structure in my EO Model.

Order
  - id
  - quantity
  - NSArray<AbstractPayment> payments


AbstractPayment
  - id - autoIncrement
  - status

CreditCardPayment extends AbstractPayment
  - amount
  - installments

DebitCardPayment extends AbstractPayment
  - number
  - holder

In my REST API, in my class OrderController doing well CreateAction:

public WOActionResults createAction() throws Throwable {
     Order order = (Order)create(entityName(), filterWithAllRecursive());
}

I am making the following call with rest:

{
"status":"created",
"payments": [
   {
      "type": "CreditCardPayment"
      "amount":100
     "instalments": 1
  }
]
}

If you notice my class CreditCardPayment extends AbstractPayment, and when I send my request to the list of payment am having the following error:

<com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException message '<AbstractPayment 0x7656e376> takeValueForKey(): attempt to assign value to unknown key: 'amount'.

This class does not have an instance variable of the name amount or _amount, nor a method of the name setAmount or _setAmount' object '<AbstractPayment pk:"null">' key 'amount'>



I believe when it is done trying to convert JSON to the Order object it is trying to convert the List of payment for AbstractPayment and not to CreditCardPayment.

How can we show to create what should be done by CreditCardPayment DebitCartPayment or not by AbstractPayment?



Thank you.
Elizio

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Inheritance ERRest
      • From: Henrique Prange <email@hidden>
  • Prev by Date: Re: WOBootstrap.jar importance
  • Next by Date: Re: Entity join with different data sources?
  • Previous by thread: Re: WOBootstrap.jar importance
  • Next by thread: Re: Inheritance ERRest
  • Index(es):
    • Date
    • Thread