Ref:  CPS-291 - Getting issue details... STATUS

Introduction

The query requested by a client is defined in the java (and REST) API using cpsPath (string) parameter.
cpsPath is to follow xPath 3.0 expressions. As CPS evolves more xPath functionality will be supported.

Currently the cpsPath (string) is passed straight from cps-service to the cps-reference-implementation (cps-ri). Any parsing of cpsPath happens in cps-ri and is then translated into sql queries (some native to postgreSql)

This study is to consider moving the parsing of cpsPath to the cps-service and to consider possible interface alternatives for the cps-ri SPI

Overview

  • The class CpsPathQuery is responsible for path the cpsPath String and recognizing the type of query the string represent.
  • Currently only 2 queries are supported
    • cpsPath 'ends-with' a given string
    • leaf of a object identified by xPath has a given value (use to identify element in a know list by any non–key field)
  • CpsPathQuery wil throw an exception if cpsPath query is invalid (not recognized)
  • CpsPatUQeey has a (enum) property to identify the type of query
  • CpsPathQuery stores and exposed the query paarmeters

Proposal

The proposal is to move CpsPathQuery from the cps-ri layer into the cps-service layer.

At the moment this would be very easy to refactor as all the required functionality is contained in a single class but we need to consider the impact on the cps-ri interface (SPI) 

Possible SPI  Options

  1. Extract out a data object who interface is interface directly based on the data (query type and parameters) contained in CpsPathQuery
  2. Introduce QueryBuilder pattern (similar to ENM DPS SPI)

Pros & Cons

#Current SolutionAlternative 1
1SPI  (query) Interface is simple and very stable, just one interface method with fixed parametersSPI query interface wil be more complicated and require regular changes as supported functionality evolves
2Reference Implementation can parse cpsPath considering underlying DB technologyCPS-Service as to break down cpsPath query into generic query element that any DB technology can easily implement
3Parsing of CPSPath (which will probably become a large and complicated part of cps code) can not be re-used  with other data layer implementationsParsing of cpsPath will be re-used


  • No labels