I've create a project VDM java.In Query response i would like to split the input filters is it possible?
public class ControStatus {
private final Logger log = LoggerFactory.getLogger(this.getClass());
@Query(serviceName = "CatalogService", entity = "ControStatus")
public QueryResponse getEntity(QueryRequest queryRequest) {
DefaultZSCPSCPDISRVService ControlStatus = new DefaultZSCPSCPDISRVService();
FilterExpression filtriFrontEnd = FilterExpressionConverter.convertTo(queryRequest.getQueryExpression());
log.error("Filtri" + filtriFrontEnd.toString());
}
}
When they call srv passing some filters eg. .... / CatalogService / ControStatus? $ Filter = Bukrs eq "XXXX" and Werks eq "XXXX". I can read them with queryRequest.getQueryExpression()
, in the form of filter.Expression. There is a way to turn the answer into a json and read the individual values.Es. What value did they pass for bukrs or werks?
I'm not aware of a way how to extract the information from the type
FilterExpression
. This is API coming from the CAP / SAP Service SDK library. You can find their official documentation here. My suggestion would be to ask the authors of this library. The tagsap-cloud-sdk
refers to a different API, the SAP Cloud SDK. Let me know if you need help for establishing contact.I know that the class is regularly used with
Object#toString
method for constructing a query string. In a similar fashion you could extract the field values via regex:Example:
The problem is: you wouldn't know whether the filters are part of a conjunction or disjunction, parentheses are also not considered. In addition you should consider other operations than
eq
/ne
/gt
as well.