Yes, the EDS can do that. There are some differences in the sample EDS service to achieve this:
- Property A and B are marked as hasDependentProperties. Then changing any of them will trigger EDS call to the EDS service
- When EDS gets the request, there will be a "properties" JSON data containing all property values from the ICN page. Then the EDS service can return as:
- If A has a value and B has not, return values/choices for B
- If A has a value and B has a value, return other values according to it.
- The sample EDS Service uses a propertyData from JSON file to do this, but actually, how to return data depends on the service logic, not only from the JSON file.
Here is an additional logic I tried with Book_PropertyData.json from the sample EDS service.
a. A Book class to CPE with String property Author and String property Title
b. Add "hasDependentProperties":true to all DocumentTitle definitions in json File
c. In EDS service UpdateObjectTypeServlet.java add logic before sending a response json. The Title will be set to "Got it" after Author is set to "George Martin" and DocumentTitle is set to "A Game of Thrones".
String authorValue = "";
String documentTitle = "";
for (int j = 0; j < requestProperties.size(); j++) {
JSONObject requestProperty = (JSONObject)requestProperties.get(j);
String name = String.valueOf(requestProperty.get("symbolicName"));
String value = String.valueOf(requestProperty.get("value"));
if( name.equals( "Author" ) ) {
authorValue = value;
}else if( name.equals( "DocumentTitle" ) ) {
documentTitle = value;
}
}
if( authorValue.equals( "George Martin" ) && documentTitle.equals( "A Game of Thrones" ) ) {
JSONObject title = JSONObject.parse( "{\"symbolicName\":\"Title\",\"value\":\"Got it\"}" );
responseProperties.add( title );
}------------------------------
JIE ZHANG
------------------------------