we have created a jBPM workflow where we are passing custom object to create a workitem, we are passing this custom object as Map params.
Now using REST API "List getTasksAssignedAsPotentialOwnerByStatus" we can retrieve the TaskSummary for assigned userId, here TaskSummary object is predefined with fields, can anybody please guide me if i want to customize my response (i.e. if i want to retrieve additional parameters in the TaskSummary) then how can i do it using REST API?
The task summary should link a content id (in task data), containing the parameters you passed. Use this content id to get the content.
Related
i need to expose Rest API which retrieve information about Brand based on brandId,
so i need to send brandId parameter.
from Rest Architecture and Design perspective, should i use Post (with the parameter in the body), or use Get and send the parameter as query string or header
You should use GET. POST is used to put or update some new information into service/database.
Try to read this: What is the difference between POST and GET?
And this: When should I use GET or POST method? What's the difference between them?
i used GET, and sent the parameter brandId as path variable
I have a user entry form with the following fields :
Name
Age
Address
I want to convert its value to JSON and save it in a database. How can I achieve this?
Which library can I use ?
At server side in servlet save all request parameters to corresponding bean and then you can convert using google's gson library for more info check this tutorial
For example:
You need servlet that takes form submission
To work with JSON I recommend eclipse source minimal JSON, I like it
database - plain JDBC, hibernate or JPA ..
Refer the following steps:
In JSP page, at javascript convert the form fields to JSON using JSON.stringify() method.
At server parse the JSON using appropriate JSON parsers like GSON or Jackson.
After parsing you will get desired object.
Perform database operation on the object.
You will probably need GSON jar , Jackson jar.
I'm developing REST services using Jersey.
So, if I have an object of User type (which contains information about a User), like:
User userObj = new User();
And I want to provide that information by a GET method, in both JSON and XML.
I already can provide it in JSON, by using gson.toJson(userObj). And what about XML?
Thanks
Take a look at the JAXB API. It provides a way to map XML to classes with simple getter/setter methods. http://jaxb.java.net/tutorial/section_1_1-Introduction.html#About%20JAXB
I have two entities : User and Post (relation one-to-many). Post fields: id, creationDate, title, content, user.
Data is stored in the database and accessed via Hibernate.
I have a controller to pass Post object as a JSON to JavaScript. Then it is shown on the web page. But it is not always necessary to pass all the Post fields. For ex., I need to show to the user only title and creation date, and if the user presses the button Show content, only then I need to show post content (which I want to request from server only when it is need to show).
So here is a problem: How can I implement lazy initialization of the content field in Post object? Should I write two methods in my controller: one for generating JSON with list of Posts and setting content field to null or empty String, and another to pass only content string?
Make post content an object and a single table in db.
It looks like the following in java:
public class Post {
...
PostContent postContent;
}
First you may try to initialize the lazy collection at the DAO via Hibernate.initialize(lazyCollection). If it didn't work then either use FetchType.EAGER or keep the session open during request and the collection should be fetched when needed.
I have a created a custom field in Contacts object in Salesforce whose API name is "Resume_Text__c" and I'm making a SOAP call to get the value of that filed using Java Implementation by writing a following SOQL.
SELECT Resume_Text__c FROM Contact
But execution of query throwing following exception.
No such column 'Resume_Text__c' on entity 'Contact'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.'
So how can I access custom field via Soap API Java Implementation?
Whenever you are using Enterprise.wsdl file in your implementation, you need to make sure that every time you create some new fields and object on Salesforce.com environment, you refresh your Enterprise.wsdl to import all the dependency mappings else go with Partner.wsdl.