You need to sign in to do that
Don't have an account?
How to create DAO, DTO, Delegate class models using APEX - URGENT?
Hi,
My client is a salesforce consultant who insisted me to follow the OOP standards given below. The requirement is to create REST API services which would be called from external web application (Drupal website).
As per the client word....
"The REST services will provide serialised object data in JSON (JavaScript Object Notation). The JSON will be produced from serialised custom DTO classes rather than directly from SalesForce sObjects. These DTO classes will expose properties containing various aggregations, groupings and summary information"
Requirement:
Method: REST API @HTTPGET
Input: UserId (portal user)
Returns:
Account Name, Industry, Phone, Billing Address from Account Object
All Contacts [FirstName, LastName, Email, Phone, Department] for the Account
I am really confused that DTO's are wrapper classes kind of thing. I dont know how to combine the data from two objects (Account and Contacts) using DTO. What is DTO and how to start writing DTO's and how it can be used? Can anyone explain me in detail or provide me some examples would be very much helpful...
Thanks in advance
SKB
I guess what your customer wants is actaully a wrapper that you'll serialize. To combine objects you'll tipically add a contact List property to your class like that -minimalist code- : Then you'll be able to serialize it to something like
Hope this helps...
Of course you'd use constructors and setters to get something cleaner...